feat(maps): Integrate Google Maps plugin for shift location display and refactor related components

This commit is contained in:
Achintha Isuru
2026-02-16 13:55:32 -05:00
parent 888cf83c18
commit e1e255f8f0
6 changed files with 175 additions and 52 deletions

View File

@@ -30,11 +30,21 @@ public final class GeneratedPluginRegistrant {
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Error registering plugin firebase_core, io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin", e); Log.e(TAG, "Error registering plugin firebase_core, io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin", e);
} }
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin flutter_plugin_android_lifecycle, io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin", e);
}
try { try {
flutterEngine.getPlugins().add(new com.baseflow.geolocator.GeolocatorPlugin()); flutterEngine.getPlugins().add(new com.baseflow.geolocator.GeolocatorPlugin());
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Error registering plugin geolocator_android, com.baseflow.geolocator.GeolocatorPlugin", e); Log.e(TAG, "Error registering plugin geolocator_android, com.baseflow.geolocator.GeolocatorPlugin", e);
} }
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.googlemaps.GoogleMapsPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin google_maps_flutter_android, io.flutter.plugins.googlemaps.GoogleMapsPlugin", e);
}
try { try {
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin()); flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
} catch (Exception e) { } catch (Exception e) {

View File

@@ -30,6 +30,12 @@
@import geolocator_apple; @import geolocator_apple;
#endif #endif
#if __has_include(<google_maps_flutter_ios/FLTGoogleMapsPlugin.h>)
#import <google_maps_flutter_ios/FLTGoogleMapsPlugin.h>
#else
@import google_maps_flutter_ios;
#endif
#if __has_include(<permission_handler_apple/PermissionHandlerPlugin.h>) #if __has_include(<permission_handler_apple/PermissionHandlerPlugin.h>)
#import <permission_handler_apple/PermissionHandlerPlugin.h> #import <permission_handler_apple/PermissionHandlerPlugin.h>
#else #else
@@ -49,6 +55,7 @@
[FLTFirebaseAuthPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseAuthPlugin"]]; [FLTFirebaseAuthPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseAuthPlugin"]];
[FLTFirebaseCorePlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseCorePlugin"]]; [FLTFirebaseCorePlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseCorePlugin"]];
[GeolocatorPlugin registerWithRegistrar:[registry registrarForPlugin:@"GeolocatorPlugin"]]; [GeolocatorPlugin registerWithRegistrar:[registry registrarForPlugin:@"GeolocatorPlugin"]];
[FLTGoogleMapsPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTGoogleMapsPlugin"]];
[PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]]; [PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]];
[SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]]; [SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];
} }

View File

