diff --git a/.gitignore b/.gitignore index 92082f19..42ec9e7d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ mason-lock.json *.flutter-plugins-dependencies *.flutter-plugins +*.env diff --git a/examples/mirai_gallery/android/app/build.gradle b/examples/mirai_gallery/android/app/build.gradle index 7023f473..3cef43b0 100644 --- a/examples/mirai_gallery/android/app/build.gradle +++ b/examples/mirai_gallery/android/app/build.gradle @@ -24,6 +24,7 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle" android { compileSdkVersion flutter.compileSdkVersion diff --git a/examples/mirai_gallery/android/app/src/main/AndroidManifest.xml b/examples/mirai_gallery/android/app/src/main/AndroidManifest.xml index d5d35f2b..697edbbf 100644 --- a/examples/mirai_gallery/android/app/src/main/AndroidManifest.xml +++ b/examples/mirai_gallery/android/app/src/main/AndroidManifest.xml @@ -30,5 +30,11 @@ + + + diff --git a/examples/mirai_gallery/ios/Podfile.lock b/examples/mirai_gallery/ios/Podfile.lock index 3b52d011..29f735e5 100644 --- a/examples/mirai_gallery/ios/Podfile.lock +++ b/examples/mirai_gallery/ios/Podfile.lock @@ -1,22 +1,45 @@ PODS: - Flutter (1.0.0) + - flutter_config (0.0.1): + - Flutter + - google_maps_flutter_ios (0.0.1): + - Flutter + - GoogleMaps (< 9.0) + - GoogleMaps (6.2.1): + - GoogleMaps/Maps (= 6.2.1) + - GoogleMaps/Base (6.2.1) + - GoogleMaps/Maps (6.2.1): + - GoogleMaps/Base - webview_flutter_wkwebview (0.0.1): - Flutter DEPENDENCIES: - Flutter (from `Flutter`) + - flutter_config (from `.symlinks/plugins/flutter_config/ios`) + - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) +SPEC REPOS: + trunk: + - GoogleMaps + EXTERNAL SOURCES: Flutter: :path: Flutter + flutter_config: + :path: ".symlinks/plugins/flutter_config/ios" + google_maps_flutter_ios: + :path: ".symlinks/plugins/google_maps_flutter_ios/ios" webview_flutter_wkwebview: :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_config: f48f0d47a284f1791aacce2687eabb3309ba7a41 + google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99 + GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 -COCOAPODS: 1.15.2 +COCOAPODS: 1.13.0 diff --git a/examples/mirai_gallery/ios/Runner.xcodeproj/project.pbxproj b/examples/mirai_gallery/ios/Runner.xcodeproj/project.pbxproj index 5a58fb45..205d4824 100644 --- a/examples/mirai_gallery/ios/Runner.xcodeproj/project.pbxproj +++ b/examples/mirai_gallery/ios/Runner.xcodeproj/project.pbxproj @@ -198,6 +198,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 9182110C26875E7D26526D19 /* [CP] Embed Pods Frameworks */, + 5D9698FE94B37C1FBA620C82 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -285,6 +286,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 5D9698FE94B37C1FBA620C82 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 83A1AC20750C3F0F0F56EB86 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/examples/mirai_gallery/ios/Runner/AppDelegate.swift b/examples/mirai_gallery/ios/Runner/AppDelegate.swift index d2a14bfb..6726beb8 100644 --- a/examples/mirai_gallery/ios/Runner/AppDelegate.swift +++ b/examples/mirai_gallery/ios/Runner/AppDelegate.swift @@ -1,12 +1,20 @@ import UIKit import Flutter +import flutter_config +import GoogleMaps + @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + + //[Google map key] + let googleMapKey = FlutterConfigPlugin.env(for: "GOOGLE_MAP_KEY_IOS") + GMSServices.provideAPIKey(googleMapKey!) + GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/examples/mirai_gallery/lib/app/google_map/google_map_screen.dart b/examples/mirai_gallery/lib/app/google_map/google_map_screen.dart new file mode 100644 index 00000000..1c8e201c --- /dev/null +++ b/examples/mirai_gallery/lib/app/google_map/google_map_screen.dart @@ -0,0 +1,49 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:mirai/mirai.dart'; + +class GoogleMapScreen extends StatelessWidget { + const GoogleMapScreen({super.key}); + + @override + Widget build(BuildContext context) { + // log("data ${data.toJson()}"); + + + + return Mirai.fromJson({ + "type": "scaffold", + "appBar": { + "type": "appBar", + "title": { + "type": "text", + "data": "Google Map Example", + } + }, + "body": { + "type": "googleMap", + "initialCameraPosition": { + "target": { + "latitude": 37.42796133580664, + "longitude": -122.085749655962, + }, + "zoom": 14.4746, + "tilt": 10, + }, + "compassEnabled": true, + "mapToolbarEnabled": true, + "indoorViewEnabled": true, + "trafficEnabled": true, + "buildingsEnabled": true, + "myLocationButtonEnabled": true, + "padding": { + "left": 50, + "right": 10, + "bottom": 20, + } + } + }, context) ?? + const SizedBox(); + } +} diff --git a/examples/mirai_gallery/lib/main.dart b/examples/mirai_gallery/lib/main.dart index c046f758..0e21c894 100644 --- a/examples/mirai_gallery/lib/main.dart +++ b/examples/mirai_gallery/lib/main.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_config/flutter_config.dart'; import 'package:mirai/mirai.dart'; import 'package:mirai_gallery/app/details/details_screen.dart'; import 'package:mirai_gallery/app/example/example_screen_parser.dart'; @@ -9,16 +10,20 @@ import 'package:mirai_gallery/app/home/home_screen.dart'; import 'package:mirai_gallery/app_theme/app_theme_cubit.dart'; import 'package:mirai_webview/mirai_webview.dart'; +import 'app/google_map/google_map_screen.dart'; + class MyHttpOverrides extends HttpOverrides { @override HttpClient createHttpClient(SecurityContext? context) { return super.createHttpClient(context) - ..badCertificateCallback = - (X509Certificate cert, String host, int port) => true; + ..badCertificateCallback = (X509Certificate cert, String host, int port) => true; } } void main() async { + WidgetsFlutterBinding.ensureInitialized(); // Required by FlutterConfig + await FlutterConfig.loadEnvVariables(); + HttpOverrides.global = MyHttpOverrides(); await Mirai.initialize( parsers: const [ @@ -43,10 +48,12 @@ class MyApp extends StatelessWidget { theme: state.lightTheme, darkTheme: state.darkTheme, themeMode: state.themeMode, - homeBuilder: (context) => const HomeScreen(), + // homeBuilder: (context) => const HomeScreen(), + homeBuilder: (context) => const GoogleMapScreen(), title: 'Mirai Gallery', routes: { - '/homeScreen': (context) => const HomeScreen(), + // '/homeScreen': (context) => const HomeScreen(), + '/homeScreen': (context) => const GoogleMapScreen(), '/detailsScreen': (context) => const DetailsScreen(), }, ); diff --git a/examples/mirai_gallery/pubspec.lock b/examples/mirai_gallery/pubspec.lock index d1e81e2c..49e9d97a 100644 --- a/examples/mirai_gallery/pubspec.lock +++ b/examples/mirai_gallery/pubspec.lock @@ -169,6 +169,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" cupertino_icons: dependency: "direct main" description: @@ -230,6 +238,14 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.3" + flutter_config: + dependency: "direct main" + description: + name: flutter_config + sha256: a07e6156bb6e776e29c6357be433155acda87d1dab1a3f787a72091a1b71ffbf + url: "https://pub.dev" + source: hosted + version: "2.0.2" flutter_lints: dependency: "direct dev" description: @@ -238,11 +254,24 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" + source: hosted + version: "2.0.17" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" freezed: dependency: "direct dev" description: @@ -275,6 +304,54 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "47eef3836b49bb030d5cb3afc60b8451408bf34cf753e571b645d6529eb4251a" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + google_maps_flutter: + dependency: transitive + description: + name: google_maps_flutter + sha256: "982c2e22ec78d32701bfbd351311e8579a4952035381ac66462c0af11003107b" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "256b3c974e415bd17555ceff76a5d0badd2cbfd29febfc23070993358f639550" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: "0997f99d8bd8712f648a49bfc96a3cf2713cfdaf73a005c719aab74eaef94030" + url: "https://pub.dev" + source: hosted + version: "2.5.0" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + sha256: "167af879da4d004cd58771f1469b91dcc3b9b0a2c5334cc6bf71fd41d4b35403" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: "861c6dd430123e58bb1154342345c5bfa36064120c8ec3dbc0d0b7522add1861" + url: "https://pub.dev" + source: hosted + version: "0.5.6+2" graphs: dependency: transitive description: @@ -283,6 +360,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" http_multi_server: dependency: transitive description: @@ -311,10 +396,18 @@ packages: dependency: transitive description: name: js - sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.6.7" + js_wrapping: + dependency: transitive + description: + name: js_wrapping + sha256: e385980f7c76a8c1c9a560dfb623b890975841542471eade630b2871d243851c + url: "https://pub.dev" + source: hosted + version: "0.7.4" json_annotation: dependency: "direct main" description: @@ -417,7 +510,7 @@ packages: path: "../../packages/mirai" relative: true source: path - version: "0.6.0" + version: "0.7.0" mirai_framework: dependency: "direct overridden" description: @@ -496,6 +589,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" shelf: dependency: transitive description: @@ -629,6 +730,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" web_socket_channel: dependency: transitive description: @@ -678,5 +787,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.3 <4.0.0" - flutter: ">=3.16.6" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" diff --git a/examples/mirai_gallery/pubspec.yaml b/examples/mirai_gallery/pubspec.yaml index 5ea520bb..b6987169 100644 --- a/examples/mirai_gallery/pubspec.yaml +++ b/examples/mirai_gallery/pubspec.yaml @@ -39,6 +39,7 @@ dependencies: flutter_bloc: ^8.1.3 mirai: ^0.5.1 mirai_webview: ^0.0.2 + flutter_config: ^2.0.2 dev_dependencies: flutter_test: diff --git a/packages/mirai/lib/src/framework/mirai.dart b/packages/mirai/lib/src/framework/mirai.dart index cb8b3bfe..cb8d145a 100644 --- a/packages/mirai/lib/src/framework/mirai.dart +++ b/packages/mirai/lib/src/framework/mirai.dart @@ -69,6 +69,7 @@ class Mirai { const MiraiBottomNavigationViewParser(), const MiraiDefaultBottomNavigationControllerParser(), const MiraiWrapParser(), + const MiraiGoogleMapParser(), ]; static final _actionParsers = [ @@ -118,8 +119,7 @@ class Mirai { try { if (json != null && json['actionType'] != null) { String actionType = json['actionType']; - MiraiActionParser? miraiActionParser = - MiraiRegistry.instance.getActionParser(actionType); + MiraiActionParser? miraiActionParser = MiraiRegistry.instance.getActionParser(actionType); if (miraiActionParser != null) { final model = miraiActionParser.getModel(json); return miraiActionParser.onCall(context, model); diff --git a/packages/mirai/lib/src/parsers/mirai_container/mirai_container_parser.dart b/packages/mirai/lib/src/parsers/mirai_container/mirai_container_parser.dart index 506c2be1..0cc76ff8 100644 --- a/packages/mirai/lib/src/parsers/mirai_container/mirai_container_parser.dart +++ b/packages/mirai/lib/src/parsers/mirai_container/mirai_container_parser.dart @@ -1,3 +1,4 @@ + import 'package:flutter/cupertino.dart'; import 'package:mirai/mirai.dart'; import 'package:mirai/src/parsers/mirai_box_constraints/mirai_box_constraints.dart'; @@ -10,8 +11,7 @@ class MiraiContainerParser extends MiraiParser { String get type => WidgetType.container.name; @override - MiraiContainer getModel(Map json) => - MiraiContainer.fromJson(json); + MiraiContainer getModel(Map json) => MiraiContainer.fromJson(json); @override Widget parse(BuildContext context, MiraiContainer model) { diff --git a/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart b/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart index 87a678b6..bbe27742 100644 --- a/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart +++ b/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart @@ -19,23 +19,13 @@ class MiraiEdgeInsets with _$MiraiEdgeInsets { Map resultantJson; if (json is num) { - resultantJson = { - "left": json, - "top": json, - "right": json, - "bottom": json - }; + resultantJson = {"left": json, "top": json, "right": json, "bottom": json}; } else if (json is List && json.length == 4) { bool allElementsNum = json.every((element) => element is num); if (!allElementsNum) { throw ArgumentError('Invalid input format for MiraiEdgeInsets'); } - resultantJson = { - "left": json[0], - "top": json[1], - "right": json[2], - "bottom": json[3] - }; + resultantJson = {"left": json[0], "top": json[1], "right": json[2], "bottom": json[3]}; } else if (json is Map) { resultantJson = json; } else { @@ -44,6 +34,8 @@ class MiraiEdgeInsets with _$MiraiEdgeInsets { return _$MiraiEdgeInsetsFromJson(resultantJson); } + + static const MiraiEdgeInsets zero = MiraiEdgeInsets(bottom: 0, left: 0, right: 0, top: 0); } extension MiraiEdgeInsetsParser on MiraiEdgeInsets? { diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.dart new file mode 100644 index 00000000..a6b36ec1 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.dart @@ -0,0 +1,73 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:mirai/src/parsers/mirai_edge_insets/mirai_edge_insets.dart'; +import 'mirai_google_map_types/mirai_google_map_camera.dart'; +import 'mirai_google_map_types/mirai_google_map_circle.dart'; +import 'mirai_google_map_types/mirai_google_map_marker.dart'; +import 'mirai_google_map_types/mirai_google_map_polygon.dart'; +import 'mirai_google_map_types/mirai_google_map_polyline.dart'; +import 'mirai_google_map_types/mirai_google_map_tile_overlay.dart'; +import 'mirai_google_map_types/mirai_google_map_ui.dart'; +import 'mirai_google_map_types/mirai_google_map_web_gesture_handling.dart'; + +export 'package:mirai/src/parsers/mirai_google_map/mirai_google_map_parser.dart'; + +export 'mirai_google_map_types/mirai_google_map_camera.dart'; +export 'mirai_google_map_types/mirai_google_map_circle.dart'; +export 'mirai_google_map_types/mirai_google_map_marker.dart'; +export 'mirai_google_map_types/mirai_google_map_polygon.dart'; +export 'mirai_google_map_types/mirai_google_map_polyline.dart'; +export 'mirai_google_map_types/mirai_google_map_tile_overlay.dart'; +export 'mirai_google_map_types/mirai_google_map_ui.dart'; +export 'mirai_google_map_types/mirai_google_map_web_gesture_handling.dart'; + +part 'mirai_google_map.freezed.dart'; +part 'mirai_google_map.g.dart'; + +@freezed +class MiraiGoogleMap with _$MiraiGoogleMap { + const factory MiraiGoogleMap({ + // super.key, + required MiraiCameraPosition initialCameraPosition, + String? style, + // required Set> gestureRecognizers, + MiraiWebGestureHandling? webGestureHandling, + @Default(true) bool compassEnabled, + @Default(true) bool mapToolbarEnabled, + MiraiCameraTargetBounds? cameraTargetBounds, + @Default(MiraiGoogleMapType.normal) MiraiGoogleMapType mapType, + MiraiMinMaxZoomPreference? minMaxZoomPreference, + @Default(true) bool rotateGesturesEnabled, + @Default(true) bool scrollGesturesEnabled, + @Default(true) bool zoomControlsEnabled, + @Default(true) bool zoomGesturesEnabled, + @Default(false) bool liteModeEnabled, + @Default(true) bool tiltGesturesEnabled, + @Default(false) bool fortyFiveDegreeImageryEnabled, + @Default(true) bool myLocationEnabled, + required bool myLocationButtonEnabled, + String? layoutDirection, + + /// If no padding is specified default padding will be 0. + @Default(MiraiEdgeInsets.zero) MiraiEdgeInsets padding, + required bool indoorViewEnabled, + required bool trafficEnabled, + required bool buildingsEnabled, + @Default({}) Set markers, + @Default({}) Set circles, + @Default({}) Set polygons, + @Default({}) Set polylines, + @Default({}) Set tileOverlays, + Map? onCameraMoveStarted, + Map? onCameraMove, + Map? onCameraIdle, + Map? onTap, + Map? onLongPress, + Map? onMapCreated, + String? cloudMapId, + }) = _MiraiGoogleMap; + + factory MiraiGoogleMap.fromJson(Map json) => _$MiraiGoogleMapFromJson(json); +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.freezed.dart new file mode 100644 index 00000000..a82fec58 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.freezed.dart @@ -0,0 +1,1106 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiGoogleMap _$MiraiGoogleMapFromJson(Map json) { + return _MiraiGoogleMap.fromJson(json); +} + +/// @nodoc +mixin _$MiraiGoogleMap { +// super.key, + MiraiCameraPosition get initialCameraPosition => + throw _privateConstructorUsedError; + String? get style => + throw _privateConstructorUsedError; // required Set> gestureRecognizers, + MiraiWebGestureHandling? get webGestureHandling => + throw _privateConstructorUsedError; + bool get compassEnabled => throw _privateConstructorUsedError; + bool get mapToolbarEnabled => throw _privateConstructorUsedError; + MiraiCameraTargetBounds? get cameraTargetBounds => + throw _privateConstructorUsedError; + MiraiGoogleMapType get mapType => throw _privateConstructorUsedError; + MiraiMinMaxZoomPreference? get minMaxZoomPreference => + throw _privateConstructorUsedError; + bool get rotateGesturesEnabled => throw _privateConstructorUsedError; + bool get scrollGesturesEnabled => throw _privateConstructorUsedError; + bool get zoomControlsEnabled => throw _privateConstructorUsedError; + bool get zoomGesturesEnabled => throw _privateConstructorUsedError; + bool get liteModeEnabled => throw _privateConstructorUsedError; + bool get tiltGesturesEnabled => throw _privateConstructorUsedError; + bool get fortyFiveDegreeImageryEnabled => throw _privateConstructorUsedError; + bool get myLocationEnabled => throw _privateConstructorUsedError; + bool get myLocationButtonEnabled => throw _privateConstructorUsedError; + String? get layoutDirection => throw _privateConstructorUsedError; + + /// If no padding is specified default padding will be 0. + MiraiEdgeInsets get padding => throw _privateConstructorUsedError; + bool get indoorViewEnabled => throw _privateConstructorUsedError; + bool get trafficEnabled => throw _privateConstructorUsedError; + bool get buildingsEnabled => throw _privateConstructorUsedError; + Set get markers => throw _privateConstructorUsedError; + Set get circles => throw _privateConstructorUsedError; + Set get polygons => throw _privateConstructorUsedError; + Set get polylines => throw _privateConstructorUsedError; + Set get tileOverlays => throw _privateConstructorUsedError; + Map? get onCameraMoveStarted => + throw _privateConstructorUsedError; + Map? get onCameraMove => throw _privateConstructorUsedError; + Map? get onCameraIdle => throw _privateConstructorUsedError; + Map? get onTap => throw _privateConstructorUsedError; + Map? get onLongPress => throw _privateConstructorUsedError; + Map? get onMapCreated => throw _privateConstructorUsedError; + String? get cloudMapId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiGoogleMapCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiGoogleMapCopyWith<$Res> { + factory $MiraiGoogleMapCopyWith( + MiraiGoogleMap value, $Res Function(MiraiGoogleMap) then) = + _$MiraiGoogleMapCopyWithImpl<$Res, MiraiGoogleMap>; + @useResult + $Res call( + {MiraiCameraPosition initialCameraPosition, + String? style, + MiraiWebGestureHandling? webGestureHandling, + bool compassEnabled, + bool mapToolbarEnabled, + MiraiCameraTargetBounds? cameraTargetBounds, + MiraiGoogleMapType mapType, + MiraiMinMaxZoomPreference? minMaxZoomPreference, + bool rotateGesturesEnabled, + bool scrollGesturesEnabled, + bool zoomControlsEnabled, + bool zoomGesturesEnabled, + bool liteModeEnabled, + bool tiltGesturesEnabled, + bool fortyFiveDegreeImageryEnabled, + bool myLocationEnabled, + bool myLocationButtonEnabled, + String? layoutDirection, + MiraiEdgeInsets padding, + bool indoorViewEnabled, + bool trafficEnabled, + bool buildingsEnabled, + Set markers, + Set circles, + Set polygons, + Set polylines, + Set tileOverlays, + Map? onCameraMoveStarted, + Map? onCameraMove, + Map? onCameraIdle, + Map? onTap, + Map? onLongPress, + Map? onMapCreated, + String? cloudMapId}); + + $MiraiCameraPositionCopyWith<$Res> get initialCameraPosition; + $MiraiCameraTargetBoundsCopyWith<$Res>? get cameraTargetBounds; + $MiraiMinMaxZoomPreferenceCopyWith<$Res>? get minMaxZoomPreference; + $MiraiEdgeInsetsCopyWith<$Res> get padding; +} + +/// @nodoc +class _$MiraiGoogleMapCopyWithImpl<$Res, $Val extends MiraiGoogleMap> + implements $MiraiGoogleMapCopyWith<$Res> { + _$MiraiGoogleMapCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? initialCameraPosition = null, + Object? style = freezed, + Object? webGestureHandling = freezed, + Object? compassEnabled = null, + Object? mapToolbarEnabled = null, + Object? cameraTargetBounds = freezed, + Object? mapType = null, + Object? minMaxZoomPreference = freezed, + Object? rotateGesturesEnabled = null, + Object? scrollGesturesEnabled = null, + Object? zoomControlsEnabled = null, + Object? zoomGesturesEnabled = null, + Object? liteModeEnabled = null, + Object? tiltGesturesEnabled = null, + Object? fortyFiveDegreeImageryEnabled = null, + Object? myLocationEnabled = null, + Object? myLocationButtonEnabled = null, + Object? layoutDirection = freezed, + Object? padding = null, + Object? indoorViewEnabled = null, + Object? trafficEnabled = null, + Object? buildingsEnabled = null, + Object? markers = null, + Object? circles = null, + Object? polygons = null, + Object? polylines = null, + Object? tileOverlays = null, + Object? onCameraMoveStarted = freezed, + Object? onCameraMove = freezed, + Object? onCameraIdle = freezed, + Object? onTap = freezed, + Object? onLongPress = freezed, + Object? onMapCreated = freezed, + Object? cloudMapId = freezed, + }) { + return _then(_value.copyWith( + initialCameraPosition: null == initialCameraPosition + ? _value.initialCameraPosition + : initialCameraPosition // ignore: cast_nullable_to_non_nullable + as MiraiCameraPosition, + style: freezed == style + ? _value.style + : style // ignore: cast_nullable_to_non_nullable + as String?, + webGestureHandling: freezed == webGestureHandling + ? _value.webGestureHandling + : webGestureHandling // ignore: cast_nullable_to_non_nullable + as MiraiWebGestureHandling?, + compassEnabled: null == compassEnabled + ? _value.compassEnabled + : compassEnabled // ignore: cast_nullable_to_non_nullable + as bool, + mapToolbarEnabled: null == mapToolbarEnabled + ? _value.mapToolbarEnabled + : mapToolbarEnabled // ignore: cast_nullable_to_non_nullable + as bool, + cameraTargetBounds: freezed == cameraTargetBounds + ? _value.cameraTargetBounds + : cameraTargetBounds // ignore: cast_nullable_to_non_nullable + as MiraiCameraTargetBounds?, + mapType: null == mapType + ? _value.mapType + : mapType // ignore: cast_nullable_to_non_nullable + as MiraiGoogleMapType, + minMaxZoomPreference: freezed == minMaxZoomPreference + ? _value.minMaxZoomPreference + : minMaxZoomPreference // ignore: cast_nullable_to_non_nullable + as MiraiMinMaxZoomPreference?, + rotateGesturesEnabled: null == rotateGesturesEnabled + ? _value.rotateGesturesEnabled + : rotateGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + scrollGesturesEnabled: null == scrollGesturesEnabled + ? _value.scrollGesturesEnabled + : scrollGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + zoomControlsEnabled: null == zoomControlsEnabled + ? _value.zoomControlsEnabled + : zoomControlsEnabled // ignore: cast_nullable_to_non_nullable + as bool, + zoomGesturesEnabled: null == zoomGesturesEnabled + ? _value.zoomGesturesEnabled + : zoomGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + liteModeEnabled: null == liteModeEnabled + ? _value.liteModeEnabled + : liteModeEnabled // ignore: cast_nullable_to_non_nullable + as bool, + tiltGesturesEnabled: null == tiltGesturesEnabled + ? _value.tiltGesturesEnabled + : tiltGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + fortyFiveDegreeImageryEnabled: null == fortyFiveDegreeImageryEnabled + ? _value.fortyFiveDegreeImageryEnabled + : fortyFiveDegreeImageryEnabled // ignore: cast_nullable_to_non_nullable + as bool, + myLocationEnabled: null == myLocationEnabled + ? _value.myLocationEnabled + : myLocationEnabled // ignore: cast_nullable_to_non_nullable + as bool, + myLocationButtonEnabled: null == myLocationButtonEnabled + ? _value.myLocationButtonEnabled + : myLocationButtonEnabled // ignore: cast_nullable_to_non_nullable + as bool, + layoutDirection: freezed == layoutDirection + ? _value.layoutDirection + : layoutDirection // ignore: cast_nullable_to_non_nullable + as String?, + padding: null == padding + ? _value.padding + : padding // ignore: cast_nullable_to_non_nullable + as MiraiEdgeInsets, + indoorViewEnabled: null == indoorViewEnabled + ? _value.indoorViewEnabled + : indoorViewEnabled // ignore: cast_nullable_to_non_nullable + as bool, + trafficEnabled: null == trafficEnabled + ? _value.trafficEnabled + : trafficEnabled // ignore: cast_nullable_to_non_nullable + as bool, + buildingsEnabled: null == buildingsEnabled + ? _value.buildingsEnabled + : buildingsEnabled // ignore: cast_nullable_to_non_nullable + as bool, + markers: null == markers + ? _value.markers + : markers // ignore: cast_nullable_to_non_nullable + as Set, + circles: null == circles + ? _value.circles + : circles // ignore: cast_nullable_to_non_nullable + as Set, + polygons: null == polygons + ? _value.polygons + : polygons // ignore: cast_nullable_to_non_nullable + as Set, + polylines: null == polylines + ? _value.polylines + : polylines // ignore: cast_nullable_to_non_nullable + as Set, + tileOverlays: null == tileOverlays + ? _value.tileOverlays + : tileOverlays // ignore: cast_nullable_to_non_nullable + as Set, + onCameraMoveStarted: freezed == onCameraMoveStarted + ? _value.onCameraMoveStarted + : onCameraMoveStarted // ignore: cast_nullable_to_non_nullable + as Map?, + onCameraMove: freezed == onCameraMove + ? _value.onCameraMove + : onCameraMove // ignore: cast_nullable_to_non_nullable + as Map?, + onCameraIdle: freezed == onCameraIdle + ? _value.onCameraIdle + : onCameraIdle // ignore: cast_nullable_to_non_nullable + as Map?, + onTap: freezed == onTap + ? _value.onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + onLongPress: freezed == onLongPress + ? _value.onLongPress + : onLongPress // ignore: cast_nullable_to_non_nullable + as Map?, + onMapCreated: freezed == onMapCreated + ? _value.onMapCreated + : onMapCreated // ignore: cast_nullable_to_non_nullable + as Map?, + cloudMapId: freezed == cloudMapId + ? _value.cloudMapId + : cloudMapId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiCameraPositionCopyWith<$Res> get initialCameraPosition { + return $MiraiCameraPositionCopyWith<$Res>(_value.initialCameraPosition, + (value) { + return _then(_value.copyWith(initialCameraPosition: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiCameraTargetBoundsCopyWith<$Res>? get cameraTargetBounds { + if (_value.cameraTargetBounds == null) { + return null; + } + + return $MiraiCameraTargetBoundsCopyWith<$Res>(_value.cameraTargetBounds!, + (value) { + return _then(_value.copyWith(cameraTargetBounds: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiMinMaxZoomPreferenceCopyWith<$Res>? get minMaxZoomPreference { + if (_value.minMaxZoomPreference == null) { + return null; + } + + return $MiraiMinMaxZoomPreferenceCopyWith<$Res>( + _value.minMaxZoomPreference!, (value) { + return _then(_value.copyWith(minMaxZoomPreference: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiEdgeInsetsCopyWith<$Res> get padding { + return $MiraiEdgeInsetsCopyWith<$Res>(_value.padding, (value) { + return _then(_value.copyWith(padding: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiGoogleMapImplCopyWith<$Res> + implements $MiraiGoogleMapCopyWith<$Res> { + factory _$$MiraiGoogleMapImplCopyWith(_$MiraiGoogleMapImpl value, + $Res Function(_$MiraiGoogleMapImpl) then) = + __$$MiraiGoogleMapImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {MiraiCameraPosition initialCameraPosition, + String? style, + MiraiWebGestureHandling? webGestureHandling, + bool compassEnabled, + bool mapToolbarEnabled, + MiraiCameraTargetBounds? cameraTargetBounds, + MiraiGoogleMapType mapType, + MiraiMinMaxZoomPreference? minMaxZoomPreference, + bool rotateGesturesEnabled, + bool scrollGesturesEnabled, + bool zoomControlsEnabled, + bool zoomGesturesEnabled, + bool liteModeEnabled, + bool tiltGesturesEnabled, + bool fortyFiveDegreeImageryEnabled, + bool myLocationEnabled, + bool myLocationButtonEnabled, + String? layoutDirection, + MiraiEdgeInsets padding, + bool indoorViewEnabled, + bool trafficEnabled, + bool buildingsEnabled, + Set markers, + Set circles, + Set polygons, + Set polylines, + Set tileOverlays, + Map? onCameraMoveStarted, + Map? onCameraMove, + Map? onCameraIdle, + Map? onTap, + Map? onLongPress, + Map? onMapCreated, + String? cloudMapId}); + + @override + $MiraiCameraPositionCopyWith<$Res> get initialCameraPosition; + @override + $MiraiCameraTargetBoundsCopyWith<$Res>? get cameraTargetBounds; + @override + $MiraiMinMaxZoomPreferenceCopyWith<$Res>? get minMaxZoomPreference; + @override + $MiraiEdgeInsetsCopyWith<$Res> get padding; +} + +/// @nodoc +class __$$MiraiGoogleMapImplCopyWithImpl<$Res> + extends _$MiraiGoogleMapCopyWithImpl<$Res, _$MiraiGoogleMapImpl> + implements _$$MiraiGoogleMapImplCopyWith<$Res> { + __$$MiraiGoogleMapImplCopyWithImpl( + _$MiraiGoogleMapImpl _value, $Res Function(_$MiraiGoogleMapImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? initialCameraPosition = null, + Object? style = freezed, + Object? webGestureHandling = freezed, + Object? compassEnabled = null, + Object? mapToolbarEnabled = null, + Object? cameraTargetBounds = freezed, + Object? mapType = null, + Object? minMaxZoomPreference = freezed, + Object? rotateGesturesEnabled = null, + Object? scrollGesturesEnabled = null, + Object? zoomControlsEnabled = null, + Object? zoomGesturesEnabled = null, + Object? liteModeEnabled = null, + Object? tiltGesturesEnabled = null, + Object? fortyFiveDegreeImageryEnabled = null, + Object? myLocationEnabled = null, + Object? myLocationButtonEnabled = null, + Object? layoutDirection = freezed, + Object? padding = null, + Object? indoorViewEnabled = null, + Object? trafficEnabled = null, + Object? buildingsEnabled = null, + Object? markers = null, + Object? circles = null, + Object? polygons = null, + Object? polylines = null, + Object? tileOverlays = null, + Object? onCameraMoveStarted = freezed, + Object? onCameraMove = freezed, + Object? onCameraIdle = freezed, + Object? onTap = freezed, + Object? onLongPress = freezed, + Object? onMapCreated = freezed, + Object? cloudMapId = freezed, + }) { + return _then(_$MiraiGoogleMapImpl( + initialCameraPosition: null == initialCameraPosition + ? _value.initialCameraPosition + : initialCameraPosition // ignore: cast_nullable_to_non_nullable + as MiraiCameraPosition, + style: freezed == style + ? _value.style + : style // ignore: cast_nullable_to_non_nullable + as String?, + webGestureHandling: freezed == webGestureHandling + ? _value.webGestureHandling + : webGestureHandling // ignore: cast_nullable_to_non_nullable + as MiraiWebGestureHandling?, + compassEnabled: null == compassEnabled + ? _value.compassEnabled + : compassEnabled // ignore: cast_nullable_to_non_nullable + as bool, + mapToolbarEnabled: null == mapToolbarEnabled + ? _value.mapToolbarEnabled + : mapToolbarEnabled // ignore: cast_nullable_to_non_nullable + as bool, + cameraTargetBounds: freezed == cameraTargetBounds + ? _value.cameraTargetBounds + : cameraTargetBounds // ignore: cast_nullable_to_non_nullable + as MiraiCameraTargetBounds?, + mapType: null == mapType + ? _value.mapType + : mapType // ignore: cast_nullable_to_non_nullable + as MiraiGoogleMapType, + minMaxZoomPreference: freezed == minMaxZoomPreference + ? _value.minMaxZoomPreference + : minMaxZoomPreference // ignore: cast_nullable_to_non_nullable + as MiraiMinMaxZoomPreference?, + rotateGesturesEnabled: null == rotateGesturesEnabled + ? _value.rotateGesturesEnabled + : rotateGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + scrollGesturesEnabled: null == scrollGesturesEnabled + ? _value.scrollGesturesEnabled + : scrollGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + zoomControlsEnabled: null == zoomControlsEnabled + ? _value.zoomControlsEnabled + : zoomControlsEnabled // ignore: cast_nullable_to_non_nullable + as bool, + zoomGesturesEnabled: null == zoomGesturesEnabled + ? _value.zoomGesturesEnabled + : zoomGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + liteModeEnabled: null == liteModeEnabled + ? _value.liteModeEnabled + : liteModeEnabled // ignore: cast_nullable_to_non_nullable + as bool, + tiltGesturesEnabled: null == tiltGesturesEnabled + ? _value.tiltGesturesEnabled + : tiltGesturesEnabled // ignore: cast_nullable_to_non_nullable + as bool, + fortyFiveDegreeImageryEnabled: null == fortyFiveDegreeImageryEnabled + ? _value.fortyFiveDegreeImageryEnabled + : fortyFiveDegreeImageryEnabled // ignore: cast_nullable_to_non_nullable + as bool, + myLocationEnabled: null == myLocationEnabled + ? _value.myLocationEnabled + : myLocationEnabled // ignore: cast_nullable_to_non_nullable + as bool, + myLocationButtonEnabled: null == myLocationButtonEnabled + ? _value.myLocationButtonEnabled + : myLocationButtonEnabled // ignore: cast_nullable_to_non_nullable + as bool, + layoutDirection: freezed == layoutDirection + ? _value.layoutDirection + : layoutDirection // ignore: cast_nullable_to_non_nullable + as String?, + padding: null == padding + ? _value.padding + : padding // ignore: cast_nullable_to_non_nullable + as MiraiEdgeInsets, + indoorViewEnabled: null == indoorViewEnabled + ? _value.indoorViewEnabled + : indoorViewEnabled // ignore: cast_nullable_to_non_nullable + as bool, + trafficEnabled: null == trafficEnabled + ? _value.trafficEnabled + : trafficEnabled // ignore: cast_nullable_to_non_nullable + as bool, + buildingsEnabled: null == buildingsEnabled + ? _value.buildingsEnabled + : buildingsEnabled // ignore: cast_nullable_to_non_nullable + as bool, + markers: null == markers + ? _value._markers + : markers // ignore: cast_nullable_to_non_nullable + as Set, + circles: null == circles + ? _value._circles + : circles // ignore: cast_nullable_to_non_nullable + as Set, + polygons: null == polygons + ? _value._polygons + : polygons // ignore: cast_nullable_to_non_nullable + as Set, + polylines: null == polylines + ? _value._polylines + : polylines // ignore: cast_nullable_to_non_nullable + as Set, + tileOverlays: null == tileOverlays + ? _value._tileOverlays + : tileOverlays // ignore: cast_nullable_to_non_nullable + as Set, + onCameraMoveStarted: freezed == onCameraMoveStarted + ? _value._onCameraMoveStarted + : onCameraMoveStarted // ignore: cast_nullable_to_non_nullable + as Map?, + onCameraMove: freezed == onCameraMove + ? _value._onCameraMove + : onCameraMove // ignore: cast_nullable_to_non_nullable + as Map?, + onCameraIdle: freezed == onCameraIdle + ? _value._onCameraIdle + : onCameraIdle // ignore: cast_nullable_to_non_nullable + as Map?, + onTap: freezed == onTap + ? _value._onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + onLongPress: freezed == onLongPress + ? _value._onLongPress + : onLongPress // ignore: cast_nullable_to_non_nullable + as Map?, + onMapCreated: freezed == onMapCreated + ? _value._onMapCreated + : onMapCreated // ignore: cast_nullable_to_non_nullable + as Map?, + cloudMapId: freezed == cloudMapId + ? _value.cloudMapId + : cloudMapId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiGoogleMapImpl + with DiagnosticableTreeMixin + implements _MiraiGoogleMap { + const _$MiraiGoogleMapImpl( + {required this.initialCameraPosition, + this.style, + this.webGestureHandling, + this.compassEnabled = true, + this.mapToolbarEnabled = true, + this.cameraTargetBounds, + this.mapType = MiraiGoogleMapType.normal, + this.minMaxZoomPreference, + this.rotateGesturesEnabled = true, + this.scrollGesturesEnabled = true, + this.zoomControlsEnabled = true, + this.zoomGesturesEnabled = true, + this.liteModeEnabled = false, + this.tiltGesturesEnabled = true, + this.fortyFiveDegreeImageryEnabled = false, + this.myLocationEnabled = true, + required this.myLocationButtonEnabled, + this.layoutDirection, + this.padding = MiraiEdgeInsets.zero, + required this.indoorViewEnabled, + required this.trafficEnabled, + required this.buildingsEnabled, + final Set markers = const {}, + final Set circles = const {}, + final Set polygons = const {}, + final Set polylines = const {}, + final Set tileOverlays = const {}, + final Map? onCameraMoveStarted, + final Map? onCameraMove, + final Map? onCameraIdle, + final Map? onTap, + final Map? onLongPress, + final Map? onMapCreated, + this.cloudMapId}) + : _markers = markers, + _circles = circles, + _polygons = polygons, + _polylines = polylines, + _tileOverlays = tileOverlays, + _onCameraMoveStarted = onCameraMoveStarted, + _onCameraMove = onCameraMove, + _onCameraIdle = onCameraIdle, + _onTap = onTap, + _onLongPress = onLongPress, + _onMapCreated = onMapCreated; + + factory _$MiraiGoogleMapImpl.fromJson(Map json) => + _$$MiraiGoogleMapImplFromJson(json); + +// super.key, + @override + final MiraiCameraPosition initialCameraPosition; + @override + final String? style; +// required Set> gestureRecognizers, + @override + final MiraiWebGestureHandling? webGestureHandling; + @override + @JsonKey() + final bool compassEnabled; + @override + @JsonKey() + final bool mapToolbarEnabled; + @override + final MiraiCameraTargetBounds? cameraTargetBounds; + @override + @JsonKey() + final MiraiGoogleMapType mapType; + @override + final MiraiMinMaxZoomPreference? minMaxZoomPreference; + @override + @JsonKey() + final bool rotateGesturesEnabled; + @override + @JsonKey() + final bool scrollGesturesEnabled; + @override + @JsonKey() + final bool zoomControlsEnabled; + @override + @JsonKey() + final bool zoomGesturesEnabled; + @override + @JsonKey() + final bool liteModeEnabled; + @override + @JsonKey() + final bool tiltGesturesEnabled; + @override + @JsonKey() + final bool fortyFiveDegreeImageryEnabled; + @override + @JsonKey() + final bool myLocationEnabled; + @override + final bool myLocationButtonEnabled; + @override + final String? layoutDirection; + + /// If no padding is specified default padding will be 0. + @override + @JsonKey() + final MiraiEdgeInsets padding; + @override + final bool indoorViewEnabled; + @override + final bool trafficEnabled; + @override + final bool buildingsEnabled; + final Set _markers; + @override + @JsonKey() + Set get markers { + if (_markers is EqualUnmodifiableSetView) return _markers; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_markers); + } + + final Set _circles; + @override + @JsonKey() + Set get circles { + if (_circles is EqualUnmodifiableSetView) return _circles; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_circles); + } + + final Set _polygons; + @override + @JsonKey() + Set get polygons { + if (_polygons is EqualUnmodifiableSetView) return _polygons; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_polygons); + } + + final Set _polylines; + @override + @JsonKey() + Set get polylines { + if (_polylines is EqualUnmodifiableSetView) return _polylines; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_polylines); + } + + final Set _tileOverlays; + @override + @JsonKey() + Set get tileOverlays { + if (_tileOverlays is EqualUnmodifiableSetView) return _tileOverlays; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_tileOverlays); + } + + final Map? _onCameraMoveStarted; + @override + Map? get onCameraMoveStarted { + final value = _onCameraMoveStarted; + if (value == null) return null; + if (_onCameraMoveStarted is EqualUnmodifiableMapView) + return _onCameraMoveStarted; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onCameraMove; + @override + Map? get onCameraMove { + final value = _onCameraMove; + if (value == null) return null; + if (_onCameraMove is EqualUnmodifiableMapView) return _onCameraMove; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onCameraIdle; + @override + Map? get onCameraIdle { + final value = _onCameraIdle; + if (value == null) return null; + if (_onCameraIdle is EqualUnmodifiableMapView) return _onCameraIdle; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onTap; + @override + Map? get onTap { + final value = _onTap; + if (value == null) return null; + if (_onTap is EqualUnmodifiableMapView) return _onTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onLongPress; + @override + Map? get onLongPress { + final value = _onLongPress; + if (value == null) return null; + if (_onLongPress is EqualUnmodifiableMapView) return _onLongPress; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onMapCreated; + @override + Map? get onMapCreated { + final value = _onMapCreated; + if (value == null) return null; + if (_onMapCreated is EqualUnmodifiableMapView) return _onMapCreated; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + final String? cloudMapId; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'MiraiGoogleMap(initialCameraPosition: $initialCameraPosition, style: $style, webGestureHandling: $webGestureHandling, compassEnabled: $compassEnabled, mapToolbarEnabled: $mapToolbarEnabled, cameraTargetBounds: $cameraTargetBounds, mapType: $mapType, minMaxZoomPreference: $minMaxZoomPreference, rotateGesturesEnabled: $rotateGesturesEnabled, scrollGesturesEnabled: $scrollGesturesEnabled, zoomControlsEnabled: $zoomControlsEnabled, zoomGesturesEnabled: $zoomGesturesEnabled, liteModeEnabled: $liteModeEnabled, tiltGesturesEnabled: $tiltGesturesEnabled, fortyFiveDegreeImageryEnabled: $fortyFiveDegreeImageryEnabled, myLocationEnabled: $myLocationEnabled, myLocationButtonEnabled: $myLocationButtonEnabled, layoutDirection: $layoutDirection, padding: $padding, indoorViewEnabled: $indoorViewEnabled, trafficEnabled: $trafficEnabled, buildingsEnabled: $buildingsEnabled, markers: $markers, circles: $circles, polygons: $polygons, polylines: $polylines, tileOverlays: $tileOverlays, onCameraMoveStarted: $onCameraMoveStarted, onCameraMove: $onCameraMove, onCameraIdle: $onCameraIdle, onTap: $onTap, onLongPress: $onLongPress, onMapCreated: $onMapCreated, cloudMapId: $cloudMapId)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'MiraiGoogleMap')) + ..add(DiagnosticsProperty('initialCameraPosition', initialCameraPosition)) + ..add(DiagnosticsProperty('style', style)) + ..add(DiagnosticsProperty('webGestureHandling', webGestureHandling)) + ..add(DiagnosticsProperty('compassEnabled', compassEnabled)) + ..add(DiagnosticsProperty('mapToolbarEnabled', mapToolbarEnabled)) + ..add(DiagnosticsProperty('cameraTargetBounds', cameraTargetBounds)) + ..add(DiagnosticsProperty('mapType', mapType)) + ..add(DiagnosticsProperty('minMaxZoomPreference', minMaxZoomPreference)) + ..add(DiagnosticsProperty('rotateGesturesEnabled', rotateGesturesEnabled)) + ..add(DiagnosticsProperty('scrollGesturesEnabled', scrollGesturesEnabled)) + ..add(DiagnosticsProperty('zoomControlsEnabled', zoomControlsEnabled)) + ..add(DiagnosticsProperty('zoomGesturesEnabled', zoomGesturesEnabled)) + ..add(DiagnosticsProperty('liteModeEnabled', liteModeEnabled)) + ..add(DiagnosticsProperty('tiltGesturesEnabled', tiltGesturesEnabled)) + ..add(DiagnosticsProperty( + 'fortyFiveDegreeImageryEnabled', fortyFiveDegreeImageryEnabled)) + ..add(DiagnosticsProperty('myLocationEnabled', myLocationEnabled)) + ..add(DiagnosticsProperty( + 'myLocationButtonEnabled', myLocationButtonEnabled)) + ..add(DiagnosticsProperty('layoutDirection', layoutDirection)) + ..add(DiagnosticsProperty('padding', padding)) + ..add(DiagnosticsProperty('indoorViewEnabled', indoorViewEnabled)) + ..add(DiagnosticsProperty('trafficEnabled', trafficEnabled)) + ..add(DiagnosticsProperty('buildingsEnabled', buildingsEnabled)) + ..add(DiagnosticsProperty('markers', markers)) + ..add(DiagnosticsProperty('circles', circles)) + ..add(DiagnosticsProperty('polygons', polygons)) + ..add(DiagnosticsProperty('polylines', polylines)) + ..add(DiagnosticsProperty('tileOverlays', tileOverlays)) + ..add(DiagnosticsProperty('onCameraMoveStarted', onCameraMoveStarted)) + ..add(DiagnosticsProperty('onCameraMove', onCameraMove)) + ..add(DiagnosticsProperty('onCameraIdle', onCameraIdle)) + ..add(DiagnosticsProperty('onTap', onTap)) + ..add(DiagnosticsProperty('onLongPress', onLongPress)) + ..add(DiagnosticsProperty('onMapCreated', onMapCreated)) + ..add(DiagnosticsProperty('cloudMapId', cloudMapId)); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiGoogleMapImpl && + (identical(other.initialCameraPosition, initialCameraPosition) || + other.initialCameraPosition == initialCameraPosition) && + (identical(other.style, style) || other.style == style) && + (identical(other.webGestureHandling, webGestureHandling) || + other.webGestureHandling == webGestureHandling) && + (identical(other.compassEnabled, compassEnabled) || + other.compassEnabled == compassEnabled) && + (identical(other.mapToolbarEnabled, mapToolbarEnabled) || + other.mapToolbarEnabled == mapToolbarEnabled) && + (identical(other.cameraTargetBounds, cameraTargetBounds) || + other.cameraTargetBounds == cameraTargetBounds) && + (identical(other.mapType, mapType) || other.mapType == mapType) && + (identical(other.minMaxZoomPreference, minMaxZoomPreference) || + other.minMaxZoomPreference == minMaxZoomPreference) && + (identical(other.rotateGesturesEnabled, rotateGesturesEnabled) || + other.rotateGesturesEnabled == rotateGesturesEnabled) && + (identical(other.scrollGesturesEnabled, scrollGesturesEnabled) || + other.scrollGesturesEnabled == scrollGesturesEnabled) && + (identical(other.zoomControlsEnabled, zoomControlsEnabled) || + other.zoomControlsEnabled == zoomControlsEnabled) && + (identical(other.zoomGesturesEnabled, zoomGesturesEnabled) || + other.zoomGesturesEnabled == zoomGesturesEnabled) && + (identical(other.liteModeEnabled, liteModeEnabled) || + other.liteModeEnabled == liteModeEnabled) && + (identical(other.tiltGesturesEnabled, tiltGesturesEnabled) || + other.tiltGesturesEnabled == tiltGesturesEnabled) && + (identical(other.fortyFiveDegreeImageryEnabled, + fortyFiveDegreeImageryEnabled) || + other.fortyFiveDegreeImageryEnabled == + fortyFiveDegreeImageryEnabled) && + (identical(other.myLocationEnabled, myLocationEnabled) || + other.myLocationEnabled == myLocationEnabled) && + (identical( + other.myLocationButtonEnabled, myLocationButtonEnabled) || + other.myLocationButtonEnabled == myLocationButtonEnabled) && + (identical(other.layoutDirection, layoutDirection) || + other.layoutDirection == layoutDirection) && + (identical(other.padding, padding) || other.padding == padding) && + (identical(other.indoorViewEnabled, indoorViewEnabled) || + other.indoorViewEnabled == indoorViewEnabled) && + (identical(other.trafficEnabled, trafficEnabled) || + other.trafficEnabled == trafficEnabled) && + (identical(other.buildingsEnabled, buildingsEnabled) || + other.buildingsEnabled == buildingsEnabled) && + const DeepCollectionEquality().equals(other._markers, _markers) && + const DeepCollectionEquality().equals(other._circles, _circles) && + const DeepCollectionEquality().equals(other._polygons, _polygons) && + const DeepCollectionEquality() + .equals(other._polylines, _polylines) && + const DeepCollectionEquality() + .equals(other._tileOverlays, _tileOverlays) && + const DeepCollectionEquality() + .equals(other._onCameraMoveStarted, _onCameraMoveStarted) && + const DeepCollectionEquality() + .equals(other._onCameraMove, _onCameraMove) && + const DeepCollectionEquality() + .equals(other._onCameraIdle, _onCameraIdle) && + const DeepCollectionEquality().equals(other._onTap, _onTap) && + const DeepCollectionEquality() + .equals(other._onLongPress, _onLongPress) && + const DeepCollectionEquality() + .equals(other._onMapCreated, _onMapCreated) && + (identical(other.cloudMapId, cloudMapId) || + other.cloudMapId == cloudMapId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hashAll([ + runtimeType, + initialCameraPosition, + style, + webGestureHandling, + compassEnabled, + mapToolbarEnabled, + cameraTargetBounds, + mapType, + minMaxZoomPreference, + rotateGesturesEnabled, + scrollGesturesEnabled, + zoomControlsEnabled, + zoomGesturesEnabled, + liteModeEnabled, + tiltGesturesEnabled, + fortyFiveDegreeImageryEnabled, + myLocationEnabled, + myLocationButtonEnabled, + layoutDirection, + padding, + indoorViewEnabled, + trafficEnabled, + buildingsEnabled, + const DeepCollectionEquality().hash(_markers), + const DeepCollectionEquality().hash(_circles), + const DeepCollectionEquality().hash(_polygons), + const DeepCollectionEquality().hash(_polylines), + const DeepCollectionEquality().hash(_tileOverlays), + const DeepCollectionEquality().hash(_onCameraMoveStarted), + const DeepCollectionEquality().hash(_onCameraMove), + const DeepCollectionEquality().hash(_onCameraIdle), + const DeepCollectionEquality().hash(_onTap), + const DeepCollectionEquality().hash(_onLongPress), + const DeepCollectionEquality().hash(_onMapCreated), + cloudMapId + ]); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiGoogleMapImplCopyWith<_$MiraiGoogleMapImpl> get copyWith => + __$$MiraiGoogleMapImplCopyWithImpl<_$MiraiGoogleMapImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiGoogleMapImplToJson( + this, + ); + } +} + +abstract class _MiraiGoogleMap implements MiraiGoogleMap { + const factory _MiraiGoogleMap( + {required final MiraiCameraPosition initialCameraPosition, + final String? style, + final MiraiWebGestureHandling? webGestureHandling, + final bool compassEnabled, + final bool mapToolbarEnabled, + final MiraiCameraTargetBounds? cameraTargetBounds, + final MiraiGoogleMapType mapType, + final MiraiMinMaxZoomPreference? minMaxZoomPreference, + final bool rotateGesturesEnabled, + final bool scrollGesturesEnabled, + final bool zoomControlsEnabled, + final bool zoomGesturesEnabled, + final bool liteModeEnabled, + final bool tiltGesturesEnabled, + final bool fortyFiveDegreeImageryEnabled, + final bool myLocationEnabled, + required final bool myLocationButtonEnabled, + final String? layoutDirection, + final MiraiEdgeInsets padding, + required final bool indoorViewEnabled, + required final bool trafficEnabled, + required final bool buildingsEnabled, + final Set markers, + final Set circles, + final Set polygons, + final Set polylines, + final Set tileOverlays, + final Map? onCameraMoveStarted, + final Map? onCameraMove, + final Map? onCameraIdle, + final Map? onTap, + final Map? onLongPress, + final Map? onMapCreated, + final String? cloudMapId}) = _$MiraiGoogleMapImpl; + + factory _MiraiGoogleMap.fromJson(Map json) = + _$MiraiGoogleMapImpl.fromJson; + + @override // super.key, + MiraiCameraPosition get initialCameraPosition; + @override + String? get style; + @override // required Set> gestureRecognizers, + MiraiWebGestureHandling? get webGestureHandling; + @override + bool get compassEnabled; + @override + bool get mapToolbarEnabled; + @override + MiraiCameraTargetBounds? get cameraTargetBounds; + @override + MiraiGoogleMapType get mapType; + @override + MiraiMinMaxZoomPreference? get minMaxZoomPreference; + @override + bool get rotateGesturesEnabled; + @override + bool get scrollGesturesEnabled; + @override + bool get zoomControlsEnabled; + @override + bool get zoomGesturesEnabled; + @override + bool get liteModeEnabled; + @override + bool get tiltGesturesEnabled; + @override + bool get fortyFiveDegreeImageryEnabled; + @override + bool get myLocationEnabled; + @override + bool get myLocationButtonEnabled; + @override + String? get layoutDirection; + @override + + /// If no padding is specified default padding will be 0. + MiraiEdgeInsets get padding; + @override + bool get indoorViewEnabled; + @override + bool get trafficEnabled; + @override + bool get buildingsEnabled; + @override + Set get markers; + @override + Set get circles; + @override + Set get polygons; + @override + Set get polylines; + @override + Set get tileOverlays; + @override + Map? get onCameraMoveStarted; + @override + Map? get onCameraMove; + @override + Map? get onCameraIdle; + @override + Map? get onTap; + @override + Map? get onLongPress; + @override + Map? get onMapCreated; + @override + String? get cloudMapId; + @override + @JsonKey(ignore: true) + _$$MiraiGoogleMapImplCopyWith<_$MiraiGoogleMapImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.g.dart new file mode 100644 index 00000000..3f889e6c --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map.g.dart @@ -0,0 +1,128 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiGoogleMapImpl _$$MiraiGoogleMapImplFromJson(Map json) => + _$MiraiGoogleMapImpl( + initialCameraPosition: MiraiCameraPosition.fromJson( + json['initialCameraPosition'] as Map), + style: json['style'] as String?, + webGestureHandling: $enumDecodeNullable( + _$MiraiWebGestureHandlingEnumMap, json['webGestureHandling']), + compassEnabled: json['compassEnabled'] as bool? ?? true, + mapToolbarEnabled: json['mapToolbarEnabled'] as bool? ?? true, + cameraTargetBounds: json['cameraTargetBounds'] == null + ? null + : MiraiCameraTargetBounds.fromJson( + json['cameraTargetBounds'] as Map), + mapType: + $enumDecodeNullable(_$MiraiGoogleMapTypeEnumMap, json['mapType']) ?? + MiraiGoogleMapType.normal, + minMaxZoomPreference: json['minMaxZoomPreference'] == null + ? null + : MiraiMinMaxZoomPreference.fromJson( + json['minMaxZoomPreference'] as Map), + rotateGesturesEnabled: json['rotateGesturesEnabled'] as bool? ?? true, + scrollGesturesEnabled: json['scrollGesturesEnabled'] as bool? ?? true, + zoomControlsEnabled: json['zoomControlsEnabled'] as bool? ?? true, + zoomGesturesEnabled: json['zoomGesturesEnabled'] as bool? ?? true, + liteModeEnabled: json['liteModeEnabled'] as bool? ?? false, + tiltGesturesEnabled: json['tiltGesturesEnabled'] as bool? ?? true, + fortyFiveDegreeImageryEnabled: + json['fortyFiveDegreeImageryEnabled'] as bool? ?? false, + myLocationEnabled: json['myLocationEnabled'] as bool? ?? true, + myLocationButtonEnabled: json['myLocationButtonEnabled'] as bool, + layoutDirection: json['layoutDirection'] as String?, + padding: json['padding'] == null + ? MiraiEdgeInsets.zero + : MiraiEdgeInsets.fromJson(json['padding']), + indoorViewEnabled: json['indoorViewEnabled'] as bool, + trafficEnabled: json['trafficEnabled'] as bool, + buildingsEnabled: json['buildingsEnabled'] as bool, + markers: (json['markers'] as List?) + ?.map((e) => MiraiMarker.fromJson(e as Map)) + .toSet() ?? + const {}, + circles: (json['circles'] as List?) + ?.map((e) => MiraiCircle.fromJson(e as Map)) + .toSet() ?? + const {}, + polygons: (json['polygons'] as List?) + ?.map((e) => MiraiPolygon.fromJson(e as Map)) + .toSet() ?? + const {}, + polylines: (json['polylines'] as List?) + ?.map((e) => MiraiPolyline.fromJson(e as Map)) + .toSet() ?? + const {}, + tileOverlays: (json['tileOverlays'] as List?) + ?.map((e) => MiraiTileOverlay.fromJson(e as Map)) + .toSet() ?? + const {}, + onCameraMoveStarted: json['onCameraMoveStarted'] as Map?, + onCameraMove: json['onCameraMove'] as Map?, + onCameraIdle: json['onCameraIdle'] as Map?, + onTap: json['onTap'] as Map?, + onLongPress: json['onLongPress'] as Map?, + onMapCreated: json['onMapCreated'] as Map?, + cloudMapId: json['cloudMapId'] as String?, + ); + +Map _$$MiraiGoogleMapImplToJson( + _$MiraiGoogleMapImpl instance) => + { + 'initialCameraPosition': instance.initialCameraPosition, + 'style': instance.style, + 'webGestureHandling': + _$MiraiWebGestureHandlingEnumMap[instance.webGestureHandling], + 'compassEnabled': instance.compassEnabled, + 'mapToolbarEnabled': instance.mapToolbarEnabled, + 'cameraTargetBounds': instance.cameraTargetBounds, + 'mapType': _$MiraiGoogleMapTypeEnumMap[instance.mapType]!, + 'minMaxZoomPreference': instance.minMaxZoomPreference, + 'rotateGesturesEnabled': instance.rotateGesturesEnabled, + 'scrollGesturesEnabled': instance.scrollGesturesEnabled, + 'zoomControlsEnabled': instance.zoomControlsEnabled, + 'zoomGesturesEnabled': instance.zoomGesturesEnabled, + 'liteModeEnabled': instance.liteModeEnabled, + 'tiltGesturesEnabled': instance.tiltGesturesEnabled, + 'fortyFiveDegreeImageryEnabled': instance.fortyFiveDegreeImageryEnabled, + 'myLocationEnabled': instance.myLocationEnabled, + 'myLocationButtonEnabled': instance.myLocationButtonEnabled, + 'layoutDirection': instance.layoutDirection, + 'padding': instance.padding, + 'indoorViewEnabled': instance.indoorViewEnabled, + 'trafficEnabled': instance.trafficEnabled, + 'buildingsEnabled': instance.buildingsEnabled, + 'markers': instance.markers.toList(), + 'circles': instance.circles.toList(), + 'polygons': instance.polygons.toList(), + 'polylines': instance.polylines.toList(), + 'tileOverlays': instance.tileOverlays.toList(), + 'onCameraMoveStarted': instance.onCameraMoveStarted, + 'onCameraMove': instance.onCameraMove, + 'onCameraIdle': instance.onCameraIdle, + 'onTap': instance.onTap, + 'onLongPress': instance.onLongPress, + 'onMapCreated': instance.onMapCreated, + 'cloudMapId': instance.cloudMapId, + }; + +const _$MiraiWebGestureHandlingEnumMap = { + MiraiWebGestureHandling.cooperative: 'cooperative', + MiraiWebGestureHandling.greedy: 'greedy', + MiraiWebGestureHandling.none: 'none', + MiraiWebGestureHandling.auto: 'auto', +}; + +const _$MiraiGoogleMapTypeEnumMap = { + MiraiGoogleMapType.none: 'none', + MiraiGoogleMapType.normal: 'normal', + MiraiGoogleMapType.satellite: 'satellite', + MiraiGoogleMapType.terrain: 'terrain', + MiraiGoogleMapType.hybrid: 'hybrid', +}; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_parser.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_parser.dart new file mode 100644 index 00000000..90d09a45 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_parser.dart @@ -0,0 +1,126 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:mirai/src/parsers/mirai_edge_insets/mirai_edge_insets.dart'; +import 'package:mirai/src/utils/widget_type.dart'; +import 'package:mirai_framework/mirai_framework.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +import 'mirai_google_map.dart'; + +class MiraiGoogleMapParser extends MiraiParser { + const MiraiGoogleMapParser(); + + static final mapWidgetKey = GlobalKey(); + + @override + String get type => WidgetType.googleMap.name; + + @override + MiraiGoogleMap getModel(Map json) => MiraiGoogleMap.fromJson(json); + + @override + Widget parse(BuildContext context, MiraiGoogleMap model) { + return _GoogleMapWidget( + key: mapWidgetKey, + model: model, + ); + } +} + +class _GoogleMapWidget extends StatefulWidget { + const _GoogleMapWidget({super.key, required this.model}); + + final MiraiGoogleMap model; + + @override + State<_GoogleMapWidget> createState() => __GoogleMapWidgetState(); +} + +class __GoogleMapWidgetState extends State<_GoogleMapWidget> { + GoogleMapController? _googleMapController; + late MiraiGoogleMap model = widget.model; + + @override + void initState() { + super.initState(); + } + +@override + void didUpdateWidget(covariant _GoogleMapWidget oldWidget) { + super.didUpdateWidget(oldWidget); + if(widget.model != model){ + setState(() => model = widget.model); + } + } + + @override + Widget build(BuildContext context) { + final model = widget.model; + return GoogleMap( + initialCameraPosition: model.initialCameraPosition.parse, + style: model.style, + webGestureHandling: model.webGestureHandling?.value, + compassEnabled: model.compassEnabled, + mapToolbarEnabled: model.mapToolbarEnabled, + cameraTargetBounds: model.cameraTargetBounds?.parse ?? CameraTargetBounds.unbounded, + mapType: model.mapType.value, + minMaxZoomPreference: model.minMaxZoomPreference?.parse ?? MinMaxZoomPreference.unbounded, + rotateGesturesEnabled: model.rotateGesturesEnabled, + scrollGesturesEnabled: model.scrollGesturesEnabled, + zoomControlsEnabled: model.zoomControlsEnabled, + zoomGesturesEnabled: model.zoomGesturesEnabled, + liteModeEnabled: model.liteModeEnabled, + tiltGesturesEnabled: model.tiltGesturesEnabled, + fortyFiveDegreeImageryEnabled: model.fortyFiveDegreeImageryEnabled, + myLocationEnabled: model.myLocationEnabled, + myLocationButtonEnabled: model.myLocationButtonEnabled, + layoutDirection: model.layoutDirection == "rtl" ? TextDirection.rtl : TextDirection.ltr, + + // If no padding is specified default padding will be 0. + padding: model.padding.parse, + indoorViewEnabled: model.indoorViewEnabled, + trafficEnabled: model.trafficEnabled, + buildingsEnabled: model.buildingsEnabled, + markers: model.markers + .map((e) => e.parse( + onTap: () {}, + onDrag: (value) {}, + onDragStart: (value) {}, + onDragEnd: (value) {}, + )) + .toSet(), + circles: model.circles + .map((e) => e.parse( + context, + onTap: () {}, + )) + .toSet(), + polygons: model.polygons + .map((e) => e.parse( + context, + onTap: () {}, + )) + .toSet(), + polylines: model.polylines + .map((e) => e.parse( + context, + onTap: () {}, + )) + .toSet(), + tileOverlays: model.tileOverlays.map((e) => e.parse).toSet(), + onCameraMoveStarted: + model.onCameraMoveStarted == null ? null : () => model.onCameraMoveStarted, + onCameraMove: model.onCameraMove == null ? null : (_) => model.onCameraMove, + onCameraIdle: model.onCameraIdle == null ? null : () => model.onCameraIdle, + onLongPress: model.onLongPress == null ? null : (_) => model.onLongPress, + onTap: model.onTap == null ? null : (_) => model.onTap, + onMapCreated: (controller) { + _googleMapController = controller; + }, + cloudMapId: model.cloudMapId, + ); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.dart new file mode 100644 index 00000000..c0b12193 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.dart @@ -0,0 +1,148 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'mirai_google_map_ui.dart'; + +part 'mirai_google_map_camera.freezed.dart'; +part 'mirai_google_map_camera.g.dart'; + +@freezed +class MiraiCameraPosition with _$MiraiCameraPosition { + const factory MiraiCameraPosition({ + @Default(0.0) double bearing, + required MiraiLatLng target, + @Default(0.0) double tilt, + @Default(0.0) double zoom, + }) = _MiraiCameraPosition; + + factory MiraiCameraPosition.fromJson(Map json) => + _$MiraiCameraPositionFromJson(json); +} + +extension MiraiCameraPositionParser on MiraiCameraPosition { + CameraPosition get parse { + return CameraPosition( + target: target.parse, + bearing: bearing, + tilt: tilt, + zoom: zoom, + ); + } +} + + + +// @freezed +// class MiraiCameraUpdate with _$MiraiCameraUpdate { +// const MiraiCameraUpdate._(); + +// const factory MiraiCameraUpdate(Object _json) = MiraiCameraUpdate; + +// /// Returns a camera update that moves the camera to the specified position. +// static MiraiCameraUpdate newCameraPosition(MiraiCameraPosition cameraPosition) { +// return MiraiCameraUpdate( +// ['newCameraPosition', cameraPosition.toJson()], +// ); +// } + +// static MiraiCameraUpdate newLatLng(MiraiLatLng latLng) { +// return MiraiCameraUpdate._(['newLatLng', latLng.toJson()]); +// } + +// static MiraiCameraUpdate newLatLngBounds(MiraiLatLngBounds bounds, double padding) { +// return MiraiCameraUpdate._([ +// 'newLatLngBounds', +// bounds.toJson(), +// padding, +// ]); +// } +// } + +// class CameraUpdate { +// const CameraUpdate._(this._json); + +// /// Returns a camera update that moves the camera to the specified position. +// static CameraUpdate newCameraPosition(CameraPosition cameraPosition) { +// return CameraUpdate._( +// ['newCameraPosition', cameraPosition.toMap()], +// ); +// } + +// /// Returns a camera update that moves the camera target to the specified +// /// geographical location. +// static CameraUpdate newLatLng(LatLng latLng) { +// return CameraUpdate._(['newLatLng', latLng.toJson()]); +// } + +// /// Returns a camera update that transforms the camera so that the specified +// /// geographical bounding box is centered in the map view at the greatest +// /// possible zoom level. A non-zero [padding] insets the bounding box from the +// /// map view's edges. The camera's new tilt and bearing will both be 0.0. +// static CameraUpdate newLatLngBounds(LatLngBounds bounds, double padding) { +// return CameraUpdate._([ +// 'newLatLngBounds', +// bounds.toJson(), +// padding, +// ]); +// } + +// /// Returns a camera update that moves the camera target to the specified +// /// geographical location and zoom level. +// static CameraUpdate newLatLngZoom(LatLng latLng, double zoom) { +// return CameraUpdate._( +// ['newLatLngZoom', latLng.toJson(), zoom], +// ); +// } + +// /// Returns a camera update that moves the camera target the specified screen +// /// distance. +// /// +// /// For a camera with bearing 0.0 (pointing north), scrolling by 50,75 moves +// /// the camera's target to a geographical location that is 50 to the east and +// /// 75 to the south of the current location, measured in screen coordinates. +// static CameraUpdate scrollBy(double dx, double dy) { +// return CameraUpdate._( +// ['scrollBy', dx, dy], +// ); +// } + +// /// Returns a camera update that modifies the camera zoom level by the +// /// specified amount. The optional [focus] is a screen point whose underlying +// /// geographical location should be invariant, if possible, by the movement. +// static CameraUpdate zoomBy(double amount, [Offset? focus]) { +// if (focus == null) { +// return CameraUpdate._(['zoomBy', amount]); +// } else { +// return CameraUpdate._([ +// 'zoomBy', +// amount, +// [focus.dx, focus.dy], +// ]); +// } +// } + +// /// Returns a camera update that zooms the camera in, bringing the camera +// /// closer to the surface of the Earth. +// /// +// /// Equivalent to the result of calling `zoomBy(1.0)`. +// static CameraUpdate zoomIn() { +// return const CameraUpdate._(['zoomIn']); +// } + +// /// Returns a camera update that zooms the camera out, bringing the camera +// /// further away from the surface of the Earth. +// /// +// /// Equivalent to the result of calling `zoomBy(-1.0)`. +// static CameraUpdate zoomOut() { +// return const CameraUpdate._(['zoomOut']); +// } + +// /// Returns a camera update that sets the camera zoom level. +// static CameraUpdate zoomTo(double zoom) { +// return CameraUpdate._(['zoomTo', zoom]); +// } + +// final Object _json; + +// /// Converts this object to something serializable in JSON. +// Object toJson() => _json; +// } diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.freezed.dart new file mode 100644 index 00000000..15799ab7 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.freezed.dart @@ -0,0 +1,224 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_camera.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiCameraPosition _$MiraiCameraPositionFromJson(Map json) { + return _MiraiCameraPosition.fromJson(json); +} + +/// @nodoc +mixin _$MiraiCameraPosition { + double get bearing => throw _privateConstructorUsedError; + MiraiLatLng get target => throw _privateConstructorUsedError; + double get tilt => throw _privateConstructorUsedError; + double get zoom => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiCameraPositionCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiCameraPositionCopyWith<$Res> { + factory $MiraiCameraPositionCopyWith( + MiraiCameraPosition value, $Res Function(MiraiCameraPosition) then) = + _$MiraiCameraPositionCopyWithImpl<$Res, MiraiCameraPosition>; + @useResult + $Res call({double bearing, MiraiLatLng target, double tilt, double zoom}); + + $MiraiLatLngCopyWith<$Res> get target; +} + +/// @nodoc +class _$MiraiCameraPositionCopyWithImpl<$Res, $Val extends MiraiCameraPosition> + implements $MiraiCameraPositionCopyWith<$Res> { + _$MiraiCameraPositionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bearing = null, + Object? target = null, + Object? tilt = null, + Object? zoom = null, + }) { + return _then(_value.copyWith( + bearing: null == bearing + ? _value.bearing + : bearing // ignore: cast_nullable_to_non_nullable + as double, + target: null == target + ? _value.target + : target // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + tilt: null == tilt + ? _value.tilt + : tilt // ignore: cast_nullable_to_non_nullable + as double, + zoom: null == zoom + ? _value.zoom + : zoom // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiLatLngCopyWith<$Res> get target { + return $MiraiLatLngCopyWith<$Res>(_value.target, (value) { + return _then(_value.copyWith(target: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiCameraPositionImplCopyWith<$Res> + implements $MiraiCameraPositionCopyWith<$Res> { + factory _$$MiraiCameraPositionImplCopyWith(_$MiraiCameraPositionImpl value, + $Res Function(_$MiraiCameraPositionImpl) then) = + __$$MiraiCameraPositionImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({double bearing, MiraiLatLng target, double tilt, double zoom}); + + @override + $MiraiLatLngCopyWith<$Res> get target; +} + +/// @nodoc +class __$$MiraiCameraPositionImplCopyWithImpl<$Res> + extends _$MiraiCameraPositionCopyWithImpl<$Res, _$MiraiCameraPositionImpl> + implements _$$MiraiCameraPositionImplCopyWith<$Res> { + __$$MiraiCameraPositionImplCopyWithImpl(_$MiraiCameraPositionImpl _value, + $Res Function(_$MiraiCameraPositionImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bearing = null, + Object? target = null, + Object? tilt = null, + Object? zoom = null, + }) { + return _then(_$MiraiCameraPositionImpl( + bearing: null == bearing + ? _value.bearing + : bearing // ignore: cast_nullable_to_non_nullable + as double, + target: null == target + ? _value.target + : target // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + tilt: null == tilt + ? _value.tilt + : tilt // ignore: cast_nullable_to_non_nullable + as double, + zoom: null == zoom + ? _value.zoom + : zoom // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiCameraPositionImpl implements _MiraiCameraPosition { + const _$MiraiCameraPositionImpl( + {this.bearing = 0.0, + required this.target, + this.tilt = 0.0, + this.zoom = 0.0}); + + factory _$MiraiCameraPositionImpl.fromJson(Map json) => + _$$MiraiCameraPositionImplFromJson(json); + + @override + @JsonKey() + final double bearing; + @override + final MiraiLatLng target; + @override + @JsonKey() + final double tilt; + @override + @JsonKey() + final double zoom; + + @override + String toString() { + return 'MiraiCameraPosition(bearing: $bearing, target: $target, tilt: $tilt, zoom: $zoom)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiCameraPositionImpl && + (identical(other.bearing, bearing) || other.bearing == bearing) && + (identical(other.target, target) || other.target == target) && + (identical(other.tilt, tilt) || other.tilt == tilt) && + (identical(other.zoom, zoom) || other.zoom == zoom)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, bearing, target, tilt, zoom); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiCameraPositionImplCopyWith<_$MiraiCameraPositionImpl> get copyWith => + __$$MiraiCameraPositionImplCopyWithImpl<_$MiraiCameraPositionImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiCameraPositionImplToJson( + this, + ); + } +} + +abstract class _MiraiCameraPosition implements MiraiCameraPosition { + const factory _MiraiCameraPosition( + {final double bearing, + required final MiraiLatLng target, + final double tilt, + final double zoom}) = _$MiraiCameraPositionImpl; + + factory _MiraiCameraPosition.fromJson(Map json) = + _$MiraiCameraPositionImpl.fromJson; + + @override + double get bearing; + @override + MiraiLatLng get target; + @override + double get tilt; + @override + double get zoom; + @override + @JsonKey(ignore: true) + _$$MiraiCameraPositionImplCopyWith<_$MiraiCameraPositionImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.g.dart new file mode 100644 index 00000000..8010873d --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_camera.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_camera.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiCameraPositionImpl _$$MiraiCameraPositionImplFromJson( + Map json) => + _$MiraiCameraPositionImpl( + bearing: (json['bearing'] as num?)?.toDouble() ?? 0.0, + target: MiraiLatLng.fromJson(json['target'] as Map), + tilt: (json['tilt'] as num?)?.toDouble() ?? 0.0, + zoom: (json['zoom'] as num?)?.toDouble() ?? 0.0, + ); + +Map _$$MiraiCameraPositionImplToJson( + _$MiraiCameraPositionImpl instance) => + { + 'bearing': instance.bearing, + 'target': instance.target, + 'tilt': instance.tilt, + 'zoom': instance.zoom, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.dart new file mode 100644 index 00000000..df6fc871 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mirai/src/utils/color_utils.dart'; +import 'mirai_google_map_ui.dart'; + +part 'mirai_google_map_circle.freezed.dart'; +part 'mirai_google_map_circle.g.dart'; + +@freezed +class MiraiCircleId with _$MiraiCircleId { + const factory MiraiCircleId(String value) = _MiraiCircleId; + + factory MiraiCircleId.fromJson(Map json) => _$MiraiCircleIdFromJson(json); +} + +@freezed +class MiraiCircle with _$MiraiCircle { + const factory MiraiCircle({ + required MiraiCircleId circleId, + @Default(false) bool consumeTapEvents, + String? fillColor, + @Default(MiraiLatLng(0.0, 0.0)) MiraiLatLng center, + @Default(0) double radius, + String? strokeColor, + @Default(10) int strokeWidth, + @Default(true) bool visible, + @Default(0) int zIndex, + // VoidCallback? onTap, + }) = _MiraiCircle; + + factory MiraiCircle.fromJson(Map json) => _$MiraiCircleFromJson(json); +} + +extension MiraiCircleParser on MiraiCircle { + Circle parse( + BuildContext context, { + VoidCallback? onTap, + }) { + return Circle( + circleId: CircleId(circleId.value), + consumeTapEvents: consumeTapEvents, + fillColor: fillColor?.toColor(context) ?? Colors.transparent, + center: center.parse, + radius: radius, + strokeWidth: strokeWidth, + strokeColor: strokeColor?.toColor(context) ?? Colors.black, + visible: visible, + onTap: onTap); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.freezed.dart new file mode 100644 index 00000000..bf00af1a --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.freezed.dart @@ -0,0 +1,487 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_circle.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiCircleId _$MiraiCircleIdFromJson(Map json) { + return _MiraiCircleId.fromJson(json); +} + +/// @nodoc +mixin _$MiraiCircleId { + String get value => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiCircleIdCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiCircleIdCopyWith<$Res> { + factory $MiraiCircleIdCopyWith( + MiraiCircleId value, $Res Function(MiraiCircleId) then) = + _$MiraiCircleIdCopyWithImpl<$Res, MiraiCircleId>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class _$MiraiCircleIdCopyWithImpl<$Res, $Val extends MiraiCircleId> + implements $MiraiCircleIdCopyWith<$Res> { + _$MiraiCircleIdCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_value.copyWith( + value: null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiCircleIdImplCopyWith<$Res> + implements $MiraiCircleIdCopyWith<$Res> { + factory _$$MiraiCircleIdImplCopyWith( + _$MiraiCircleIdImpl value, $Res Function(_$MiraiCircleIdImpl) then) = + __$$MiraiCircleIdImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$MiraiCircleIdImplCopyWithImpl<$Res> + extends _$MiraiCircleIdCopyWithImpl<$Res, _$MiraiCircleIdImpl> + implements _$$MiraiCircleIdImplCopyWith<$Res> { + __$$MiraiCircleIdImplCopyWithImpl( + _$MiraiCircleIdImpl _value, $Res Function(_$MiraiCircleIdImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$MiraiCircleIdImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiCircleIdImpl implements _MiraiCircleId { + const _$MiraiCircleIdImpl(this.value); + + factory _$MiraiCircleIdImpl.fromJson(Map json) => + _$$MiraiCircleIdImplFromJson(json); + + @override + final String value; + + @override + String toString() { + return 'MiraiCircleId(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiCircleIdImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, value); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiCircleIdImplCopyWith<_$MiraiCircleIdImpl> get copyWith => + __$$MiraiCircleIdImplCopyWithImpl<_$MiraiCircleIdImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiCircleIdImplToJson( + this, + ); + } +} + +abstract class _MiraiCircleId implements MiraiCircleId { + const factory _MiraiCircleId(final String value) = _$MiraiCircleIdImpl; + + factory _MiraiCircleId.fromJson(Map json) = + _$MiraiCircleIdImpl.fromJson; + + @override + String get value; + @override + @JsonKey(ignore: true) + _$$MiraiCircleIdImplCopyWith<_$MiraiCircleIdImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiCircle _$MiraiCircleFromJson(Map json) { + return _MiraiCircle.fromJson(json); +} + +/// @nodoc +mixin _$MiraiCircle { + MiraiCircleId get circleId => throw _privateConstructorUsedError; + bool get consumeTapEvents => throw _privateConstructorUsedError; + String? get fillColor => throw _privateConstructorUsedError; + MiraiLatLng get center => throw _privateConstructorUsedError; + double get radius => throw _privateConstructorUsedError; + String? get strokeColor => throw _privateConstructorUsedError; + int get strokeWidth => throw _privateConstructorUsedError; + bool get visible => throw _privateConstructorUsedError; + int get zIndex => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiCircleCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiCircleCopyWith<$Res> { + factory $MiraiCircleCopyWith( + MiraiCircle value, $Res Function(MiraiCircle) then) = + _$MiraiCircleCopyWithImpl<$Res, MiraiCircle>; + @useResult + $Res call( + {MiraiCircleId circleId, + bool consumeTapEvents, + String? fillColor, + MiraiLatLng center, + double radius, + String? strokeColor, + int strokeWidth, + bool visible, + int zIndex}); + + $MiraiCircleIdCopyWith<$Res> get circleId; + $MiraiLatLngCopyWith<$Res> get center; +} + +/// @nodoc +class _$MiraiCircleCopyWithImpl<$Res, $Val extends MiraiCircle> + implements $MiraiCircleCopyWith<$Res> { + _$MiraiCircleCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? circleId = null, + Object? consumeTapEvents = null, + Object? fillColor = freezed, + Object? center = null, + Object? radius = null, + Object? strokeColor = freezed, + Object? strokeWidth = null, + Object? visible = null, + Object? zIndex = null, + }) { + return _then(_value.copyWith( + circleId: null == circleId + ? _value.circleId + : circleId // ignore: cast_nullable_to_non_nullable + as MiraiCircleId, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + fillColor: freezed == fillColor + ? _value.fillColor + : fillColor // ignore: cast_nullable_to_non_nullable + as String?, + center: null == center + ? _value.center + : center // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + radius: null == radius + ? _value.radius + : radius // ignore: cast_nullable_to_non_nullable + as double, + strokeColor: freezed == strokeColor + ? _value.strokeColor + : strokeColor // ignore: cast_nullable_to_non_nullable + as String?, + strokeWidth: null == strokeWidth + ? _value.strokeWidth + : strokeWidth // ignore: cast_nullable_to_non_nullable + as int, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiCircleIdCopyWith<$Res> get circleId { + return $MiraiCircleIdCopyWith<$Res>(_value.circleId, (value) { + return _then(_value.copyWith(circleId: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiLatLngCopyWith<$Res> get center { + return $MiraiLatLngCopyWith<$Res>(_value.center, (value) { + return _then(_value.copyWith(center: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiCircleImplCopyWith<$Res> + implements $MiraiCircleCopyWith<$Res> { + factory _$$MiraiCircleImplCopyWith( + _$MiraiCircleImpl value, $Res Function(_$MiraiCircleImpl) then) = + __$$MiraiCircleImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {MiraiCircleId circleId, + bool consumeTapEvents, + String? fillColor, + MiraiLatLng center, + double radius, + String? strokeColor, + int strokeWidth, + bool visible, + int zIndex}); + + @override + $MiraiCircleIdCopyWith<$Res> get circleId; + @override + $MiraiLatLngCopyWith<$Res> get center; +} + +/// @nodoc +class __$$MiraiCircleImplCopyWithImpl<$Res> + extends _$MiraiCircleCopyWithImpl<$Res, _$MiraiCircleImpl> + implements _$$MiraiCircleImplCopyWith<$Res> { + __$$MiraiCircleImplCopyWithImpl( + _$MiraiCircleImpl _value, $Res Function(_$MiraiCircleImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? circleId = null, + Object? consumeTapEvents = null, + Object? fillColor = freezed, + Object? center = null, + Object? radius = null, + Object? strokeColor = freezed, + Object? strokeWidth = null, + Object? visible = null, + Object? zIndex = null, + }) { + return _then(_$MiraiCircleImpl( + circleId: null == circleId + ? _value.circleId + : circleId // ignore: cast_nullable_to_non_nullable + as MiraiCircleId, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + fillColor: freezed == fillColor + ? _value.fillColor + : fillColor // ignore: cast_nullable_to_non_nullable + as String?, + center: null == center + ? _value.center + : center // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + radius: null == radius + ? _value.radius + : radius // ignore: cast_nullable_to_non_nullable + as double, + strokeColor: freezed == strokeColor + ? _value.strokeColor + : strokeColor // ignore: cast_nullable_to_non_nullable + as String?, + strokeWidth: null == strokeWidth + ? _value.strokeWidth + : strokeWidth // ignore: cast_nullable_to_non_nullable + as int, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiCircleImpl implements _MiraiCircle { + const _$MiraiCircleImpl( + {required this.circleId, + this.consumeTapEvents = false, + this.fillColor, + this.center = const MiraiLatLng(0.0, 0.0), + this.radius = 0, + this.strokeColor, + this.strokeWidth = 10, + this.visible = true, + this.zIndex = 0}); + + factory _$MiraiCircleImpl.fromJson(Map json) => + _$$MiraiCircleImplFromJson(json); + + @override + final MiraiCircleId circleId; + @override + @JsonKey() + final bool consumeTapEvents; + @override + final String? fillColor; + @override + @JsonKey() + final MiraiLatLng center; + @override + @JsonKey() + final double radius; + @override + final String? strokeColor; + @override + @JsonKey() + final int strokeWidth; + @override + @JsonKey() + final bool visible; + @override + @JsonKey() + final int zIndex; + + @override + String toString() { + return 'MiraiCircle(circleId: $circleId, consumeTapEvents: $consumeTapEvents, fillColor: $fillColor, center: $center, radius: $radius, strokeColor: $strokeColor, strokeWidth: $strokeWidth, visible: $visible, zIndex: $zIndex)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiCircleImpl && + (identical(other.circleId, circleId) || + other.circleId == circleId) && + (identical(other.consumeTapEvents, consumeTapEvents) || + other.consumeTapEvents == consumeTapEvents) && + (identical(other.fillColor, fillColor) || + other.fillColor == fillColor) && + (identical(other.center, center) || other.center == center) && + (identical(other.radius, radius) || other.radius == radius) && + (identical(other.strokeColor, strokeColor) || + other.strokeColor == strokeColor) && + (identical(other.strokeWidth, strokeWidth) || + other.strokeWidth == strokeWidth) && + (identical(other.visible, visible) || other.visible == visible) && + (identical(other.zIndex, zIndex) || other.zIndex == zIndex)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, circleId, consumeTapEvents, + fillColor, center, radius, strokeColor, strokeWidth, visible, zIndex); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiCircleImplCopyWith<_$MiraiCircleImpl> get copyWith => + __$$MiraiCircleImplCopyWithImpl<_$MiraiCircleImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiCircleImplToJson( + this, + ); + } +} + +abstract class _MiraiCircle implements MiraiCircle { + const factory _MiraiCircle( + {required final MiraiCircleId circleId, + final bool consumeTapEvents, + final String? fillColor, + final MiraiLatLng center, + final double radius, + final String? strokeColor, + final int strokeWidth, + final bool visible, + final int zIndex}) = _$MiraiCircleImpl; + + factory _MiraiCircle.fromJson(Map json) = + _$MiraiCircleImpl.fromJson; + + @override + MiraiCircleId get circleId; + @override + bool get consumeTapEvents; + @override + String? get fillColor; + @override + MiraiLatLng get center; + @override + double get radius; + @override + String? get strokeColor; + @override + int get strokeWidth; + @override + bool get visible; + @override + int get zIndex; + @override + @JsonKey(ignore: true) + _$$MiraiCircleImplCopyWith<_$MiraiCircleImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.g.dart new file mode 100644 index 00000000..346c0545 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_circle.g.dart @@ -0,0 +1,46 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_circle.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiCircleIdImpl _$$MiraiCircleIdImplFromJson(Map json) => + _$MiraiCircleIdImpl( + json['value'] as String, + ); + +Map _$$MiraiCircleIdImplToJson(_$MiraiCircleIdImpl instance) => + { + 'value': instance.value, + }; + +_$MiraiCircleImpl _$$MiraiCircleImplFromJson(Map json) => + _$MiraiCircleImpl( + circleId: + MiraiCircleId.fromJson(json['circleId'] as Map), + consumeTapEvents: json['consumeTapEvents'] as bool? ?? false, + fillColor: json['fillColor'] as String?, + center: json['center'] == null + ? const MiraiLatLng(0.0, 0.0) + : MiraiLatLng.fromJson(json['center'] as Map), + radius: (json['radius'] as num?)?.toDouble() ?? 0, + strokeColor: json['strokeColor'] as String?, + strokeWidth: json['strokeWidth'] as int? ?? 10, + visible: json['visible'] as bool? ?? true, + zIndex: json['zIndex'] as int? ?? 0, + ); + +Map _$$MiraiCircleImplToJson(_$MiraiCircleImpl instance) => + { + 'circleId': instance.circleId, + 'consumeTapEvents': instance.consumeTapEvents, + 'fillColor': instance.fillColor, + 'center': instance.center, + 'radius': instance.radius, + 'strokeColor': instance.strokeColor, + 'strokeWidth': instance.strokeWidth, + 'visible': instance.visible, + 'zIndex': instance.zIndex, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.dart new file mode 100644 index 00000000..939b967b --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mirai/src/parsers/mirai_offset/mirai_offset.dart'; +import 'mirai_google_map_ui.dart'; + +part 'mirai_google_map_marker.freezed.dart'; +part 'mirai_google_map_marker.g.dart'; + +@freezed +class MiraiMarkerId with _$MiraiMarkerId { + const factory MiraiMarkerId(String value) = _MiraiMarkerId; + + factory MiraiMarkerId.fromJson(Map json) => _$MiraiMarkerIdFromJson(json); +} + +@freezed +class MiraiMarker with _$MiraiMarker { + const factory MiraiMarker({ + required MiraiMarkerId markerId, + @Default(1.0) double alpha, + @Default(MiraiOffset(dx: 0.5, dy: 1.0)) MiraiOffset anchor, + @Default(false) bool consumeTapEvents, + @Default(false) bool draggable, + @Default(false) bool flat, + // @Default(BitmapDescriptor.defaultMarker) BitmapDescriptor icon, + // @Default(InfoWindow.noText) InfoWindow infoWindow, + @Default(MiraiLatLng(0, 0)) MiraiLatLng position, + @Default(0) double rotation, + @Default(true) bool visible, + @Default(0.0) double zIndex, + // String ?clusterManagerId, + + Map? onTap, + Map? onDrag, + Map? onDragStart, + Map? onDragEnd, + }) = _MiraiMarker; + + factory MiraiMarker.fromJson(Map json) => _$MiraiMarkerFromJson(json); +} + +extension MiraiMarkerParser on MiraiMarker { + Marker parse( + { + final VoidCallback? onTap, + final ValueChanged? onDragStart, + final ValueChanged? onDragEnd, + final ValueChanged? onDrag, + } + ) { + return Marker( + markerId: MarkerId(markerId.value), + alpha: alpha, + anchor: anchor.parse, + consumeTapEvents: consumeTapEvents, + draggable: draggable, + flat: flat, + // icon: icon, + position: position.parse, + rotation: rotation, + visible: visible, + zIndex: zIndex, + // clusterManagerId: ClusterManagerId(), + // onTap: onTap + onTap: onTap, + onDragStart: onDragStart, + onDragEnd: onDragEnd, + onDrag: onDrag, + ); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.freezed.dart new file mode 100644 index 00000000..47734904 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.freezed.dart @@ -0,0 +1,660 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_marker.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiMarkerId _$MiraiMarkerIdFromJson(Map json) { + return _MiraiMarkerId.fromJson(json); +} + +/// @nodoc +mixin _$MiraiMarkerId { + String get value => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiMarkerIdCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiMarkerIdCopyWith<$Res> { + factory $MiraiMarkerIdCopyWith( + MiraiMarkerId value, $Res Function(MiraiMarkerId) then) = + _$MiraiMarkerIdCopyWithImpl<$Res, MiraiMarkerId>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class _$MiraiMarkerIdCopyWithImpl<$Res, $Val extends MiraiMarkerId> + implements $MiraiMarkerIdCopyWith<$Res> { + _$MiraiMarkerIdCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_value.copyWith( + value: null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiMarkerIdImplCopyWith<$Res> + implements $MiraiMarkerIdCopyWith<$Res> { + factory _$$MiraiMarkerIdImplCopyWith( + _$MiraiMarkerIdImpl value, $Res Function(_$MiraiMarkerIdImpl) then) = + __$$MiraiMarkerIdImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$MiraiMarkerIdImplCopyWithImpl<$Res> + extends _$MiraiMarkerIdCopyWithImpl<$Res, _$MiraiMarkerIdImpl> + implements _$$MiraiMarkerIdImplCopyWith<$Res> { + __$$MiraiMarkerIdImplCopyWithImpl( + _$MiraiMarkerIdImpl _value, $Res Function(_$MiraiMarkerIdImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$MiraiMarkerIdImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiMarkerIdImpl implements _MiraiMarkerId { + const _$MiraiMarkerIdImpl(this.value); + + factory _$MiraiMarkerIdImpl.fromJson(Map json) => + _$$MiraiMarkerIdImplFromJson(json); + + @override + final String value; + + @override + String toString() { + return 'MiraiMarkerId(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiMarkerIdImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, value); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiMarkerIdImplCopyWith<_$MiraiMarkerIdImpl> get copyWith => + __$$MiraiMarkerIdImplCopyWithImpl<_$MiraiMarkerIdImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiMarkerIdImplToJson( + this, + ); + } +} + +abstract class _MiraiMarkerId implements MiraiMarkerId { + const factory _MiraiMarkerId(final String value) = _$MiraiMarkerIdImpl; + + factory _MiraiMarkerId.fromJson(Map json) = + _$MiraiMarkerIdImpl.fromJson; + + @override + String get value; + @override + @JsonKey(ignore: true) + _$$MiraiMarkerIdImplCopyWith<_$MiraiMarkerIdImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiMarker _$MiraiMarkerFromJson(Map json) { + return _MiraiMarker.fromJson(json); +} + +/// @nodoc +mixin _$MiraiMarker { + MiraiMarkerId get markerId => throw _privateConstructorUsedError; + double get alpha => throw _privateConstructorUsedError; + MiraiOffset get anchor => throw _privateConstructorUsedError; + bool get consumeTapEvents => throw _privateConstructorUsedError; + bool get draggable => throw _privateConstructorUsedError; + bool get flat => + throw _privateConstructorUsedError; // @Default(BitmapDescriptor.defaultMarker) BitmapDescriptor icon, +// @Default(InfoWindow.noText) InfoWindow infoWindow, + MiraiLatLng get position => throw _privateConstructorUsedError; + double get rotation => throw _privateConstructorUsedError; + bool get visible => throw _privateConstructorUsedError; + double get zIndex => + throw _privateConstructorUsedError; // String ?clusterManagerId, + Map? get onTap => throw _privateConstructorUsedError; + Map? get onDrag => throw _privateConstructorUsedError; + Map? get onDragStart => throw _privateConstructorUsedError; + Map? get onDragEnd => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiMarkerCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiMarkerCopyWith<$Res> { + factory $MiraiMarkerCopyWith( + MiraiMarker value, $Res Function(MiraiMarker) then) = + _$MiraiMarkerCopyWithImpl<$Res, MiraiMarker>; + @useResult + $Res call( + {MiraiMarkerId markerId, + double alpha, + MiraiOffset anchor, + bool consumeTapEvents, + bool draggable, + bool flat, + MiraiLatLng position, + double rotation, + bool visible, + double zIndex, + Map? onTap, + Map? onDrag, + Map? onDragStart, + Map? onDragEnd}); + + $MiraiMarkerIdCopyWith<$Res> get markerId; + $MiraiOffsetCopyWith<$Res> get anchor; + $MiraiLatLngCopyWith<$Res> get position; +} + +/// @nodoc +class _$MiraiMarkerCopyWithImpl<$Res, $Val extends MiraiMarker> + implements $MiraiMarkerCopyWith<$Res> { + _$MiraiMarkerCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? markerId = null, + Object? alpha = null, + Object? anchor = null, + Object? consumeTapEvents = null, + Object? draggable = null, + Object? flat = null, + Object? position = null, + Object? rotation = null, + Object? visible = null, + Object? zIndex = null, + Object? onTap = freezed, + Object? onDrag = freezed, + Object? onDragStart = freezed, + Object? onDragEnd = freezed, + }) { + return _then(_value.copyWith( + markerId: null == markerId + ? _value.markerId + : markerId // ignore: cast_nullable_to_non_nullable + as MiraiMarkerId, + alpha: null == alpha + ? _value.alpha + : alpha // ignore: cast_nullable_to_non_nullable + as double, + anchor: null == anchor + ? _value.anchor + : anchor // ignore: cast_nullable_to_non_nullable + as MiraiOffset, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + draggable: null == draggable + ? _value.draggable + : draggable // ignore: cast_nullable_to_non_nullable + as bool, + flat: null == flat + ? _value.flat + : flat // ignore: cast_nullable_to_non_nullable + as bool, + position: null == position + ? _value.position + : position // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + rotation: null == rotation + ? _value.rotation + : rotation // ignore: cast_nullable_to_non_nullable + as double, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as double, + onTap: freezed == onTap + ? _value.onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + onDrag: freezed == onDrag + ? _value.onDrag + : onDrag // ignore: cast_nullable_to_non_nullable + as Map?, + onDragStart: freezed == onDragStart + ? _value.onDragStart + : onDragStart // ignore: cast_nullable_to_non_nullable + as Map?, + onDragEnd: freezed == onDragEnd + ? _value.onDragEnd + : onDragEnd // ignore: cast_nullable_to_non_nullable + as Map?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiMarkerIdCopyWith<$Res> get markerId { + return $MiraiMarkerIdCopyWith<$Res>(_value.markerId, (value) { + return _then(_value.copyWith(markerId: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiOffsetCopyWith<$Res> get anchor { + return $MiraiOffsetCopyWith<$Res>(_value.anchor, (value) { + return _then(_value.copyWith(anchor: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiLatLngCopyWith<$Res> get position { + return $MiraiLatLngCopyWith<$Res>(_value.position, (value) { + return _then(_value.copyWith(position: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiMarkerImplCopyWith<$Res> + implements $MiraiMarkerCopyWith<$Res> { + factory _$$MiraiMarkerImplCopyWith( + _$MiraiMarkerImpl value, $Res Function(_$MiraiMarkerImpl) then) = + __$$MiraiMarkerImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {MiraiMarkerId markerId, + double alpha, + MiraiOffset anchor, + bool consumeTapEvents, + bool draggable, + bool flat, + MiraiLatLng position, + double rotation, + bool visible, + double zIndex, + Map? onTap, + Map? onDrag, + Map? onDragStart, + Map? onDragEnd}); + + @override + $MiraiMarkerIdCopyWith<$Res> get markerId; + @override + $MiraiOffsetCopyWith<$Res> get anchor; + @override + $MiraiLatLngCopyWith<$Res> get position; +} + +/// @nodoc +class __$$MiraiMarkerImplCopyWithImpl<$Res> + extends _$MiraiMarkerCopyWithImpl<$Res, _$MiraiMarkerImpl> + implements _$$MiraiMarkerImplCopyWith<$Res> { + __$$MiraiMarkerImplCopyWithImpl( + _$MiraiMarkerImpl _value, $Res Function(_$MiraiMarkerImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? markerId = null, + Object? alpha = null, + Object? anchor = null, + Object? consumeTapEvents = null, + Object? draggable = null, + Object? flat = null, + Object? position = null, + Object? rotation = null, + Object? visible = null, + Object? zIndex = null, + Object? onTap = freezed, + Object? onDrag = freezed, + Object? onDragStart = freezed, + Object? onDragEnd = freezed, + }) { + return _then(_$MiraiMarkerImpl( + markerId: null == markerId + ? _value.markerId + : markerId // ignore: cast_nullable_to_non_nullable + as MiraiMarkerId, + alpha: null == alpha + ? _value.alpha + : alpha // ignore: cast_nullable_to_non_nullable + as double, + anchor: null == anchor + ? _value.anchor + : anchor // ignore: cast_nullable_to_non_nullable + as MiraiOffset, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + draggable: null == draggable + ? _value.draggable + : draggable // ignore: cast_nullable_to_non_nullable + as bool, + flat: null == flat + ? _value.flat + : flat // ignore: cast_nullable_to_non_nullable + as bool, + position: null == position + ? _value.position + : position // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + rotation: null == rotation + ? _value.rotation + : rotation // ignore: cast_nullable_to_non_nullable + as double, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as double, + onTap: freezed == onTap + ? _value._onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + onDrag: freezed == onDrag + ? _value._onDrag + : onDrag // ignore: cast_nullable_to_non_nullable + as Map?, + onDragStart: freezed == onDragStart + ? _value._onDragStart + : onDragStart // ignore: cast_nullable_to_non_nullable + as Map?, + onDragEnd: freezed == onDragEnd + ? _value._onDragEnd + : onDragEnd // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiMarkerImpl implements _MiraiMarker { + const _$MiraiMarkerImpl( + {required this.markerId, + this.alpha = 1.0, + this.anchor = const MiraiOffset(dx: 0.5, dy: 1.0), + this.consumeTapEvents = false, + this.draggable = false, + this.flat = false, + this.position = const MiraiLatLng(0, 0), + this.rotation = 0, + this.visible = true, + this.zIndex = 0.0, + final Map? onTap, + final Map? onDrag, + final Map? onDragStart, + final Map? onDragEnd}) + : _onTap = onTap, + _onDrag = onDrag, + _onDragStart = onDragStart, + _onDragEnd = onDragEnd; + + factory _$MiraiMarkerImpl.fromJson(Map json) => + _$$MiraiMarkerImplFromJson(json); + + @override + final MiraiMarkerId markerId; + @override + @JsonKey() + final double alpha; + @override + @JsonKey() + final MiraiOffset anchor; + @override + @JsonKey() + final bool consumeTapEvents; + @override + @JsonKey() + final bool draggable; + @override + @JsonKey() + final bool flat; +// @Default(BitmapDescriptor.defaultMarker) BitmapDescriptor icon, +// @Default(InfoWindow.noText) InfoWindow infoWindow, + @override + @JsonKey() + final MiraiLatLng position; + @override + @JsonKey() + final double rotation; + @override + @JsonKey() + final bool visible; + @override + @JsonKey() + final double zIndex; +// String ?clusterManagerId, + final Map? _onTap; +// String ?clusterManagerId, + @override + Map? get onTap { + final value = _onTap; + if (value == null) return null; + if (_onTap is EqualUnmodifiableMapView) return _onTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onDrag; + @override + Map? get onDrag { + final value = _onDrag; + if (value == null) return null; + if (_onDrag is EqualUnmodifiableMapView) return _onDrag; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onDragStart; + @override + Map? get onDragStart { + final value = _onDragStart; + if (value == null) return null; + if (_onDragStart is EqualUnmodifiableMapView) return _onDragStart; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + final Map? _onDragEnd; + @override + Map? get onDragEnd { + final value = _onDragEnd; + if (value == null) return null; + if (_onDragEnd is EqualUnmodifiableMapView) return _onDragEnd; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + String toString() { + return 'MiraiMarker(markerId: $markerId, alpha: $alpha, anchor: $anchor, consumeTapEvents: $consumeTapEvents, draggable: $draggable, flat: $flat, position: $position, rotation: $rotation, visible: $visible, zIndex: $zIndex, onTap: $onTap, onDrag: $onDrag, onDragStart: $onDragStart, onDragEnd: $onDragEnd)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiMarkerImpl && + (identical(other.markerId, markerId) || + other.markerId == markerId) && + (identical(other.alpha, alpha) || other.alpha == alpha) && + (identical(other.anchor, anchor) || other.anchor == anchor) && + (identical(other.consumeTapEvents, consumeTapEvents) || + other.consumeTapEvents == consumeTapEvents) && + (identical(other.draggable, draggable) || + other.draggable == draggable) && + (identical(other.flat, flat) || other.flat == flat) && + (identical(other.position, position) || + other.position == position) && + (identical(other.rotation, rotation) || + other.rotation == rotation) && + (identical(other.visible, visible) || other.visible == visible) && + (identical(other.zIndex, zIndex) || other.zIndex == zIndex) && + const DeepCollectionEquality().equals(other._onTap, _onTap) && + const DeepCollectionEquality().equals(other._onDrag, _onDrag) && + const DeepCollectionEquality() + .equals(other._onDragStart, _onDragStart) && + const DeepCollectionEquality() + .equals(other._onDragEnd, _onDragEnd)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + markerId, + alpha, + anchor, + consumeTapEvents, + draggable, + flat, + position, + rotation, + visible, + zIndex, + const DeepCollectionEquality().hash(_onTap), + const DeepCollectionEquality().hash(_onDrag), + const DeepCollectionEquality().hash(_onDragStart), + const DeepCollectionEquality().hash(_onDragEnd)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiMarkerImplCopyWith<_$MiraiMarkerImpl> get copyWith => + __$$MiraiMarkerImplCopyWithImpl<_$MiraiMarkerImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiMarkerImplToJson( + this, + ); + } +} + +abstract class _MiraiMarker implements MiraiMarker { + const factory _MiraiMarker( + {required final MiraiMarkerId markerId, + final double alpha, + final MiraiOffset anchor, + final bool consumeTapEvents, + final bool draggable, + final bool flat, + final MiraiLatLng position, + final double rotation, + final bool visible, + final double zIndex, + final Map? onTap, + final Map? onDrag, + final Map? onDragStart, + final Map? onDragEnd}) = _$MiraiMarkerImpl; + + factory _MiraiMarker.fromJson(Map json) = + _$MiraiMarkerImpl.fromJson; + + @override + MiraiMarkerId get markerId; + @override + double get alpha; + @override + MiraiOffset get anchor; + @override + bool get consumeTapEvents; + @override + bool get draggable; + @override + bool get flat; + @override // @Default(BitmapDescriptor.defaultMarker) BitmapDescriptor icon, +// @Default(InfoWindow.noText) InfoWindow infoWindow, + MiraiLatLng get position; + @override + double get rotation; + @override + bool get visible; + @override + double get zIndex; + @override // String ?clusterManagerId, + Map? get onTap; + @override + Map? get onDrag; + @override + Map? get onDragStart; + @override + Map? get onDragEnd; + @override + @JsonKey(ignore: true) + _$$MiraiMarkerImplCopyWith<_$MiraiMarkerImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.g.dart new file mode 100644 index 00000000..1325914e --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_marker.g.dart @@ -0,0 +1,58 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_marker.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiMarkerIdImpl _$$MiraiMarkerIdImplFromJson(Map json) => + _$MiraiMarkerIdImpl( + json['value'] as String, + ); + +Map _$$MiraiMarkerIdImplToJson(_$MiraiMarkerIdImpl instance) => + { + 'value': instance.value, + }; + +_$MiraiMarkerImpl _$$MiraiMarkerImplFromJson(Map json) => + _$MiraiMarkerImpl( + markerId: + MiraiMarkerId.fromJson(json['markerId'] as Map), + alpha: (json['alpha'] as num?)?.toDouble() ?? 1.0, + anchor: json['anchor'] == null + ? const MiraiOffset(dx: 0.5, dy: 1.0) + : MiraiOffset.fromJson(json['anchor'] as Map), + consumeTapEvents: json['consumeTapEvents'] as bool? ?? false, + draggable: json['draggable'] as bool? ?? false, + flat: json['flat'] as bool? ?? false, + position: json['position'] == null + ? const MiraiLatLng(0, 0) + : MiraiLatLng.fromJson(json['position'] as Map), + rotation: (json['rotation'] as num?)?.toDouble() ?? 0, + visible: json['visible'] as bool? ?? true, + zIndex: (json['zIndex'] as num?)?.toDouble() ?? 0.0, + onTap: json['onTap'] as Map?, + onDrag: json['onDrag'] as Map?, + onDragStart: json['onDragStart'] as Map?, + onDragEnd: json['onDragEnd'] as Map?, + ); + +Map _$$MiraiMarkerImplToJson(_$MiraiMarkerImpl instance) => + { + 'markerId': instance.markerId, + 'alpha': instance.alpha, + 'anchor': instance.anchor, + 'consumeTapEvents': instance.consumeTapEvents, + 'draggable': instance.draggable, + 'flat': instance.flat, + 'position': instance.position, + 'rotation': instance.rotation, + 'visible': instance.visible, + 'zIndex': instance.zIndex, + 'onTap': instance.onTap, + 'onDrag': instance.onDrag, + 'onDragStart': instance.onDragStart, + 'onDragEnd': instance.onDragEnd, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.dart new file mode 100644 index 00000000..307d4245 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mirai/src/utils/color_utils.dart'; +import 'mirai_google_map_ui.dart'; + +part 'mirai_google_map_polygon.freezed.dart'; +part 'mirai_google_map_polygon.g.dart'; + +@freezed +class MiraiPolygonId with _$MiraiPolygonId { + const factory MiraiPolygonId(String value) = _MiraiPolygonId; + + factory MiraiPolygonId.fromJson(Map json) => _$MiraiPolygonIdFromJson(json); +} + +@freezed +class MiraiPolygon with _$MiraiPolygon { + const factory MiraiPolygon({ + required MiraiPolygonId polygonId, + @Default(false) bool consumeTapEvents, + String? fillColor, + @Default(false) bool geodesic, + @Default([]) List points, + @Default([]) List> holes, + String? strokeColor, + @Default(10) int strokeWidth, + @Default(true) bool visible, + @Default(0) int zIndex, + Map? onTap, + }) = _MiraiPolygon; + + factory MiraiPolygon.fromJson(Map json) => _$MiraiPolygonFromJson(json); +} + +extension MiraiPolygonParser on MiraiPolygon { + Polygon parse( + BuildContext context, { + VoidCallback? onTap, + }) { + return Polygon( + polygonId: PolygonId(polygonId.value), + consumeTapEvents: consumeTapEvents, + fillColor: fillColor?.toColor(context) ?? Colors.black, + geodesic: geodesic, + points: points.map((e) => e.parse).toList(), + holes: holes.map((e) => e.map((e) => e.parse).toList()).toList(), + strokeColor: strokeColor?.toColor(context) ?? Colors.black, + strokeWidth: strokeWidth, + visible: visible, + zIndex: zIndex, + onTap: onTap, + ); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.freezed.dart new file mode 100644 index 00000000..1634f4c9 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.freezed.dart @@ -0,0 +1,552 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_polygon.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiPolygonId _$MiraiPolygonIdFromJson(Map json) { + return _MiraiPolygonId.fromJson(json); +} + +/// @nodoc +mixin _$MiraiPolygonId { + String get value => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiPolygonIdCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiPolygonIdCopyWith<$Res> { + factory $MiraiPolygonIdCopyWith( + MiraiPolygonId value, $Res Function(MiraiPolygonId) then) = + _$MiraiPolygonIdCopyWithImpl<$Res, MiraiPolygonId>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class _$MiraiPolygonIdCopyWithImpl<$Res, $Val extends MiraiPolygonId> + implements $MiraiPolygonIdCopyWith<$Res> { + _$MiraiPolygonIdCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_value.copyWith( + value: null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiPolygonIdImplCopyWith<$Res> + implements $MiraiPolygonIdCopyWith<$Res> { + factory _$$MiraiPolygonIdImplCopyWith(_$MiraiPolygonIdImpl value, + $Res Function(_$MiraiPolygonIdImpl) then) = + __$$MiraiPolygonIdImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$MiraiPolygonIdImplCopyWithImpl<$Res> + extends _$MiraiPolygonIdCopyWithImpl<$Res, _$MiraiPolygonIdImpl> + implements _$$MiraiPolygonIdImplCopyWith<$Res> { + __$$MiraiPolygonIdImplCopyWithImpl( + _$MiraiPolygonIdImpl _value, $Res Function(_$MiraiPolygonIdImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$MiraiPolygonIdImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiPolygonIdImpl implements _MiraiPolygonId { + const _$MiraiPolygonIdImpl(this.value); + + factory _$MiraiPolygonIdImpl.fromJson(Map json) => + _$$MiraiPolygonIdImplFromJson(json); + + @override + final String value; + + @override + String toString() { + return 'MiraiPolygonId(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiPolygonIdImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, value); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiPolygonIdImplCopyWith<_$MiraiPolygonIdImpl> get copyWith => + __$$MiraiPolygonIdImplCopyWithImpl<_$MiraiPolygonIdImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiPolygonIdImplToJson( + this, + ); + } +} + +abstract class _MiraiPolygonId implements MiraiPolygonId { + const factory _MiraiPolygonId(final String value) = _$MiraiPolygonIdImpl; + + factory _MiraiPolygonId.fromJson(Map json) = + _$MiraiPolygonIdImpl.fromJson; + + @override + String get value; + @override + @JsonKey(ignore: true) + _$$MiraiPolygonIdImplCopyWith<_$MiraiPolygonIdImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiPolygon _$MiraiPolygonFromJson(Map json) { + return _MiraiPolygon.fromJson(json); +} + +/// @nodoc +mixin _$MiraiPolygon { + MiraiPolygonId get polygonId => throw _privateConstructorUsedError; + bool get consumeTapEvents => throw _privateConstructorUsedError; + String? get fillColor => throw _privateConstructorUsedError; + bool get geodesic => throw _privateConstructorUsedError; + List get points => throw _privateConstructorUsedError; + List> get holes => throw _privateConstructorUsedError; + String? get strokeColor => throw _privateConstructorUsedError; + int get strokeWidth => throw _privateConstructorUsedError; + bool get visible => throw _privateConstructorUsedError; + int get zIndex => throw _privateConstructorUsedError; + Map? get onTap => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiPolygonCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiPolygonCopyWith<$Res> { + factory $MiraiPolygonCopyWith( + MiraiPolygon value, $Res Function(MiraiPolygon) then) = + _$MiraiPolygonCopyWithImpl<$Res, MiraiPolygon>; + @useResult + $Res call( + {MiraiPolygonId polygonId, + bool consumeTapEvents, + String? fillColor, + bool geodesic, + List points, + List> holes, + String? strokeColor, + int strokeWidth, + bool visible, + int zIndex, + Map? onTap}); + + $MiraiPolygonIdCopyWith<$Res> get polygonId; +} + +/// @nodoc +class _$MiraiPolygonCopyWithImpl<$Res, $Val extends MiraiPolygon> + implements $MiraiPolygonCopyWith<$Res> { + _$MiraiPolygonCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? polygonId = null, + Object? consumeTapEvents = null, + Object? fillColor = freezed, + Object? geodesic = null, + Object? points = null, + Object? holes = null, + Object? strokeColor = freezed, + Object? strokeWidth = null, + Object? visible = null, + Object? zIndex = null, + Object? onTap = freezed, + }) { + return _then(_value.copyWith( + polygonId: null == polygonId + ? _value.polygonId + : polygonId // ignore: cast_nullable_to_non_nullable + as MiraiPolygonId, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + fillColor: freezed == fillColor + ? _value.fillColor + : fillColor // ignore: cast_nullable_to_non_nullable + as String?, + geodesic: null == geodesic + ? _value.geodesic + : geodesic // ignore: cast_nullable_to_non_nullable + as bool, + points: null == points + ? _value.points + : points // ignore: cast_nullable_to_non_nullable + as List, + holes: null == holes + ? _value.holes + : holes // ignore: cast_nullable_to_non_nullable + as List>, + strokeColor: freezed == strokeColor + ? _value.strokeColor + : strokeColor // ignore: cast_nullable_to_non_nullable + as String?, + strokeWidth: null == strokeWidth + ? _value.strokeWidth + : strokeWidth // ignore: cast_nullable_to_non_nullable + as int, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + onTap: freezed == onTap + ? _value.onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiPolygonIdCopyWith<$Res> get polygonId { + return $MiraiPolygonIdCopyWith<$Res>(_value.polygonId, (value) { + return _then(_value.copyWith(polygonId: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiPolygonImplCopyWith<$Res> + implements $MiraiPolygonCopyWith<$Res> { + factory _$$MiraiPolygonImplCopyWith( + _$MiraiPolygonImpl value, $Res Function(_$MiraiPolygonImpl) then) = + __$$MiraiPolygonImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {MiraiPolygonId polygonId, + bool consumeTapEvents, + String? fillColor, + bool geodesic, + List points, + List> holes, + String? strokeColor, + int strokeWidth, + bool visible, + int zIndex, + Map? onTap}); + + @override + $MiraiPolygonIdCopyWith<$Res> get polygonId; +} + +/// @nodoc +class __$$MiraiPolygonImplCopyWithImpl<$Res> + extends _$MiraiPolygonCopyWithImpl<$Res, _$MiraiPolygonImpl> + implements _$$MiraiPolygonImplCopyWith<$Res> { + __$$MiraiPolygonImplCopyWithImpl( + _$MiraiPolygonImpl _value, $Res Function(_$MiraiPolygonImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? polygonId = null, + Object? consumeTapEvents = null, + Object? fillColor = freezed, + Object? geodesic = null, + Object? points = null, + Object? holes = null, + Object? strokeColor = freezed, + Object? strokeWidth = null, + Object? visible = null, + Object? zIndex = null, + Object? onTap = freezed, + }) { + return _then(_$MiraiPolygonImpl( + polygonId: null == polygonId + ? _value.polygonId + : polygonId // ignore: cast_nullable_to_non_nullable + as MiraiPolygonId, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + fillColor: freezed == fillColor + ? _value.fillColor + : fillColor // ignore: cast_nullable_to_non_nullable + as String?, + geodesic: null == geodesic + ? _value.geodesic + : geodesic // ignore: cast_nullable_to_non_nullable + as bool, + points: null == points + ? _value._points + : points // ignore: cast_nullable_to_non_nullable + as List, + holes: null == holes + ? _value._holes + : holes // ignore: cast_nullable_to_non_nullable + as List>, + strokeColor: freezed == strokeColor + ? _value.strokeColor + : strokeColor // ignore: cast_nullable_to_non_nullable + as String?, + strokeWidth: null == strokeWidth + ? _value.strokeWidth + : strokeWidth // ignore: cast_nullable_to_non_nullable + as int, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + onTap: freezed == onTap + ? _value._onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiPolygonImpl implements _MiraiPolygon { + const _$MiraiPolygonImpl( + {required this.polygonId, + this.consumeTapEvents = false, + this.fillColor, + this.geodesic = false, + final List points = const [], + final List> holes = const [], + this.strokeColor, + this.strokeWidth = 10, + this.visible = true, + this.zIndex = 0, + final Map? onTap}) + : _points = points, + _holes = holes, + _onTap = onTap; + + factory _$MiraiPolygonImpl.fromJson(Map json) => + _$$MiraiPolygonImplFromJson(json); + + @override + final MiraiPolygonId polygonId; + @override + @JsonKey() + final bool consumeTapEvents; + @override + final String? fillColor; + @override + @JsonKey() + final bool geodesic; + final List _points; + @override + @JsonKey() + List get points { + if (_points is EqualUnmodifiableListView) return _points; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_points); + } + + final List> _holes; + @override + @JsonKey() + List> get holes { + if (_holes is EqualUnmodifiableListView) return _holes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_holes); + } + + @override + final String? strokeColor; + @override + @JsonKey() + final int strokeWidth; + @override + @JsonKey() + final bool visible; + @override + @JsonKey() + final int zIndex; + final Map? _onTap; + @override + Map? get onTap { + final value = _onTap; + if (value == null) return null; + if (_onTap is EqualUnmodifiableMapView) return _onTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + String toString() { + return 'MiraiPolygon(polygonId: $polygonId, consumeTapEvents: $consumeTapEvents, fillColor: $fillColor, geodesic: $geodesic, points: $points, holes: $holes, strokeColor: $strokeColor, strokeWidth: $strokeWidth, visible: $visible, zIndex: $zIndex, onTap: $onTap)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiPolygonImpl && + (identical(other.polygonId, polygonId) || + other.polygonId == polygonId) && + (identical(other.consumeTapEvents, consumeTapEvents) || + other.consumeTapEvents == consumeTapEvents) && + (identical(other.fillColor, fillColor) || + other.fillColor == fillColor) && + (identical(other.geodesic, geodesic) || + other.geodesic == geodesic) && + const DeepCollectionEquality().equals(other._points, _points) && + const DeepCollectionEquality().equals(other._holes, _holes) && + (identical(other.strokeColor, strokeColor) || + other.strokeColor == strokeColor) && + (identical(other.strokeWidth, strokeWidth) || + other.strokeWidth == strokeWidth) && + (identical(other.visible, visible) || other.visible == visible) && + (identical(other.zIndex, zIndex) || other.zIndex == zIndex) && + const DeepCollectionEquality().equals(other._onTap, _onTap)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + polygonId, + consumeTapEvents, + fillColor, + geodesic, + const DeepCollectionEquality().hash(_points), + const DeepCollectionEquality().hash(_holes), + strokeColor, + strokeWidth, + visible, + zIndex, + const DeepCollectionEquality().hash(_onTap)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiPolygonImplCopyWith<_$MiraiPolygonImpl> get copyWith => + __$$MiraiPolygonImplCopyWithImpl<_$MiraiPolygonImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiPolygonImplToJson( + this, + ); + } +} + +abstract class _MiraiPolygon implements MiraiPolygon { + const factory _MiraiPolygon( + {required final MiraiPolygonId polygonId, + final bool consumeTapEvents, + final String? fillColor, + final bool geodesic, + final List points, + final List> holes, + final String? strokeColor, + final int strokeWidth, + final bool visible, + final int zIndex, + final Map? onTap}) = _$MiraiPolygonImpl; + + factory _MiraiPolygon.fromJson(Map json) = + _$MiraiPolygonImpl.fromJson; + + @override + MiraiPolygonId get polygonId; + @override + bool get consumeTapEvents; + @override + String? get fillColor; + @override + bool get geodesic; + @override + List get points; + @override + List> get holes; + @override + String? get strokeColor; + @override + int get strokeWidth; + @override + bool get visible; + @override + int get zIndex; + @override + Map? get onTap; + @override + @JsonKey(ignore: true) + _$$MiraiPolygonImplCopyWith<_$MiraiPolygonImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.g.dart new file mode 100644 index 00000000..83cc77c1 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polygon.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_polygon.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiPolygonIdImpl _$$MiraiPolygonIdImplFromJson(Map json) => + _$MiraiPolygonIdImpl( + json['value'] as String, + ); + +Map _$$MiraiPolygonIdImplToJson( + _$MiraiPolygonIdImpl instance) => + { + 'value': instance.value, + }; + +_$MiraiPolygonImpl _$$MiraiPolygonImplFromJson(Map json) => + _$MiraiPolygonImpl( + polygonId: + MiraiPolygonId.fromJson(json['polygonId'] as Map), + consumeTapEvents: json['consumeTapEvents'] as bool? ?? false, + fillColor: json['fillColor'] as String?, + geodesic: json['geodesic'] as bool? ?? false, + points: (json['points'] as List?) + ?.map((e) => MiraiLatLng.fromJson(e as Map)) + .toList() ?? + const [], + holes: (json['holes'] as List?) + ?.map((e) => (e as List) + .map((e) => MiraiLatLng.fromJson(e as Map)) + .toList()) + .toList() ?? + const [], + strokeColor: json['strokeColor'] as String?, + strokeWidth: json['strokeWidth'] as int? ?? 10, + visible: json['visible'] as bool? ?? true, + zIndex: json['zIndex'] as int? ?? 0, + onTap: json['onTap'] as Map?, + ); + +Map _$$MiraiPolygonImplToJson(_$MiraiPolygonImpl instance) => + { + 'polygonId': instance.polygonId, + 'consumeTapEvents': instance.consumeTapEvents, + 'fillColor': instance.fillColor, + 'geodesic': instance.geodesic, + 'points': instance.points, + 'holes': instance.holes, + 'strokeColor': instance.strokeColor, + 'strokeWidth': instance.strokeWidth, + 'visible': instance.visible, + 'zIndex': instance.zIndex, + 'onTap': instance.onTap, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.dart new file mode 100644 index 00000000..27469939 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mirai/src/utils/color_utils.dart'; +import 'mirai_google_map_ui.dart'; + +part 'mirai_google_map_polyline.freezed.dart'; +part 'mirai_google_map_polyline.g.dart'; + +@freezed +class MiraiPolylineId with _$MiraiPolylineId { + const factory MiraiPolylineId(String value) = _MiraiPolylineId; + + factory MiraiPolylineId.fromJson(Map json) => _$MiraiPolylineIdFromJson(json); +} + +@freezed +class MiraiPolyline with _$MiraiPolyline { + const factory MiraiPolyline({ + required MiraiPolylineId polylineId, + @Default(false) bool consumeTapEvents, + String? color, + // @Default(Cap.buttCap) Cap endCap, + @Default(false) bool geodesic, + @Default(JointType.mitered) JointType jointType, + @Default([]) List points, + // @Default([]) List patterns, + // @Default(Cap.buttCap) Cap startCap, + @Default(true) bool visible, + @Default(10) int width, + @Default(0) int zIndex, + Map? onTap, + }) = _MiraiPolyline; + + factory MiraiPolyline.fromJson(Map json) => _$MiraiPolylineFromJson(json); +} + +extension MiraiPolylineParser on MiraiPolyline { + Polyline parse( + BuildContext context, { + VoidCallback? onTap, + }) { + return Polyline( + polylineId: PolylineId(polylineId.value), + consumeTapEvents: consumeTapEvents, + color: color?.toColor(context) ?? Colors.black, + // endCap:endCap, + geodesic: geodesic, + jointType: jointType, + points: points.map((e) => e.parse).toList(), + // patterns: patterns, + // startCap: startCap, + visible: visible, + width: width, + zIndex: zIndex, + onTap: onTap, + ); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.freezed.dart new file mode 100644 index 00000000..11d66dab --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.freezed.dart @@ -0,0 +1,529 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_polyline.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiPolylineId _$MiraiPolylineIdFromJson(Map json) { + return _MiraiPolylineId.fromJson(json); +} + +/// @nodoc +mixin _$MiraiPolylineId { + String get value => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiPolylineIdCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiPolylineIdCopyWith<$Res> { + factory $MiraiPolylineIdCopyWith( + MiraiPolylineId value, $Res Function(MiraiPolylineId) then) = + _$MiraiPolylineIdCopyWithImpl<$Res, MiraiPolylineId>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class _$MiraiPolylineIdCopyWithImpl<$Res, $Val extends MiraiPolylineId> + implements $MiraiPolylineIdCopyWith<$Res> { + _$MiraiPolylineIdCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_value.copyWith( + value: null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiPolylineIdImplCopyWith<$Res> + implements $MiraiPolylineIdCopyWith<$Res> { + factory _$$MiraiPolylineIdImplCopyWith(_$MiraiPolylineIdImpl value, + $Res Function(_$MiraiPolylineIdImpl) then) = + __$$MiraiPolylineIdImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$MiraiPolylineIdImplCopyWithImpl<$Res> + extends _$MiraiPolylineIdCopyWithImpl<$Res, _$MiraiPolylineIdImpl> + implements _$$MiraiPolylineIdImplCopyWith<$Res> { + __$$MiraiPolylineIdImplCopyWithImpl( + _$MiraiPolylineIdImpl _value, $Res Function(_$MiraiPolylineIdImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$MiraiPolylineIdImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiPolylineIdImpl implements _MiraiPolylineId { + const _$MiraiPolylineIdImpl(this.value); + + factory _$MiraiPolylineIdImpl.fromJson(Map json) => + _$$MiraiPolylineIdImplFromJson(json); + + @override + final String value; + + @override + String toString() { + return 'MiraiPolylineId(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiPolylineIdImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, value); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiPolylineIdImplCopyWith<_$MiraiPolylineIdImpl> get copyWith => + __$$MiraiPolylineIdImplCopyWithImpl<_$MiraiPolylineIdImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiPolylineIdImplToJson( + this, + ); + } +} + +abstract class _MiraiPolylineId implements MiraiPolylineId { + const factory _MiraiPolylineId(final String value) = _$MiraiPolylineIdImpl; + + factory _MiraiPolylineId.fromJson(Map json) = + _$MiraiPolylineIdImpl.fromJson; + + @override + String get value; + @override + @JsonKey(ignore: true) + _$$MiraiPolylineIdImplCopyWith<_$MiraiPolylineIdImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiPolyline _$MiraiPolylineFromJson(Map json) { + return _MiraiPolyline.fromJson(json); +} + +/// @nodoc +mixin _$MiraiPolyline { + MiraiPolylineId get polylineId => throw _privateConstructorUsedError; + bool get consumeTapEvents => throw _privateConstructorUsedError; + String? get color => + throw _privateConstructorUsedError; // @Default(Cap.buttCap) Cap endCap, + bool get geodesic => throw _privateConstructorUsedError; + JointType get jointType => throw _privateConstructorUsedError; + List get points => + throw _privateConstructorUsedError; // @Default([]) List patterns, +// @Default(Cap.buttCap) Cap startCap, + bool get visible => throw _privateConstructorUsedError; + int get width => throw _privateConstructorUsedError; + int get zIndex => throw _privateConstructorUsedError; + Map? get onTap => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiPolylineCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiPolylineCopyWith<$Res> { + factory $MiraiPolylineCopyWith( + MiraiPolyline value, $Res Function(MiraiPolyline) then) = + _$MiraiPolylineCopyWithImpl<$Res, MiraiPolyline>; + @useResult + $Res call( + {MiraiPolylineId polylineId, + bool consumeTapEvents, + String? color, + bool geodesic, + JointType jointType, + List points, + bool visible, + int width, + int zIndex, + Map? onTap}); + + $MiraiPolylineIdCopyWith<$Res> get polylineId; +} + +/// @nodoc +class _$MiraiPolylineCopyWithImpl<$Res, $Val extends MiraiPolyline> + implements $MiraiPolylineCopyWith<$Res> { + _$MiraiPolylineCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? polylineId = null, + Object? consumeTapEvents = null, + Object? color = freezed, + Object? geodesic = null, + Object? jointType = null, + Object? points = null, + Object? visible = null, + Object? width = null, + Object? zIndex = null, + Object? onTap = freezed, + }) { + return _then(_value.copyWith( + polylineId: null == polylineId + ? _value.polylineId + : polylineId // ignore: cast_nullable_to_non_nullable + as MiraiPolylineId, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + color: freezed == color + ? _value.color + : color // ignore: cast_nullable_to_non_nullable + as String?, + geodesic: null == geodesic + ? _value.geodesic + : geodesic // ignore: cast_nullable_to_non_nullable + as bool, + jointType: null == jointType + ? _value.jointType + : jointType // ignore: cast_nullable_to_non_nullable + as JointType, + points: null == points + ? _value.points + : points // ignore: cast_nullable_to_non_nullable + as List, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + width: null == width + ? _value.width + : width // ignore: cast_nullable_to_non_nullable + as int, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + onTap: freezed == onTap + ? _value.onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiPolylineIdCopyWith<$Res> get polylineId { + return $MiraiPolylineIdCopyWith<$Res>(_value.polylineId, (value) { + return _then(_value.copyWith(polylineId: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiPolylineImplCopyWith<$Res> + implements $MiraiPolylineCopyWith<$Res> { + factory _$$MiraiPolylineImplCopyWith( + _$MiraiPolylineImpl value, $Res Function(_$MiraiPolylineImpl) then) = + __$$MiraiPolylineImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {MiraiPolylineId polylineId, + bool consumeTapEvents, + String? color, + bool geodesic, + JointType jointType, + List points, + bool visible, + int width, + int zIndex, + Map? onTap}); + + @override + $MiraiPolylineIdCopyWith<$Res> get polylineId; +} + +/// @nodoc +class __$$MiraiPolylineImplCopyWithImpl<$Res> + extends _$MiraiPolylineCopyWithImpl<$Res, _$MiraiPolylineImpl> + implements _$$MiraiPolylineImplCopyWith<$Res> { + __$$MiraiPolylineImplCopyWithImpl( + _$MiraiPolylineImpl _value, $Res Function(_$MiraiPolylineImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? polylineId = null, + Object? consumeTapEvents = null, + Object? color = freezed, + Object? geodesic = null, + Object? jointType = null, + Object? points = null, + Object? visible = null, + Object? width = null, + Object? zIndex = null, + Object? onTap = freezed, + }) { + return _then(_$MiraiPolylineImpl( + polylineId: null == polylineId + ? _value.polylineId + : polylineId // ignore: cast_nullable_to_non_nullable + as MiraiPolylineId, + consumeTapEvents: null == consumeTapEvents + ? _value.consumeTapEvents + : consumeTapEvents // ignore: cast_nullable_to_non_nullable + as bool, + color: freezed == color + ? _value.color + : color // ignore: cast_nullable_to_non_nullable + as String?, + geodesic: null == geodesic + ? _value.geodesic + : geodesic // ignore: cast_nullable_to_non_nullable + as bool, + jointType: null == jointType + ? _value.jointType + : jointType // ignore: cast_nullable_to_non_nullable + as JointType, + points: null == points + ? _value._points + : points // ignore: cast_nullable_to_non_nullable + as List, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + width: null == width + ? _value.width + : width // ignore: cast_nullable_to_non_nullable + as int, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + onTap: freezed == onTap + ? _value._onTap + : onTap // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiPolylineImpl implements _MiraiPolyline { + const _$MiraiPolylineImpl( + {required this.polylineId, + this.consumeTapEvents = false, + this.color, + this.geodesic = false, + this.jointType = JointType.mitered, + final List points = const [], + this.visible = true, + this.width = 10, + this.zIndex = 0, + final Map? onTap}) + : _points = points, + _onTap = onTap; + + factory _$MiraiPolylineImpl.fromJson(Map json) => + _$$MiraiPolylineImplFromJson(json); + + @override + final MiraiPolylineId polylineId; + @override + @JsonKey() + final bool consumeTapEvents; + @override + final String? color; +// @Default(Cap.buttCap) Cap endCap, + @override + @JsonKey() + final bool geodesic; + @override + @JsonKey() + final JointType jointType; + final List _points; + @override + @JsonKey() + List get points { + if (_points is EqualUnmodifiableListView) return _points; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_points); + } + +// @Default([]) List patterns, +// @Default(Cap.buttCap) Cap startCap, + @override + @JsonKey() + final bool visible; + @override + @JsonKey() + final int width; + @override + @JsonKey() + final int zIndex; + final Map? _onTap; + @override + Map? get onTap { + final value = _onTap; + if (value == null) return null; + if (_onTap is EqualUnmodifiableMapView) return _onTap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @override + String toString() { + return 'MiraiPolyline(polylineId: $polylineId, consumeTapEvents: $consumeTapEvents, color: $color, geodesic: $geodesic, jointType: $jointType, points: $points, visible: $visible, width: $width, zIndex: $zIndex, onTap: $onTap)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiPolylineImpl && + (identical(other.polylineId, polylineId) || + other.polylineId == polylineId) && + (identical(other.consumeTapEvents, consumeTapEvents) || + other.consumeTapEvents == consumeTapEvents) && + (identical(other.color, color) || other.color == color) && + (identical(other.geodesic, geodesic) || + other.geodesic == geodesic) && + (identical(other.jointType, jointType) || + other.jointType == jointType) && + const DeepCollectionEquality().equals(other._points, _points) && + (identical(other.visible, visible) || other.visible == visible) && + (identical(other.width, width) || other.width == width) && + (identical(other.zIndex, zIndex) || other.zIndex == zIndex) && + const DeepCollectionEquality().equals(other._onTap, _onTap)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + polylineId, + consumeTapEvents, + color, + geodesic, + jointType, + const DeepCollectionEquality().hash(_points), + visible, + width, + zIndex, + const DeepCollectionEquality().hash(_onTap)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiPolylineImplCopyWith<_$MiraiPolylineImpl> get copyWith => + __$$MiraiPolylineImplCopyWithImpl<_$MiraiPolylineImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiPolylineImplToJson( + this, + ); + } +} + +abstract class _MiraiPolyline implements MiraiPolyline { + const factory _MiraiPolyline( + {required final MiraiPolylineId polylineId, + final bool consumeTapEvents, + final String? color, + final bool geodesic, + final JointType jointType, + final List points, + final bool visible, + final int width, + final int zIndex, + final Map? onTap}) = _$MiraiPolylineImpl; + + factory _MiraiPolyline.fromJson(Map json) = + _$MiraiPolylineImpl.fromJson; + + @override + MiraiPolylineId get polylineId; + @override + bool get consumeTapEvents; + @override + String? get color; + @override // @Default(Cap.buttCap) Cap endCap, + bool get geodesic; + @override + JointType get jointType; + @override + List get points; + @override // @Default([]) List patterns, +// @Default(Cap.buttCap) Cap startCap, + bool get visible; + @override + int get width; + @override + int get zIndex; + @override + Map? get onTap; + @override + @JsonKey(ignore: true) + _$$MiraiPolylineImplCopyWith<_$MiraiPolylineImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.g.dart new file mode 100644 index 00000000..dd210448 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_polyline.g.dart @@ -0,0 +1,58 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_polyline.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiPolylineIdImpl _$$MiraiPolylineIdImplFromJson( + Map json) => + _$MiraiPolylineIdImpl( + json['value'] as String, + ); + +Map _$$MiraiPolylineIdImplToJson( + _$MiraiPolylineIdImpl instance) => + { + 'value': instance.value, + }; + +_$MiraiPolylineImpl _$$MiraiPolylineImplFromJson(Map json) => + _$MiraiPolylineImpl( + polylineId: + MiraiPolylineId.fromJson(json['polylineId'] as Map), + consumeTapEvents: json['consumeTapEvents'] as bool? ?? false, + color: json['color'] as String?, + geodesic: json['geodesic'] as bool? ?? false, + jointType: $enumDecodeNullable(_$JointTypeEnumMap, json['jointType']) ?? + JointType.mitered, + points: (json['points'] as List?) + ?.map((e) => MiraiLatLng.fromJson(e as Map)) + .toList() ?? + const [], + visible: json['visible'] as bool? ?? true, + width: json['width'] as int? ?? 10, + zIndex: json['zIndex'] as int? ?? 0, + onTap: json['onTap'] as Map?, + ); + +Map _$$MiraiPolylineImplToJson(_$MiraiPolylineImpl instance) => + { + 'polylineId': instance.polylineId, + 'consumeTapEvents': instance.consumeTapEvents, + 'color': instance.color, + 'geodesic': instance.geodesic, + 'jointType': _$JointTypeEnumMap[instance.jointType]!, + 'points': instance.points, + 'visible': instance.visible, + 'width': instance.width, + 'zIndex': instance.zIndex, + 'onTap': instance.onTap, + }; + +const _$JointTypeEnumMap = { + JointType.mitered: 'mitered', + JointType.bevel: 'bevel', + JointType.round: 'round', +}; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.dart new file mode 100644 index 00000000..a0ccff00 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.dart @@ -0,0 +1,45 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +part 'mirai_google_map_tile_overlay.freezed.dart'; +part 'mirai_google_map_tile_overlay.g.dart'; + +@freezed +class MiraiTileOverlayId with _$MiraiTileOverlayId { + const factory MiraiTileOverlayId(String value) = _MiraiTileOverlayId; + + factory MiraiTileOverlayId.fromJson(Map json) => + _$MiraiTileOverlayIdFromJson(json); +} + +@freezed +class MiraiTileOverlay with _$MiraiTileOverlay { + @Assert('transparency >= 0.0 && transparency <= 1.0') + const factory MiraiTileOverlay({ + required MiraiTileOverlayId tileOverlayId, + @Default(true) bool fadeIn, + // TileProvider? tileProvider, + @Default(0.0) double transparency, + @Default(0) int zIndex, + @Default(true) bool visible, + @Default(256) int tileSize, + }) = _MiraiTileOverlay; + + factory MiraiTileOverlay.fromJson(Map json) => _$MiraiTileOverlayFromJson(json); + + // MiraiTileOverlayId get mapsId => tileOverlayId; +} + +extension MiraiTileOverlayParser on MiraiTileOverlay { + TileOverlay get parse { + return TileOverlay( + tileOverlayId: TileOverlayId(tileOverlayId.value), + fadeIn: fadeIn, + // tileProvider: tileProvider.parse, + transparency: transparency, + zIndex: zIndex, + visible: visible, + tileSize: tileSize, + ); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.freezed.dart new file mode 100644 index 00000000..2615f4e0 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.freezed.dart @@ -0,0 +1,419 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_tile_overlay.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiTileOverlayId _$MiraiTileOverlayIdFromJson(Map json) { + return _MiraiTileOverlayId.fromJson(json); +} + +/// @nodoc +mixin _$MiraiTileOverlayId { + String get value => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiTileOverlayIdCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiTileOverlayIdCopyWith<$Res> { + factory $MiraiTileOverlayIdCopyWith( + MiraiTileOverlayId value, $Res Function(MiraiTileOverlayId) then) = + _$MiraiTileOverlayIdCopyWithImpl<$Res, MiraiTileOverlayId>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class _$MiraiTileOverlayIdCopyWithImpl<$Res, $Val extends MiraiTileOverlayId> + implements $MiraiTileOverlayIdCopyWith<$Res> { + _$MiraiTileOverlayIdCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_value.copyWith( + value: null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiTileOverlayIdImplCopyWith<$Res> + implements $MiraiTileOverlayIdCopyWith<$Res> { + factory _$$MiraiTileOverlayIdImplCopyWith(_$MiraiTileOverlayIdImpl value, + $Res Function(_$MiraiTileOverlayIdImpl) then) = + __$$MiraiTileOverlayIdImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$MiraiTileOverlayIdImplCopyWithImpl<$Res> + extends _$MiraiTileOverlayIdCopyWithImpl<$Res, _$MiraiTileOverlayIdImpl> + implements _$$MiraiTileOverlayIdImplCopyWith<$Res> { + __$$MiraiTileOverlayIdImplCopyWithImpl(_$MiraiTileOverlayIdImpl _value, + $Res Function(_$MiraiTileOverlayIdImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$MiraiTileOverlayIdImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiTileOverlayIdImpl implements _MiraiTileOverlayId { + const _$MiraiTileOverlayIdImpl(this.value); + + factory _$MiraiTileOverlayIdImpl.fromJson(Map json) => + _$$MiraiTileOverlayIdImplFromJson(json); + + @override + final String value; + + @override + String toString() { + return 'MiraiTileOverlayId(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiTileOverlayIdImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, value); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiTileOverlayIdImplCopyWith<_$MiraiTileOverlayIdImpl> get copyWith => + __$$MiraiTileOverlayIdImplCopyWithImpl<_$MiraiTileOverlayIdImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiTileOverlayIdImplToJson( + this, + ); + } +} + +abstract class _MiraiTileOverlayId implements MiraiTileOverlayId { + const factory _MiraiTileOverlayId(final String value) = + _$MiraiTileOverlayIdImpl; + + factory _MiraiTileOverlayId.fromJson(Map json) = + _$MiraiTileOverlayIdImpl.fromJson; + + @override + String get value; + @override + @JsonKey(ignore: true) + _$$MiraiTileOverlayIdImplCopyWith<_$MiraiTileOverlayIdImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiTileOverlay _$MiraiTileOverlayFromJson(Map json) { + return _MiraiTileOverlay.fromJson(json); +} + +/// @nodoc +mixin _$MiraiTileOverlay { + MiraiTileOverlayId get tileOverlayId => throw _privateConstructorUsedError; + bool get fadeIn => + throw _privateConstructorUsedError; // TileProvider? tileProvider, + double get transparency => throw _privateConstructorUsedError; + int get zIndex => throw _privateConstructorUsedError; + bool get visible => throw _privateConstructorUsedError; + int get tileSize => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiTileOverlayCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiTileOverlayCopyWith<$Res> { + factory $MiraiTileOverlayCopyWith( + MiraiTileOverlay value, $Res Function(MiraiTileOverlay) then) = + _$MiraiTileOverlayCopyWithImpl<$Res, MiraiTileOverlay>; + @useResult + $Res call( + {MiraiTileOverlayId tileOverlayId, + bool fadeIn, + double transparency, + int zIndex, + bool visible, + int tileSize}); + + $MiraiTileOverlayIdCopyWith<$Res> get tileOverlayId; +} + +/// @nodoc +class _$MiraiTileOverlayCopyWithImpl<$Res, $Val extends MiraiTileOverlay> + implements $MiraiTileOverlayCopyWith<$Res> { + _$MiraiTileOverlayCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? tileOverlayId = null, + Object? fadeIn = null, + Object? transparency = null, + Object? zIndex = null, + Object? visible = null, + Object? tileSize = null, + }) { + return _then(_value.copyWith( + tileOverlayId: null == tileOverlayId + ? _value.tileOverlayId + : tileOverlayId // ignore: cast_nullable_to_non_nullable + as MiraiTileOverlayId, + fadeIn: null == fadeIn + ? _value.fadeIn + : fadeIn // ignore: cast_nullable_to_non_nullable + as bool, + transparency: null == transparency + ? _value.transparency + : transparency // ignore: cast_nullable_to_non_nullable + as double, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + tileSize: null == tileSize + ? _value.tileSize + : tileSize // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiTileOverlayIdCopyWith<$Res> get tileOverlayId { + return $MiraiTileOverlayIdCopyWith<$Res>(_value.tileOverlayId, (value) { + return _then(_value.copyWith(tileOverlayId: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiTileOverlayImplCopyWith<$Res> + implements $MiraiTileOverlayCopyWith<$Res> { + factory _$$MiraiTileOverlayImplCopyWith(_$MiraiTileOverlayImpl value, + $Res Function(_$MiraiTileOverlayImpl) then) = + __$$MiraiTileOverlayImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {MiraiTileOverlayId tileOverlayId, + bool fadeIn, + double transparency, + int zIndex, + bool visible, + int tileSize}); + + @override + $MiraiTileOverlayIdCopyWith<$Res> get tileOverlayId; +} + +/// @nodoc +class __$$MiraiTileOverlayImplCopyWithImpl<$Res> + extends _$MiraiTileOverlayCopyWithImpl<$Res, _$MiraiTileOverlayImpl> + implements _$$MiraiTileOverlayImplCopyWith<$Res> { + __$$MiraiTileOverlayImplCopyWithImpl(_$MiraiTileOverlayImpl _value, + $Res Function(_$MiraiTileOverlayImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? tileOverlayId = null, + Object? fadeIn = null, + Object? transparency = null, + Object? zIndex = null, + Object? visible = null, + Object? tileSize = null, + }) { + return _then(_$MiraiTileOverlayImpl( + tileOverlayId: null == tileOverlayId + ? _value.tileOverlayId + : tileOverlayId // ignore: cast_nullable_to_non_nullable + as MiraiTileOverlayId, + fadeIn: null == fadeIn + ? _value.fadeIn + : fadeIn // ignore: cast_nullable_to_non_nullable + as bool, + transparency: null == transparency + ? _value.transparency + : transparency // ignore: cast_nullable_to_non_nullable + as double, + zIndex: null == zIndex + ? _value.zIndex + : zIndex // ignore: cast_nullable_to_non_nullable + as int, + visible: null == visible + ? _value.visible + : visible // ignore: cast_nullable_to_non_nullable + as bool, + tileSize: null == tileSize + ? _value.tileSize + : tileSize // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiTileOverlayImpl implements _MiraiTileOverlay { + const _$MiraiTileOverlayImpl( + {required this.tileOverlayId, + this.fadeIn = true, + this.transparency = 0.0, + this.zIndex = 0, + this.visible = true, + this.tileSize = 256}) + : assert(transparency >= 0.0 && transparency <= 1.0); + + factory _$MiraiTileOverlayImpl.fromJson(Map json) => + _$$MiraiTileOverlayImplFromJson(json); + + @override + final MiraiTileOverlayId tileOverlayId; + @override + @JsonKey() + final bool fadeIn; +// TileProvider? tileProvider, + @override + @JsonKey() + final double transparency; + @override + @JsonKey() + final int zIndex; + @override + @JsonKey() + final bool visible; + @override + @JsonKey() + final int tileSize; + + @override + String toString() { + return 'MiraiTileOverlay(tileOverlayId: $tileOverlayId, fadeIn: $fadeIn, transparency: $transparency, zIndex: $zIndex, visible: $visible, tileSize: $tileSize)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiTileOverlayImpl && + (identical(other.tileOverlayId, tileOverlayId) || + other.tileOverlayId == tileOverlayId) && + (identical(other.fadeIn, fadeIn) || other.fadeIn == fadeIn) && + (identical(other.transparency, transparency) || + other.transparency == transparency) && + (identical(other.zIndex, zIndex) || other.zIndex == zIndex) && + (identical(other.visible, visible) || other.visible == visible) && + (identical(other.tileSize, tileSize) || + other.tileSize == tileSize)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, tileOverlayId, fadeIn, + transparency, zIndex, visible, tileSize); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiTileOverlayImplCopyWith<_$MiraiTileOverlayImpl> get copyWith => + __$$MiraiTileOverlayImplCopyWithImpl<_$MiraiTileOverlayImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiTileOverlayImplToJson( + this, + ); + } +} + +abstract class _MiraiTileOverlay implements MiraiTileOverlay { + const factory _MiraiTileOverlay( + {required final MiraiTileOverlayId tileOverlayId, + final bool fadeIn, + final double transparency, + final int zIndex, + final bool visible, + final int tileSize}) = _$MiraiTileOverlayImpl; + + factory _MiraiTileOverlay.fromJson(Map json) = + _$MiraiTileOverlayImpl.fromJson; + + @override + MiraiTileOverlayId get tileOverlayId; + @override + bool get fadeIn; + @override // TileProvider? tileProvider, + double get transparency; + @override + int get zIndex; + @override + bool get visible; + @override + int get tileSize; + @override + @JsonKey(ignore: true) + _$$MiraiTileOverlayImplCopyWith<_$MiraiTileOverlayImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.g.dart new file mode 100644 index 00000000..4c14c7f0 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_tile_overlay.g.dart @@ -0,0 +1,42 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_tile_overlay.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiTileOverlayIdImpl _$$MiraiTileOverlayIdImplFromJson( + Map json) => + _$MiraiTileOverlayIdImpl( + json['value'] as String, + ); + +Map _$$MiraiTileOverlayIdImplToJson( + _$MiraiTileOverlayIdImpl instance) => + { + 'value': instance.value, + }; + +_$MiraiTileOverlayImpl _$$MiraiTileOverlayImplFromJson( + Map json) => + _$MiraiTileOverlayImpl( + tileOverlayId: MiraiTileOverlayId.fromJson( + json['tileOverlayId'] as Map), + fadeIn: json['fadeIn'] as bool? ?? true, + transparency: (json['transparency'] as num?)?.toDouble() ?? 0.0, + zIndex: json['zIndex'] as int? ?? 0, + visible: json['visible'] as bool? ?? true, + tileSize: json['tileSize'] as int? ?? 256, + ); + +Map _$$MiraiTileOverlayImplToJson( + _$MiraiTileOverlayImpl instance) => + { + 'tileOverlayId': instance.tileOverlayId, + 'fadeIn': instance.fadeIn, + 'transparency': instance.transparency, + 'zIndex': instance.zIndex, + 'visible': instance.visible, + 'tileSize': instance.tileSize, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.dart new file mode 100644 index 00000000..ef710784 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.dart @@ -0,0 +1,91 @@ +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'mirai_google_map_ui.freezed.dart'; +part 'mirai_google_map_ui.g.dart'; + +enum MiraiGoogleMapType { + none, + normal, + satellite, + terrain, + hybrid; + + MapType get value { + return switch (this) { + // /// Normal tiles (traffic and labels, subtle terrain information). + MiraiGoogleMapType.normal => MapType.normal, + // /// Satellite imaging tiles (aerial photos) + MiraiGoogleMapType.satellite => MapType.satellite, + // /// Terrain tiles (indicates type and height of terrain) + MiraiGoogleMapType.terrain => MapType.terrain, + // /// Hybrid tiles (satellite images with some labels/overlays) + MiraiGoogleMapType.hybrid => MapType.hybrid, + // /// Do not display map tiles. + _ => MapType.none + }; + } +} + +@freezed +class MiraiCameraTargetBounds with _$MiraiCameraTargetBounds { + const factory MiraiCameraTargetBounds(MiraiLatLngBounds? bounds) = _MiraiCameraTargetBounds; + + factory MiraiCameraTargetBounds.fromJson(Map json) => + _$MiraiCameraTargetBoundsFromJson(json); + + static const MiraiCameraTargetBounds unbounded = MiraiCameraTargetBounds(null); +} + +extension MiraiCameraTargetBoundsParser on MiraiCameraTargetBounds { + CameraTargetBounds get parse => CameraTargetBounds(LatLngBounds( + southwest: bounds!.southwest.parse, + northeast: bounds!.northeast.parse, + )); +} + +@freezed +class MiraiLatLngBounds with _$MiraiLatLngBounds { + const factory MiraiLatLngBounds({ + required MiraiLatLng southwest, + required MiraiLatLng northeast, + }) = _MiraiLatLngBounds; + + factory MiraiLatLngBounds.fromJson(Map json) => + _$MiraiLatLngBoundsFromJson(json); +} + +@freezed +class MiraiLatLng with _$MiraiLatLng { + const factory MiraiLatLng(double latitude, double longitude) = _MiraiLatLng; + + factory MiraiLatLng.fromJson(Map json) => _$MiraiLatLngFromJson(json); +} + +@freezed +class MiraiMinMaxZoomPreference with _$MiraiMinMaxZoomPreference { + const factory MiraiMinMaxZoomPreference(double? minZoom, double? maxZoom) = + _MiraiMinMaxZoomPreference; + + factory MiraiMinMaxZoomPreference.fromJson(Map json) => + _$MiraiMinMaxZoomPreferenceFromJson(json); + + static const MiraiMinMaxZoomPreference unbounded = MiraiMinMaxZoomPreference(null, null); +} + +@freezed +class MiraiMapStyleException with _$MiraiMapStyleException { + const factory MiraiMapStyleException(String cause) = _MiraiMapStyleException; +} + +extension MiraiMinMaxZoomPreferenceParser on MiraiMinMaxZoomPreference? { + MinMaxZoomPreference get parse { + return MinMaxZoomPreference(9, 25); + } +} + +extension MiraiLatLngParser on MiraiLatLng { + LatLng get parse { + return LatLng(latitude ?? 0, longitude ?? 0); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.freezed.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.freezed.dart new file mode 100644 index 00000000..5c446668 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.freezed.dart @@ -0,0 +1,795 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_google_map_ui.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +MiraiCameraTargetBounds _$MiraiCameraTargetBoundsFromJson( + Map json) { + return _MiraiCameraTargetBounds.fromJson(json); +} + +/// @nodoc +mixin _$MiraiCameraTargetBounds { + MiraiLatLngBounds? get bounds => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiCameraTargetBoundsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiCameraTargetBoundsCopyWith<$Res> { + factory $MiraiCameraTargetBoundsCopyWith(MiraiCameraTargetBounds value, + $Res Function(MiraiCameraTargetBounds) then) = + _$MiraiCameraTargetBoundsCopyWithImpl<$Res, MiraiCameraTargetBounds>; + @useResult + $Res call({MiraiLatLngBounds? bounds}); + + $MiraiLatLngBoundsCopyWith<$Res>? get bounds; +} + +/// @nodoc +class _$MiraiCameraTargetBoundsCopyWithImpl<$Res, + $Val extends MiraiCameraTargetBounds> + implements $MiraiCameraTargetBoundsCopyWith<$Res> { + _$MiraiCameraTargetBoundsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bounds = freezed, + }) { + return _then(_value.copyWith( + bounds: freezed == bounds + ? _value.bounds + : bounds // ignore: cast_nullable_to_non_nullable + as MiraiLatLngBounds?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiLatLngBoundsCopyWith<$Res>? get bounds { + if (_value.bounds == null) { + return null; + } + + return $MiraiLatLngBoundsCopyWith<$Res>(_value.bounds!, (value) { + return _then(_value.copyWith(bounds: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiCameraTargetBoundsImplCopyWith<$Res> + implements $MiraiCameraTargetBoundsCopyWith<$Res> { + factory _$$MiraiCameraTargetBoundsImplCopyWith( + _$MiraiCameraTargetBoundsImpl value, + $Res Function(_$MiraiCameraTargetBoundsImpl) then) = + __$$MiraiCameraTargetBoundsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({MiraiLatLngBounds? bounds}); + + @override + $MiraiLatLngBoundsCopyWith<$Res>? get bounds; +} + +/// @nodoc +class __$$MiraiCameraTargetBoundsImplCopyWithImpl<$Res> + extends _$MiraiCameraTargetBoundsCopyWithImpl<$Res, + _$MiraiCameraTargetBoundsImpl> + implements _$$MiraiCameraTargetBoundsImplCopyWith<$Res> { + __$$MiraiCameraTargetBoundsImplCopyWithImpl( + _$MiraiCameraTargetBoundsImpl _value, + $Res Function(_$MiraiCameraTargetBoundsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bounds = freezed, + }) { + return _then(_$MiraiCameraTargetBoundsImpl( + freezed == bounds + ? _value.bounds + : bounds // ignore: cast_nullable_to_non_nullable + as MiraiLatLngBounds?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiCameraTargetBoundsImpl implements _MiraiCameraTargetBounds { + const _$MiraiCameraTargetBoundsImpl(this.bounds); + + factory _$MiraiCameraTargetBoundsImpl.fromJson(Map json) => + _$$MiraiCameraTargetBoundsImplFromJson(json); + + @override + final MiraiLatLngBounds? bounds; + + @override + String toString() { + return 'MiraiCameraTargetBounds(bounds: $bounds)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiCameraTargetBoundsImpl && + (identical(other.bounds, bounds) || other.bounds == bounds)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, bounds); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiCameraTargetBoundsImplCopyWith<_$MiraiCameraTargetBoundsImpl> + get copyWith => __$$MiraiCameraTargetBoundsImplCopyWithImpl< + _$MiraiCameraTargetBoundsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiCameraTargetBoundsImplToJson( + this, + ); + } +} + +abstract class _MiraiCameraTargetBounds implements MiraiCameraTargetBounds { + const factory _MiraiCameraTargetBounds(final MiraiLatLngBounds? bounds) = + _$MiraiCameraTargetBoundsImpl; + + factory _MiraiCameraTargetBounds.fromJson(Map json) = + _$MiraiCameraTargetBoundsImpl.fromJson; + + @override + MiraiLatLngBounds? get bounds; + @override + @JsonKey(ignore: true) + _$$MiraiCameraTargetBoundsImplCopyWith<_$MiraiCameraTargetBoundsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +MiraiLatLngBounds _$MiraiLatLngBoundsFromJson(Map json) { + return _MiraiLatLngBounds.fromJson(json); +} + +/// @nodoc +mixin _$MiraiLatLngBounds { + MiraiLatLng get southwest => throw _privateConstructorUsedError; + MiraiLatLng get northeast => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiLatLngBoundsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiLatLngBoundsCopyWith<$Res> { + factory $MiraiLatLngBoundsCopyWith( + MiraiLatLngBounds value, $Res Function(MiraiLatLngBounds) then) = + _$MiraiLatLngBoundsCopyWithImpl<$Res, MiraiLatLngBounds>; + @useResult + $Res call({MiraiLatLng southwest, MiraiLatLng northeast}); + + $MiraiLatLngCopyWith<$Res> get southwest; + $MiraiLatLngCopyWith<$Res> get northeast; +} + +/// @nodoc +class _$MiraiLatLngBoundsCopyWithImpl<$Res, $Val extends MiraiLatLngBounds> + implements $MiraiLatLngBoundsCopyWith<$Res> { + _$MiraiLatLngBoundsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? southwest = null, + Object? northeast = null, + }) { + return _then(_value.copyWith( + southwest: null == southwest + ? _value.southwest + : southwest // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + northeast: null == northeast + ? _value.northeast + : northeast // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiLatLngCopyWith<$Res> get southwest { + return $MiraiLatLngCopyWith<$Res>(_value.southwest, (value) { + return _then(_value.copyWith(southwest: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiraiLatLngCopyWith<$Res> get northeast { + return $MiraiLatLngCopyWith<$Res>(_value.northeast, (value) { + return _then(_value.copyWith(northeast: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$MiraiLatLngBoundsImplCopyWith<$Res> + implements $MiraiLatLngBoundsCopyWith<$Res> { + factory _$$MiraiLatLngBoundsImplCopyWith(_$MiraiLatLngBoundsImpl value, + $Res Function(_$MiraiLatLngBoundsImpl) then) = + __$$MiraiLatLngBoundsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({MiraiLatLng southwest, MiraiLatLng northeast}); + + @override + $MiraiLatLngCopyWith<$Res> get southwest; + @override + $MiraiLatLngCopyWith<$Res> get northeast; +} + +/// @nodoc +class __$$MiraiLatLngBoundsImplCopyWithImpl<$Res> + extends _$MiraiLatLngBoundsCopyWithImpl<$Res, _$MiraiLatLngBoundsImpl> + implements _$$MiraiLatLngBoundsImplCopyWith<$Res> { + __$$MiraiLatLngBoundsImplCopyWithImpl(_$MiraiLatLngBoundsImpl _value, + $Res Function(_$MiraiLatLngBoundsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? southwest = null, + Object? northeast = null, + }) { + return _then(_$MiraiLatLngBoundsImpl( + southwest: null == southwest + ? _value.southwest + : southwest // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + northeast: null == northeast + ? _value.northeast + : northeast // ignore: cast_nullable_to_non_nullable + as MiraiLatLng, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiLatLngBoundsImpl implements _MiraiLatLngBounds { + const _$MiraiLatLngBoundsImpl( + {required this.southwest, required this.northeast}); + + factory _$MiraiLatLngBoundsImpl.fromJson(Map json) => + _$$MiraiLatLngBoundsImplFromJson(json); + + @override + final MiraiLatLng southwest; + @override + final MiraiLatLng northeast; + + @override + String toString() { + return 'MiraiLatLngBounds(southwest: $southwest, northeast: $northeast)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiLatLngBoundsImpl && + (identical(other.southwest, southwest) || + other.southwest == southwest) && + (identical(other.northeast, northeast) || + other.northeast == northeast)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, southwest, northeast); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiLatLngBoundsImplCopyWith<_$MiraiLatLngBoundsImpl> get copyWith => + __$$MiraiLatLngBoundsImplCopyWithImpl<_$MiraiLatLngBoundsImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$MiraiLatLngBoundsImplToJson( + this, + ); + } +} + +abstract class _MiraiLatLngBounds implements MiraiLatLngBounds { + const factory _MiraiLatLngBounds( + {required final MiraiLatLng southwest, + required final MiraiLatLng northeast}) = _$MiraiLatLngBoundsImpl; + + factory _MiraiLatLngBounds.fromJson(Map json) = + _$MiraiLatLngBoundsImpl.fromJson; + + @override + MiraiLatLng get southwest; + @override + MiraiLatLng get northeast; + @override + @JsonKey(ignore: true) + _$$MiraiLatLngBoundsImplCopyWith<_$MiraiLatLngBoundsImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiLatLng _$MiraiLatLngFromJson(Map json) { + return _MiraiLatLng.fromJson(json); +} + +/// @nodoc +mixin _$MiraiLatLng { + double get latitude => throw _privateConstructorUsedError; + double get longitude => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiLatLngCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiLatLngCopyWith<$Res> { + factory $MiraiLatLngCopyWith( + MiraiLatLng value, $Res Function(MiraiLatLng) then) = + _$MiraiLatLngCopyWithImpl<$Res, MiraiLatLng>; + @useResult + $Res call({double latitude, double longitude}); +} + +/// @nodoc +class _$MiraiLatLngCopyWithImpl<$Res, $Val extends MiraiLatLng> + implements $MiraiLatLngCopyWith<$Res> { + _$MiraiLatLngCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? latitude = null, + Object? longitude = null, + }) { + return _then(_value.copyWith( + latitude: null == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + longitude: null == longitude + ? _value.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiLatLngImplCopyWith<$Res> + implements $MiraiLatLngCopyWith<$Res> { + factory _$$MiraiLatLngImplCopyWith( + _$MiraiLatLngImpl value, $Res Function(_$MiraiLatLngImpl) then) = + __$$MiraiLatLngImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({double latitude, double longitude}); +} + +/// @nodoc +class __$$MiraiLatLngImplCopyWithImpl<$Res> + extends _$MiraiLatLngCopyWithImpl<$Res, _$MiraiLatLngImpl> + implements _$$MiraiLatLngImplCopyWith<$Res> { + __$$MiraiLatLngImplCopyWithImpl( + _$MiraiLatLngImpl _value, $Res Function(_$MiraiLatLngImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? latitude = null, + Object? longitude = null, + }) { + return _then(_$MiraiLatLngImpl( + null == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + null == longitude + ? _value.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiLatLngImpl implements _MiraiLatLng { + const _$MiraiLatLngImpl(this.latitude, this.longitude); + + factory _$MiraiLatLngImpl.fromJson(Map json) => + _$$MiraiLatLngImplFromJson(json); + + @override + final double latitude; + @override + final double longitude; + + @override + String toString() { + return 'MiraiLatLng(latitude: $latitude, longitude: $longitude)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiLatLngImpl && + (identical(other.latitude, latitude) || + other.latitude == latitude) && + (identical(other.longitude, longitude) || + other.longitude == longitude)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, latitude, longitude); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiLatLngImplCopyWith<_$MiraiLatLngImpl> get copyWith => + __$$MiraiLatLngImplCopyWithImpl<_$MiraiLatLngImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiLatLngImplToJson( + this, + ); + } +} + +abstract class _MiraiLatLng implements MiraiLatLng { + const factory _MiraiLatLng(final double latitude, final double longitude) = + _$MiraiLatLngImpl; + + factory _MiraiLatLng.fromJson(Map json) = + _$MiraiLatLngImpl.fromJson; + + @override + double get latitude; + @override + double get longitude; + @override + @JsonKey(ignore: true) + _$$MiraiLatLngImplCopyWith<_$MiraiLatLngImpl> get copyWith => + throw _privateConstructorUsedError; +} + +MiraiMinMaxZoomPreference _$MiraiMinMaxZoomPreferenceFromJson( + Map json) { + return _MiraiMinMaxZoomPreference.fromJson(json); +} + +/// @nodoc +mixin _$MiraiMinMaxZoomPreference { + double? get minZoom => throw _privateConstructorUsedError; + double? get maxZoom => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiMinMaxZoomPreferenceCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiMinMaxZoomPreferenceCopyWith<$Res> { + factory $MiraiMinMaxZoomPreferenceCopyWith(MiraiMinMaxZoomPreference value, + $Res Function(MiraiMinMaxZoomPreference) then) = + _$MiraiMinMaxZoomPreferenceCopyWithImpl<$Res, MiraiMinMaxZoomPreference>; + @useResult + $Res call({double? minZoom, double? maxZoom}); +} + +/// @nodoc +class _$MiraiMinMaxZoomPreferenceCopyWithImpl<$Res, + $Val extends MiraiMinMaxZoomPreference> + implements $MiraiMinMaxZoomPreferenceCopyWith<$Res> { + _$MiraiMinMaxZoomPreferenceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? minZoom = freezed, + Object? maxZoom = freezed, + }) { + return _then(_value.copyWith( + minZoom: freezed == minZoom + ? _value.minZoom + : minZoom // ignore: cast_nullable_to_non_nullable + as double?, + maxZoom: freezed == maxZoom + ? _value.maxZoom + : maxZoom // ignore: cast_nullable_to_non_nullable + as double?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiMinMaxZoomPreferenceImplCopyWith<$Res> + implements $MiraiMinMaxZoomPreferenceCopyWith<$Res> { + factory _$$MiraiMinMaxZoomPreferenceImplCopyWith( + _$MiraiMinMaxZoomPreferenceImpl value, + $Res Function(_$MiraiMinMaxZoomPreferenceImpl) then) = + __$$MiraiMinMaxZoomPreferenceImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({double? minZoom, double? maxZoom}); +} + +/// @nodoc +class __$$MiraiMinMaxZoomPreferenceImplCopyWithImpl<$Res> + extends _$MiraiMinMaxZoomPreferenceCopyWithImpl<$Res, + _$MiraiMinMaxZoomPreferenceImpl> + implements _$$MiraiMinMaxZoomPreferenceImplCopyWith<$Res> { + __$$MiraiMinMaxZoomPreferenceImplCopyWithImpl( + _$MiraiMinMaxZoomPreferenceImpl _value, + $Res Function(_$MiraiMinMaxZoomPreferenceImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? minZoom = freezed, + Object? maxZoom = freezed, + }) { + return _then(_$MiraiMinMaxZoomPreferenceImpl( + freezed == minZoom + ? _value.minZoom + : minZoom // ignore: cast_nullable_to_non_nullable + as double?, + freezed == maxZoom + ? _value.maxZoom + : maxZoom // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiraiMinMaxZoomPreferenceImpl implements _MiraiMinMaxZoomPreference { + const _$MiraiMinMaxZoomPreferenceImpl(this.minZoom, this.maxZoom); + + factory _$MiraiMinMaxZoomPreferenceImpl.fromJson(Map json) => + _$$MiraiMinMaxZoomPreferenceImplFromJson(json); + + @override + final double? minZoom; + @override + final double? maxZoom; + + @override + String toString() { + return 'MiraiMinMaxZoomPreference(minZoom: $minZoom, maxZoom: $maxZoom)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiMinMaxZoomPreferenceImpl && + (identical(other.minZoom, minZoom) || other.minZoom == minZoom) && + (identical(other.maxZoom, maxZoom) || other.maxZoom == maxZoom)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, minZoom, maxZoom); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiMinMaxZoomPreferenceImplCopyWith<_$MiraiMinMaxZoomPreferenceImpl> + get copyWith => __$$MiraiMinMaxZoomPreferenceImplCopyWithImpl< + _$MiraiMinMaxZoomPreferenceImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiraiMinMaxZoomPreferenceImplToJson( + this, + ); + } +} + +abstract class _MiraiMinMaxZoomPreference implements MiraiMinMaxZoomPreference { + const factory _MiraiMinMaxZoomPreference( + final double? minZoom, final double? maxZoom) = + _$MiraiMinMaxZoomPreferenceImpl; + + factory _MiraiMinMaxZoomPreference.fromJson(Map json) = + _$MiraiMinMaxZoomPreferenceImpl.fromJson; + + @override + double? get minZoom; + @override + double? get maxZoom; + @override + @JsonKey(ignore: true) + _$$MiraiMinMaxZoomPreferenceImplCopyWith<_$MiraiMinMaxZoomPreferenceImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$MiraiMapStyleException { + String get cause => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $MiraiMapStyleExceptionCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiMapStyleExceptionCopyWith<$Res> { + factory $MiraiMapStyleExceptionCopyWith(MiraiMapStyleException value, + $Res Function(MiraiMapStyleException) then) = + _$MiraiMapStyleExceptionCopyWithImpl<$Res, MiraiMapStyleException>; + @useResult + $Res call({String cause}); +} + +/// @nodoc +class _$MiraiMapStyleExceptionCopyWithImpl<$Res, + $Val extends MiraiMapStyleException> + implements $MiraiMapStyleExceptionCopyWith<$Res> { + _$MiraiMapStyleExceptionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cause = null, + }) { + return _then(_value.copyWith( + cause: null == cause + ? _value.cause + : cause // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiraiMapStyleExceptionImplCopyWith<$Res> + implements $MiraiMapStyleExceptionCopyWith<$Res> { + factory _$$MiraiMapStyleExceptionImplCopyWith( + _$MiraiMapStyleExceptionImpl value, + $Res Function(_$MiraiMapStyleExceptionImpl) then) = + __$$MiraiMapStyleExceptionImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String cause}); +} + +/// @nodoc +class __$$MiraiMapStyleExceptionImplCopyWithImpl<$Res> + extends _$MiraiMapStyleExceptionCopyWithImpl<$Res, + _$MiraiMapStyleExceptionImpl> + implements _$$MiraiMapStyleExceptionImplCopyWith<$Res> { + __$$MiraiMapStyleExceptionImplCopyWithImpl( + _$MiraiMapStyleExceptionImpl _value, + $Res Function(_$MiraiMapStyleExceptionImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cause = null, + }) { + return _then(_$MiraiMapStyleExceptionImpl( + null == cause + ? _value.cause + : cause // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$MiraiMapStyleExceptionImpl implements _MiraiMapStyleException { + const _$MiraiMapStyleExceptionImpl(this.cause); + + @override + final String cause; + + @override + String toString() { + return 'MiraiMapStyleException(cause: $cause)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiraiMapStyleExceptionImpl && + (identical(other.cause, cause) || other.cause == cause)); + } + + @override + int get hashCode => Object.hash(runtimeType, cause); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiraiMapStyleExceptionImplCopyWith<_$MiraiMapStyleExceptionImpl> + get copyWith => __$$MiraiMapStyleExceptionImplCopyWithImpl< + _$MiraiMapStyleExceptionImpl>(this, _$identity); +} + +abstract class _MiraiMapStyleException implements MiraiMapStyleException { + const factory _MiraiMapStyleException(final String cause) = + _$MiraiMapStyleExceptionImpl; + + @override + String get cause; + @override + @JsonKey(ignore: true) + _$$MiraiMapStyleExceptionImplCopyWith<_$MiraiMapStyleExceptionImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.g.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.g.dart new file mode 100644 index 00000000..9dd88bc8 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_ui.g.dart @@ -0,0 +1,63 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_google_map_ui.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiraiCameraTargetBoundsImpl _$$MiraiCameraTargetBoundsImplFromJson( + Map json) => + _$MiraiCameraTargetBoundsImpl( + json['bounds'] == null + ? null + : MiraiLatLngBounds.fromJson(json['bounds'] as Map), + ); + +Map _$$MiraiCameraTargetBoundsImplToJson( + _$MiraiCameraTargetBoundsImpl instance) => + { + 'bounds': instance.bounds, + }; + +_$MiraiLatLngBoundsImpl _$$MiraiLatLngBoundsImplFromJson( + Map json) => + _$MiraiLatLngBoundsImpl( + southwest: + MiraiLatLng.fromJson(json['southwest'] as Map), + northeast: + MiraiLatLng.fromJson(json['northeast'] as Map), + ); + +Map _$$MiraiLatLngBoundsImplToJson( + _$MiraiLatLngBoundsImpl instance) => + { + 'southwest': instance.southwest, + 'northeast': instance.northeast, + }; + +_$MiraiLatLngImpl _$$MiraiLatLngImplFromJson(Map json) => + _$MiraiLatLngImpl( + (json['latitude'] as num).toDouble(), + (json['longitude'] as num).toDouble(), + ); + +Map _$$MiraiLatLngImplToJson(_$MiraiLatLngImpl instance) => + { + 'latitude': instance.latitude, + 'longitude': instance.longitude, + }; + +_$MiraiMinMaxZoomPreferenceImpl _$$MiraiMinMaxZoomPreferenceImplFromJson( + Map json) => + _$MiraiMinMaxZoomPreferenceImpl( + (json['minZoom'] as num?)?.toDouble(), + (json['maxZoom'] as num?)?.toDouble(), + ); + +Map _$$MiraiMinMaxZoomPreferenceImplToJson( + _$MiraiMinMaxZoomPreferenceImpl instance) => + { + 'minZoom': instance.minZoom, + 'maxZoom': instance.maxZoom, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_web_gesture_handling.dart b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_web_gesture_handling.dart new file mode 100644 index 00000000..35620a38 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_google_map/mirai_google_map_types/mirai_google_map_web_gesture_handling.dart @@ -0,0 +1,29 @@ +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +// part 'mirai_google_map_web_gesture_handling.freezed.dart'; +// part 'mirai_google_map_web_gesture_handling.g.dart'; + +enum MiraiWebGestureHandling { + cooperative, + + /// All touch gestures and scroll events pan or zoom the map. + greedy, + + /// The map cannot be panned or zoomed by user gestures. + none, + + /// (default) Gesture handling is either cooperative or greedy, depending on + /// whether the page is scrollable or in an iframe. + auto; + + WebGestureHandling get value { + return switch (this) { + MiraiWebGestureHandling.cooperative => WebGestureHandling.cooperative, + MiraiWebGestureHandling.greedy => WebGestureHandling.greedy, + MiraiWebGestureHandling.auto => WebGestureHandling.auto, + // /// Do not display map tiles. + _ => WebGestureHandling.none + }; + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_tab_bar_view/mirai_tab_bar_view.dart b/packages/mirai/lib/src/parsers/mirai_tab_bar_view/mirai_tab_bar_view.dart index 8e4ddfaf..fcdda4bc 100644 --- a/packages/mirai/lib/src/parsers/mirai_tab_bar_view/mirai_tab_bar_view.dart +++ b/packages/mirai/lib/src/parsers/mirai_tab_bar_view/mirai_tab_bar_view.dart @@ -19,6 +19,5 @@ class MiraiTabBarView with _$MiraiTabBarView { @Default(Clip.hardEdge) Clip clipBehavior, }) = _MiraiTabBarView; - factory MiraiTabBarView.fromJson(Map json) => - _$MiraiTabBarViewFromJson(json); + factory MiraiTabBarView.fromJson(Map json) => _$MiraiTabBarViewFromJson(json); } diff --git a/packages/mirai/lib/src/parsers/parsers.dart b/packages/mirai/lib/src/parsers/parsers.dart index 3c6dda43..c8107a7d 100644 --- a/packages/mirai/lib/src/parsers/parsers.dart +++ b/packages/mirai/lib/src/parsers/parsers.dart @@ -73,3 +73,4 @@ export 'package:mirai/src/parsers/mirai_text_form_field/mirai_text_form_field.da export 'package:mirai/src/parsers/mirai_text_style/mirai_text_style.dart'; export 'package:mirai/src/parsers/mirai_theme/mirai_theme.dart'; export 'package:mirai/src/parsers/mirai_wrap/mirai_wrap.dart'; +export 'package:mirai/src/parsers/mirai_google_map/mirai_google_map.dart'; diff --git a/packages/mirai/lib/src/utils/widget_type.dart b/packages/mirai/lib/src/utils/widget_type.dart index 1e7f6435..f9035583 100644 --- a/packages/mirai/lib/src/utils/widget_type.dart +++ b/packages/mirai/lib/src/utils/widget_type.dart @@ -47,4 +47,5 @@ enum WidgetType { defaultBottomNavigationController, bottomNavigationView, wrap, + googleMap } diff --git a/packages/mirai/pubspec.yaml b/packages/mirai/pubspec.yaml index 7a9111f6..8b60960f 100644 --- a/packages/mirai/pubspec.yaml +++ b/packages/mirai/pubspec.yaml @@ -15,6 +15,7 @@ dependencies: logger: ^2.0.2+1 dio: ^5.4.0 mirai_framework: ^0.0.1 + google_maps_flutter: ^2.6.0 dev_dependencies: flutter_test: