feat(map in info): show blurred out map if map isn't enabled
This commit is contained in:
parent
5735763fa7
commit
8749f4decb
|
@ -1,4 +1,5 @@
|
||||||
import "dart:async";
|
import "dart:async";
|
||||||
|
import "dart:ui";
|
||||||
|
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_map/flutter_map.dart";
|
import "package:flutter_map/flutter_map.dart";
|
||||||
|
@ -10,6 +11,7 @@ import "package:photos/generated/l10n.dart";
|
||||||
import "package:photos/models/file/file.dart";
|
import "package:photos/models/file/file.dart";
|
||||||
import "package:photos/services/location_service.dart";
|
import "package:photos/services/location_service.dart";
|
||||||
import "package:photos/services/search_service.dart";
|
import "package:photos/services/search_service.dart";
|
||||||
|
import "package:photos/services/user_remote_flag_service.dart";
|
||||||
import "package:photos/states/location_screen_state.dart";
|
import "package:photos/states/location_screen_state.dart";
|
||||||
import "package:photos/theme/ente_theme.dart";
|
import "package:photos/theme/ente_theme.dart";
|
||||||
import "package:photos/ui/components/buttons/chip_button_widget.dart";
|
import "package:photos/ui/components/buttons/chip_button_widget.dart";
|
||||||
|
@ -39,6 +41,7 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
|
||||||
late StreamSubscription<LocationTagUpdatedEvent> _locTagUpdateListener;
|
late StreamSubscription<LocationTagUpdatedEvent> _locTagUpdateListener;
|
||||||
VoidCallback? onTap;
|
VoidCallback? onTap;
|
||||||
final _mapController = MapController();
|
final _mapController = MapController();
|
||||||
|
late bool _hasEnabledMap;
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
locationTagChips = _getLocationTags();
|
locationTagChips = _getLocationTags();
|
||||||
|
@ -46,6 +49,8 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
|
||||||
Bus.instance.on<LocationTagUpdatedEvent>().listen((event) {
|
Bus.instance.on<LocationTagUpdatedEvent>().listen((event) {
|
||||||
locationTagChips = _getLocationTags();
|
locationTagChips = _getLocationTags();
|
||||||
});
|
});
|
||||||
|
_hasEnabledMap = UserRemoteFlagService.instance
|
||||||
|
.getCachedBoolValue(UserRemoteFlagService.mapEnabled);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,67 +76,113 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
endSection: Padding(
|
endSection: Padding(
|
||||||
padding: const EdgeInsets.only(top: 8),
|
padding: const EdgeInsets.only(top: 8),
|
||||||
|
child: _hasEnabledMap
|
||||||
child: ClipRRect(
|
? ClipRRect(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 120,
|
height: 120,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
MapView(
|
MapView(
|
||||||
updateVisibleImages: () {},
|
updateVisibleImages: () {},
|
||||||
imageMarkers: [
|
imageMarkers: [
|
||||||
ImageMarker(
|
ImageMarker(
|
||||||
imageFile: widget.file,
|
imageFile: widget.file,
|
||||||
latitude: widget.file.location!.latitude!,
|
latitude: widget.file.location!.latitude!,
|
||||||
longitude: widget.file.location!.longitude!,
|
longitude: widget.file.location!.longitude!,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
controller: _mapController,
|
controller: _mapController,
|
||||||
center: LatLng(
|
center: LatLng(
|
||||||
widget.file.location!.latitude!,
|
widget.file.location!.latitude!,
|
||||||
widget.file.location!.longitude!,
|
widget.file.location!.longitude!,
|
||||||
),
|
),
|
||||||
minZoom: 7,
|
minZoom: 9,
|
||||||
maxZoom: 7,
|
maxZoom: 9,
|
||||||
initialZoom: 7,
|
initialZoom: 9,
|
||||||
debounceDuration: 0,
|
debounceDuration: 0,
|
||||||
bottomSheetDraggableAreaHeight: 0,
|
bottomSheetDraggableAreaHeight: 0,
|
||||||
showControls: false,
|
showControls: false,
|
||||||
interactiveFlags: InteractiveFlag.none,
|
interactiveFlags: InteractiveFlag.none,
|
||||||
mapAttributionOptions: MapAttributionOptions(
|
mapAttributionOptions: MapAttributionOptions(
|
||||||
permanentHeight: 16,
|
permanentHeight: 16,
|
||||||
popupBorderRadius: BorderRadius.circular(4),
|
popupBorderRadius: BorderRadius.circular(4),
|
||||||
iconSize: 16,
|
iconSize: 16,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => MapScreen(
|
builder: (context) => MapScreen(
|
||||||
filesFutureFn: SearchService.instance.getAllFiles,
|
filesFutureFn:
|
||||||
center: LatLng(
|
SearchService.instance.getAllFiles,
|
||||||
widget.file.location!.latitude!,
|
center: LatLng(
|
||||||
widget.file.location!.longitude!,
|
widget.file.location!.latitude!,
|
||||||
|
widget.file.location!.longitude!,
|
||||||
|
),
|
||||||
|
initialZoom: 9 + 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
markerSize: const Size(45, 45),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(
|
||||||
|
color: getEnteColorScheme(context).strokeFaint,
|
||||||
),
|
),
|
||||||
initialZoom: 7 + 1,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
},
|
|
||||||
markerSize: const Size(45, 45),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(
|
|
||||||
color: getEnteColorScheme(context).strokeFaint,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
),
|
: ClipRRect(
|
||||||
),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
),
|
child: SizedBox(
|
||||||
|
height: 120,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
MapView(
|
||||||
|
updateVisibleImages: () {},
|
||||||
|
imageMarkers: const [],
|
||||||
|
controller: _mapController,
|
||||||
|
center: const LatLng(
|
||||||
|
13.041599,
|
||||||
|
77.594566,
|
||||||
|
),
|
||||||
|
minZoom: 9,
|
||||||
|
maxZoom: 9,
|
||||||
|
initialZoom: 9,
|
||||||
|
debounceDuration: 0,
|
||||||
|
bottomSheetDraggableAreaHeight: 0,
|
||||||
|
showControls: false,
|
||||||
|
interactiveFlags: InteractiveFlag.none,
|
||||||
|
mapAttributionOptions: const MapAttributionOptions(
|
||||||
|
iconSize: 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 2.8, sigmaY: 2.8),
|
||||||
|
child: Container(
|
||||||
|
color: getEnteColorScheme(context)
|
||||||
|
.backgroundElevated2
|
||||||
|
.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(
|
||||||
|
color: getEnteColorScheme(context).strokeFaint,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
/// to be used when state issues are fixed when location is updated
|
/// to be used when state issues are fixed when location is updated
|
||||||
// editOnTap: widget.file.ownerID == Configuration.instance.getUserID()!
|
// editOnTap: widget.file.ownerID == Configuration.instance.getUserID()!
|
||||||
|
|
Loading…
Reference in a new issue