@@ -1,19 +1,19 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:krow_domain/krow_domain.dart'; import 'package:krow_domain/krow_domain.dart';
import '../shift_location_map.dart'; import 'shift_location_map.dart';
/// A section displaying the shift's location, address, map, and "Get direction" action. /// A section displaying the shift's location, address, map, and "Get direction" action.
class ShiftLocationSection extends StatelessWidget { class ShiftLocationSection extends StatelessWidget {
/// The shift entity containing location data. /// The shift entity containing location data.
final Shift shift; final Shift shift;
/// Localization string for location section title. /// Localization string for location section title.
final String locationLabel; final String locationLabel;
/// Localization string for "TBD". /// Localization string for "TBD".
final String tbdLabel; final String tbdLabel;
/// Localization string for "Get direction". /// Localization string for "Get direction".
final String getDirectionLabel; final String getDirectionLabel;
@@ -32,56 +32,80 @@ class ShiftLocationSection extends StatelessWidget {
padding: const EdgeInsets.all(UiConstants.space5), padding: const EdgeInsets.all(UiConstants.space5),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
spacing: UiConstants.space4,
children: [ children: [
Text( Column(
locationLabel, spacing: UiConstants.space2,
style: UiTypography.titleUppercase4b.textSecondary, crossAxisAlignment: CrossAxisAlignment.start,
), mainAxisSize: MainAxisSize.min,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Text(
child: Text( locationLabel,
shift.location.isEmpty ? tbdLabel : shift.location, style: UiTypography.titleUppercase4b.textSecondary,
style: UiTypography.title1m.textPrimary,
overflow: TextOverflow.ellipsis,
),
), ),
const SizedBox(width: UiConstants.space3),
OutlinedButton.icon( Row(
onPressed: () { mainAxisAlignment: MainAxisAlignment.spaceBetween,
ScaffoldMessenger.of(context).showSnackBar( spacing: UiConstants.space4,
SnackBar( children: [
content: Text( Expanded(
shift.locationAddress.isNotEmpty child: Column(
? shift.locationAddress crossAxisAlignment: CrossAxisAlignment.start,
: shift.location, children: [
), Text(
duration: const Duration(seconds: 3), shift.location.isEmpty ? tbdLabel : shift.location,
style: UiTypography.title1m.textPrimary,
overflow: TextOverflow.ellipsis,
),
if (shift.locationAddress.isNotEmpty)
Text(
shift.locationAddress,
style: UiTypography.body2r.textSecondary,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
), ),
);
},
icon: const Icon(
UiIcons.navigation,
size: UiConstants.iconXs,
),
label: Text(getDirectionLabel),
style: OutlinedButton.styleFrom(
foregroundColor: UiColors.textPrimary,
side: const BorderSide(color: UiColors.border),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(UiConstants.radiusBase),
), ),
padding: const EdgeInsets.symmetric( OutlinedButton.icon(
horizontal: UiConstants.space3, onPressed: () {
vertical: 0, ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
shift.locationAddress.isNotEmpty
? shift.locationAddress
: shift.location,
),
duration: const Duration(seconds: 3),
),
);
},
icon: const Icon(
UiIcons.navigation,
size: UiConstants.iconXs,
),
label: Text(getDirectionLabel),
style: OutlinedButton.styleFrom(
foregroundColor: UiColors.textPrimary,
side: const BorderSide(color: UiColors.border),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
UiConstants.radiusBase,
),
),
padding: const EdgeInsets.symmetric(
horizontal: UiConstants.space3,
vertical: 0,
),
minimumSize: const Size(0, 32),
),
), ),
minimumSize: const Size(0, 32), ],
),
), ),
], ],
), ),
const SizedBox(height: UiConstants.space3),
ShiftLocationMap( ShiftLocationMap(
shift: shift, shift: shift,
height: 160, height: 160,

View File

@@ -1,21 +1,17 @@
name: staff_shifts name: staff_shifts
description: A new Flutter package project. description: A new Flutter package project.
version: 0.0.1 version: 0.0.1
publish_to: 'none' publish_to: "none"
resolution: workspace resolution: workspace
environment: environment:
sdk: '>=3.10.0 <4.0.0' sdk: ">=3.10.0 <4.0.0"
flutter: ">=3.0.0" flutter: ">=3.0.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_modular: ^6.3.2
flutter_bloc: ^8.1.3
equatable: ^2.0.5
intl: ^0.20.2
# Internal packages # Internal packages
krow_core: krow_core:
path: ../../../core path: ../../../core
@@ -27,6 +23,12 @@ dependencies:
path: ../../../data_connect path: ../../../data_connect
core_localization: core_localization:
path: ../../../core_localization path: ../../../core_localization
flutter_modular: ^6.3.2
flutter_bloc: ^8.1.3
equatable: ^2.0.5
intl: ^0.20.2
google_maps_flutter: ^2.14.2
firebase_auth: ^6.1.4 firebase_auth: ^6.1.4
firebase_data_connect: ^0.2.2+2 firebase_data_connect: ^0.2.2+2

View File

@@ -249,6 +249,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.7" version: "3.0.7"
csslib:
dependency: transitive
description:
name: csslib
sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
csv: csv:
dependency: transitive dependency: transitive
description: description:
@@ -467,6 +475,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.4.1" version: "6.4.1"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1
url: "https://pub.dev"
source: hosted
version: "2.0.33"
flutter_test: flutter_test:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -573,6 +589,54 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.3+1" version: "0.3.3+1"
google_maps:
dependency: transitive
description:
name: google_maps
sha256: "5d410c32112d7c6eb7858d359275b2aa04778eed3e36c745aeae905fb2fa6468"
url: "https://pub.dev"
source: hosted
version: "8.2.0"
google_maps_flutter:
dependency: transitive
description:
name: google_maps_flutter
sha256: "9b0d6dab3de6955837575dc371dd772fcb5d0a90f6a4954e8c066472f9938550"
url: "https://pub.dev"
source: hosted
version: "2.14.2"
google_maps_flutter_android:
dependency: transitive
description:
name: google_maps_flutter_android
sha256: "98d7f5354f770f3e993db09fc798d40aeb6a254f04c1c468a94818ec2086e83e"
url: "https://pub.dev"
source: hosted
version: "2.18.12"
google_maps_flutter_ios:
dependency: transitive
description:
name: google_maps_flutter_ios
sha256: "38f0a9ee858b0de3a5105e7efe200f154eea8397eb0c36bea6b3810429fbc0e4"
url: "https://pub.dev"
source: hosted
version: "2.17.3"
google_maps_flutter_platform_interface:
dependency: transitive
description:
name: google_maps_flutter_platform_interface
sha256: e8b1232419fcdd35c1fdafff96843f5a40238480365599d8ca661dde96d283dd
url: "https://pub.dev"
source: hosted
version: "2.14.1"
google_maps_flutter_web:
dependency: transitive
description:
name: google_maps_flutter_web
sha256: d416602944e1859f3cbbaa53e34785c223fa0a11eddb34a913c964c5cbb5d8cf
url: "https://pub.dev"
source: hosted
version: "0.5.14+3"
google_places_flutter: google_places_flutter:
dependency: transitive dependency: transitive
description: description:
@@ -613,6 +677,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.20.5" version: "0.20.5"
html:
dependency: transitive
description:
name: html
sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602"
url: "https://pub.dev"
source: hosted
version: "0.15.6"
http: http:
dependency: transitive dependency: transitive
description: description:
@@ -1061,6 +1133,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.28.0" version: "0.28.0"
sanitize_html:
dependency: transitive
description:
name: sanitize_html
sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
shared_preferences: shared_preferences:
dependency: transitive dependency: transitive
description: description: