feat(map in info): move map to a different place in info

This commit is contained in:
ashilkn 2024-01-30 14:51:13 +05:30
parent 6d6f4bb36a
commit 81ad8fab74
3 changed files with 50 additions and 49 deletions

View file

@ -8,7 +8,7 @@ class InfoItemWidget extends StatelessWidget {
final IconData leadingIcon;
final VoidCallback? editOnTap;
final String? title;
final Widget? middleSection;
final Widget? endSection;
final Future<List<Widget>> subtitleSection;
final bool hasChipButtons;
final VoidCallback? onTap;
@ -16,7 +16,7 @@ class InfoItemWidget extends StatelessWidget {
required this.leadingIcon,
this.editOnTap,
this.title,
this.middleSection,
this.endSection,
required this.subtitleSection,
this.hasChipButtons = false,
this.onTap,
@ -38,8 +38,6 @@ class InfoItemWidget extends StatelessWidget {
]);
}
middleSection != null ? children.add(middleSection!) : null;
children.addAll([
Flexible(
child: FutureBuilder(
@ -74,6 +72,9 @@ class InfoItemWidget extends StatelessWidget {
),
),
]);
endSection != null ? children.add(endSection!) : null;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,

View file

@ -145,6 +145,7 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
},
),
);
fileDetailsTiles.addAll([
ValueListenableBuilder(
valueListenable: hasLocationData,

View file

@ -3,12 +3,14 @@ import "dart:async";
import "package:flutter/material.dart";
import "package:flutter_map/flutter_map.dart";
import "package:latlong2/latlong.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/location_tag_updated_event.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/file/file.dart";
import "package:photos/services/location_service.dart";
import "package:photos/services/search_service.dart";
import "package:photos/states/location_screen_state.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/chip_button_widget.dart";
@ -16,6 +18,7 @@ import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/ui/map/image_marker.dart";
import "package:photos/ui/map/map_screen.dart";
import "package:photos/ui/map/map_view.dart";
import 'package:photos/ui/viewer/location/add_location_sheet.dart';
import "package:photos/ui/viewer/location/location_screen.dart";
import "package:photos/utils/navigation_util.dart";
@ -29,7 +32,6 @@ class LocationTagsWidget extends StatefulWidget {
}
class _LocationTagsWidgetState extends State<LocationTagsWidget> {
static const mapZoom = 7.0;
String? title;
IconData? leadingIcon;
bool? hasChipButtons;
@ -65,52 +67,49 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
subtitleSection: locationTagChips,
hasChipButtons: hasChipButtons ?? true,
onTap: onTap,
// middleSection: SizedBox(
// height: 150,
// width: 300,
// child: MapScreen(
// filesFutureFn: () => Future.value([widget.file]),
// showGallery: false,
// ),
// ),
middleSection: SizedBox(
height: 150,
width: 300,
child: MapView(
updateVisibleImages: () {},
imageMarkers: [
ImageMarker(
imageFile: widget.file,
latitude: widget.file.location!.latitude!,
longitude: widget.file.location!.longitude!,
),
],
controller: MapController(),
center: LatLng(
widget.file.location!.latitude!,
widget.file.location!.longitude!,
),
minZoom: mapZoom,
maxZoom: mapZoom,
initialZoom: 7,
debounceDuration: 0,
bottomSheetDraggableAreaHeight: 0,
showControls: false,
interactiveFlags: InteractiveFlag.none,
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => MapScreen(
filesFutureFn: SearchService.instance.getAllFiles,
center: LatLng(
widget.file.location!.latitude!,
widget.file.location!.longitude!,
),
initialZoom: mapZoom + 1,
endSection: Padding(
padding: const EdgeInsets.only(top: 8),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(12)),
child: SizedBox(
height: 120,
child: MapView(
updateVisibleImages: () {},
imageMarkers: [
ImageMarker(
imageFile: widget.file,
latitude: widget.file.location!.latitude!,
longitude: widget.file.location!.longitude!,
),
],
controller: MapController(),
center: LatLng(
widget.file.location!.latitude!,
widget.file.location!.longitude!,
),
);
},
minZoom: 7,
maxZoom: 7,
initialZoom: 7,
debounceDuration: 0,
bottomSheetDraggableAreaHeight: 0,
showControls: false,
interactiveFlags: InteractiveFlag.none,
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => MapScreen(
filesFutureFn: SearchService.instance.getAllFiles,
center: LatLng(
widget.file.location!.latitude!,
widget.file.location!.longitude!,
),
initialZoom: 7 + 1,
),
),
);
},
),
),
),
),