@ -11,7 +11,6 @@ import 'package:immich_mobile/extensions/maplibrecontroller_extensions.dart';
import ' package:immich_mobile/modules/map/widgets/map_theme_override.dart ' ;
import ' package:immich_mobile/modules/map/widgets/map_theme_override.dart ' ;
import ' package:maplibre_gl/maplibre_gl.dart ' ;
import ' package:maplibre_gl/maplibre_gl.dart ' ;
import ' package:immich_mobile/modules/map/utils/map_utils.dart ' ;
import ' package:immich_mobile/modules/map/utils/map_utils.dart ' ;
import ' package:geolocator/geolocator.dart ' ;
@ RoutePage < LatLng ? > ( )
@ RoutePage < LatLng ? > ( )
class MapLocationPickerPage extends HookConsumerWidget {
class MapLocationPickerPage extends HookConsumerWidget {
@ -46,15 +45,13 @@ class MapLocationPickerPage extends HookConsumerWidget {
}
}
Future < void > getCurrentLocation ( ) async {
Future < void > getCurrentLocation ( ) async {
var ( currentLocation , locationPermission ) =
var ( currentLocation , _ ) =
await MapUtils . checkPermAndGetLocation ( context ) ;
await MapUtils . checkPermAndGetLocation ( context ) ;
if ( locationPermission = = LocationPermission . denied | |
locationPermission = = LocationPermission . deniedForever ) {
return ;
}
if ( currentLocation = = null ) {
if ( currentLocation = = null ) {
return ;
return ;
}
}
var currentLatLng =
var currentLatLng =
LatLng ( currentLocation . latitude , currentLocation . longitude ) ;
LatLng ( currentLocation . latitude , currentLocation . longitude ) ;
selectedLatLng . value = currentLatLng ;
selectedLatLng . value = currentLatLng ;
@ -67,11 +64,9 @@ class MapLocationPickerPage extends HookConsumerWidget {
backgroundColor: ctx . themeData . cardColor ,
backgroundColor: ctx . themeData . cardColor ,
appBar: _AppBar ( onClose: onClose ) ,
appBar: _AppBar ( onClose: onClose ) ,
extendBodyBehindAppBar: true ,
extendBodyBehindAppBar: true ,
body: Column (
primary: true ,
children: [
body: style . widgetWhen (
style . widgetWhen (
onData: ( style ) = > Container (
onData: ( style ) = > Expanded (
child: Container (
clipBehavior: Clip . antiAliasWithSaveLayer ,
clipBehavior: Clip . antiAliasWithSaveLayer ,
decoration: const BoxDecoration (
decoration: const BoxDecoration (
borderRadius: BorderRadius . only (
borderRadius: BorderRadius . only (
@ -94,14 +89,11 @@ class MapLocationPickerPage extends HookConsumerWidget {
) ,
) ,
) ,
) ,
) ,
) ,
) ,
bottomNavigationBar: _BottomBar (
_BottomBar (
selectedLatLng: selectedLatLng ,
selectedLatLng: selectedLatLng ,
onUseLocation: ( ) = > onClose ( selectedLatLng . value ) ,
onUseLocation: ( ) = > onClose ( selectedLatLng . value ) ,
onGetCurrentLocation: getCurrentLocation ,
onGetCurrentLocation: getCurrentLocation ,
) ,
) ,
] ,
) ,
) ,
) ,
) ,
) ,
) ;
) ;
@ -116,8 +108,7 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Padding (
return Padding (
padding: EdgeInsets . only ( top: MediaQuery . paddingOf ( context ) . top + 25 ) ,
padding: const EdgeInsets . only ( top: 25 ) ,
child: Expanded (
child: Align (
child: Align (
alignment: Alignment . centerLeft ,
alignment: Alignment . centerLeft ,
child: ElevatedButton (
child: ElevatedButton (
@ -128,7 +119,6 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget {
child: const Icon ( Icons . arrow_back_ios_new_rounded ) ,
child: const Icon ( Icons . arrow_back_ios_new_rounded ) ,
) ,
) ,
) ,
) ,
) ,
) ;
) ;
}
}
@ -150,7 +140,9 @@ class _BottomBar extends StatelessWidget {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return SizedBox (
return SizedBox (
height: 150 ,
height: 150 + context . padding . bottom ,
child: Padding (
padding: EdgeInsets . only ( bottom: context . padding . bottom ) ,
child: Column (
child: Column (
mainAxisAlignment: MainAxisAlignment . spaceEvenly ,
mainAxisAlignment: MainAxisAlignment . spaceEvenly ,
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
@ -173,7 +165,8 @@ class _BottomBar extends StatelessWidget {
children: [
children: [
ElevatedButton (
ElevatedButton (
onPressed: onUseLocation ,
onPressed: onUseLocation ,
child: const Text ( " map_location_picker_page_use_location " ) . tr ( ) ,
child:
const Text ( " map_location_picker_page_use_location " ) . tr ( ) ,
) ,
) ,
ElevatedButton (
ElevatedButton (
onPressed: onGetCurrentLocation ,
onPressed: onGetCurrentLocation ,
@ -183,6 +176,7 @@ class _BottomBar extends StatelessWidget {
) ,
) ,
] ,
] ,
) ,
) ,
) ,
) ;
) ;
}
}
}
}