Przeglądaj źródła

use const + wrap unawited future with unawaited

ashilkn 1 rok temu
rodzic
commit
635f7e724f

+ 1 - 1
lib/ui/map/map_screen.dart

@@ -45,7 +45,7 @@ class _MapScreenState extends State<MapScreen> {
   double maxZoom = 18.0;
   double minZoom = 2.8;
   int debounceDuration = 500;
-  LatLng center = LatLng(46.7286, 4.8614);
+  LatLng center = const LatLng(46.7286, 4.8614);
   final Logger _logger = Logger("_MapScreenState");
   StreamSubscription? _mapMoveSubscription;
   Isolate? isolate;

+ 2 - 2
lib/ui/map/map_view.dart

@@ -77,8 +77,8 @@ class _MapViewState extends State<MapView> {
             enableMultiFingerGestureRace: true,
             zoom: widget.initialZoom,
             maxBounds: LatLngBounds(
-              LatLng(-90, -180),
-              LatLng(90, 180),
+              const LatLng(-90, -180),
+              const LatLng(90, 180),
             ),
             onPositionChanged: (position, hasGesture) {
               if (position.bounds != null) {

+ 8 - 4
lib/ui/viewer/search/result/go_to_map_widget.dart

@@ -1,3 +1,5 @@
+import "dart:async";
+
 import "package:flutter/material.dart";
 import "package:photos/generated/l10n.dart";
 import "package:photos/services/search_service.dart";
@@ -22,10 +24,12 @@ class GoToMapWidget extends StatelessWidget {
       onTap: () async {
         final bool result = await requestForMapEnable(context);
         if (result) {
-          Navigator.of(context).push(
-            MaterialPageRoute(
-              builder: (context) => MapScreen(
-                filesFutureFn: SearchService.instance.getAllFiles,
+          unawaited(
+            Navigator.of(context).push(
+              MaterialPageRoute(
+                builder: (context) => MapScreen(
+                  filesFutureFn: SearchService.instance.getAllFiles,
+                ),
               ),
             ),
           );