2023-10-18 07:44:36 +00:00
|
|
|
import "package:flutter/material.dart";
|
2023-11-16 06:11:44 +00:00
|
|
|
import "package:photos/generated/l10n.dart";
|
2023-10-18 07:44:36 +00:00
|
|
|
import "package:photos/services/search_service.dart";
|
|
|
|
import "package:photos/theme/ente_theme.dart";
|
|
|
|
import "package:photos/ui/map/enable_map.dart";
|
|
|
|
import "package:photos/ui/map/map_screen.dart";
|
|
|
|
|
|
|
|
class GoToMapWidget extends StatelessWidget {
|
|
|
|
const GoToMapWidget({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
|
|
|
|
late final double width;
|
|
|
|
if (textScaleFactor <= 1.0) {
|
|
|
|
width = 85.0;
|
|
|
|
} else {
|
|
|
|
width = 85.0 + ((textScaleFactor - 1.0) * 64);
|
|
|
|
}
|
|
|
|
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () async {
|
|
|
|
final bool result = await requestForMapEnable(context);
|
|
|
|
if (result) {
|
2023-12-16 21:04:26 +00:00
|
|
|
// ignore: unawaited_futures
|
2023-10-18 07:44:36 +00:00
|
|
|
Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => MapScreen(
|
|
|
|
filesFutureFn: SearchService.instance.getAllFiles,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: SizedBox(
|
|
|
|
width: width,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 10),
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
2023-11-16 18:29:35 +00:00
|
|
|
Image.asset(
|
|
|
|
"assets/map.png",
|
2023-10-18 07:44:36 +00:00
|
|
|
width: 64,
|
|
|
|
height: 64,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
|
|
|
Text(
|
2023-11-16 06:11:44 +00:00
|
|
|
S.of(context).yourMap,
|
2023-10-18 07:44:36 +00:00
|
|
|
maxLines: 2,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: getEnteTextTheme(context).mini,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|