π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
pref: eliminate jank when opening info section
ashilkn3288e7516e98
diff --git a/lib/ui/viewer/file_details/location_tags_widget.dart b/lib/ui/viewer/file_details/location_tags_widget.dartindex 655401cb47..aca2385d93 100644--- a/lib/ui/viewer/file_details/location_tags_widget.dart+++ b/lib/ui/viewer/file_details/location_tags_widget.dart@@ -44,9 +44,14 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {late Future<List<Widget>> locationTagChips;late StreamSubscription<LocationTagUpdatedEvent> _locTagUpdateListener;VoidCallback? onTap;+ bool _loadedLocationTags = false;+@overridevoid initState() {- locationTagChips = _getLocationTags();+ locationTagChips = _getLocationTags().then((value) {+ _loadedLocationTags = true;+ return value;+ });_locTagUpdateListener =Bus.instance.on<LocationTagUpdatedEvent>().listen((event) {locationTagChips = _getLocationTags();@@ -74,7 +79,9 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {subtitleSection: locationTagChips,hasChipButtons: hasChipButtons ?? true,onTap: onTap,- endSection: InfoMap(widget.file),+ endSection: _loadedLocationTags+ ? InfoMap(widget.file)+ : const SizedBox.shrink(),/// to be used when state issues are fixed when location is updated// editOnTap: widget.file.ownerID == Configuration.instance.getUserID()!@@ -100,6 +107,7 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {}Future<List<Widget>> _getLocationTags() async {+ // await Future.delayed(const Duration(seconds: 1));final locationTags = await LocationService.instance.enclosingLocationTags(widget.file.location!);if (locationTags.isEmpty) {@@ -173,6 +181,7 @@ class _InfoMapState extends State<InfoMap> {static const _enabledMapZoom = 12.0;static const _disabledMapZoom = 9.0;bool _tappedToOpenMap = false;+ final _past250msAfterInit = ValueNotifier(false);@overridevoid initState() {@@ -181,11 +190,16 @@ class _InfoMapState extends State<InfoMap> {.getCachedBoolValue(UserRemoteFlagService.mapEnabled);_fileLat = widget.file.location!.latitude!;_fileLng = widget.file.location!.longitude!;++ Future.delayed(const Duration(milliseconds: 250), () {+ _past250msAfterInit.value = true;+ });}@overridevoid dispose() {_mapController.dispose();+ _past250msAfterInit.dispose();super.dispose();}@@ -251,68 +265,77 @@ class _InfoMapState extends State<InfoMap> {: const SizedBox.shrink(),],)- : Stack(- key: ValueKey(_hasEnabledMap),- clipBehavior: Clip.none,- children: [- MapView(- updateVisibleImages: () {},- imageMarkers: const [],- controller: _mapController,- center: const LatLng(- 13.041599,- 77.594566,- ),- minZoom: _disabledMapZoom,- maxZoom: _disabledMapZoom,- initialZoom: _disabledMapZoom,- 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)- .backgroundElevated- .withOpacity(0.5),- ),- ),- Container(- decoration: BoxDecoration(- borderRadius: BorderRadius.circular(8),- border: Border.all(- color: getEnteColorScheme(context).strokeFaint,- ),- ),- ),- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () async {- unawaited(- requestForMapEnable(context).then((value) {- if (value) {- setState(() {- _hasEnabledMap = true;- });- }- }),- );- },- child: Center(- child: Text(- S.of(context).enableMaps,- style: getEnteTextTheme(context).small,- ),- ),- ),- ],+ : ValueListenableBuilder(+ valueListenable: _past250msAfterInit,+ builder: (context, value, _) {+ return value+ ? Stack(+ key: ValueKey(_hasEnabledMap),+ clipBehavior: Clip.none,+ children: [+ MapView(+ updateVisibleImages: () {},+ imageMarkers: const [],+ controller: _mapController,+ center: const LatLng(+ 13.041599,+ 77.594566,+ ),+ minZoom: _disabledMapZoom,+ maxZoom: _disabledMapZoom,+ initialZoom: _disabledMapZoom,+ 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)+ .backgroundElevated+ .withOpacity(0.5),+ ),+ ),+ Container(+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(8),+ border: Border.all(+ color:+ getEnteColorScheme(context).strokeFaint,+ ),+ ),+ ),+ GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () async {+ unawaited(+ requestForMapEnable(context).then((value) {+ if (value) {+ setState(() {+ _hasEnabledMap = true;+ });+ }+ }),+ );+ },+ child: Center(+ child: Text(+ S.of(context).enableMaps,+ style: getEnteTextTheme(context).small,+ ),+ ),+ ),+ ],+ )+ : const SizedBox.shrink();+ },),),),