Skip to content

Commit

Permalink
fix(post-map): limit the number of error pop ups to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTexanCodeur committed May 27, 2024
1 parent 0280f65 commit b63181f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lib/views/pages/home/content/map/components/post_map.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "package:flutter/material.dart";
import "package:geolocator/geolocator.dart";
import "package:google_maps_flutter/google_maps_flutter.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:proxima/models/ui/map_details.dart";
Expand Down Expand Up @@ -64,11 +65,15 @@ class PostMap extends ConsumerWidget {
},
error: (error, _) {
//Pop up an error dialog if an error occurs
final dialog = ErrorAlert(error: error);

WidgetsBinding.instance.addPostFrameCallback((timestamp) {
showDialog(context: context, builder: dialog.build);
});
// ignore:

if (error is! LocationServiceDisabledException) {
final dialog = ErrorAlert(error: error);
WidgetsBinding.instance.addPostFrameCallback((timestamp) {
showDialog(context: context, builder: dialog.build);
});
}
},
loading: () => (),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/views/pages/home/content/map/map_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MapScreen extends ConsumerWidget {
key: mapScreenKey,
body: Column(
children: [
MapSelectionOptionChips(mapInfo: value),
const MapSelectionOptionChips(),
const Divider(key: dividerKey),
//TODO: change the map when clicking on a selection option
PostMap(mapInfo: value),
Expand Down

0 comments on commit b63181f

Please sign in to comment.