-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f70fe6
commit 0af37da
Showing
24 changed files
with
724 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
example/lib/src/screens/main/map_view/components/recovery_regions/recovery_regions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:collection/collection.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_map/flutter_map.dart'; | ||
import 'package:latlong2/latlong.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../../../../../shared/state/recoverable_regions_provider.dart'; | ||
|
||
class RecoveryRegions extends StatelessWidget { | ||
const RecoveryRegions({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) => Consumer<RecoverableRegionsProvider>( | ||
builder: (context, provider, _) { | ||
final map = | ||
<HSLColor, List<({List<List<LatLng>> pointss, String label})>>{}; | ||
for (final MapEntry(key: region, value: color) | ||
in provider.failedRegions.entries) { | ||
(map[color] ??= []).add( | ||
( | ||
pointss: region.region.regions | ||
.map((e) => e.toOutline().toList()) | ||
.toList(), | ||
label: "To '${region.storeName}'", | ||
), | ||
); | ||
} | ||
|
||
return PolygonLayer( | ||
polygons: map.entries | ||
.map( | ||
(e) => e.value | ||
.map( | ||
(region) => region.pointss.map( | ||
(points) => Polygon( | ||
points: points, | ||
color: e.key.toColor().withAlpha(255 ~/ 2), | ||
borderColor: e.key.toColor(), | ||
borderStrokeWidth: 2, | ||
label: region.label, | ||
labelPlacement: PolygonLabelPlacement.polylabel, | ||
), | ||
), | ||
) | ||
.flattened, | ||
) | ||
.flattened | ||
.toList(), | ||
); | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ary_view/contents/recovery/components/recoverable_regions_list/components/no_regions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class NoRegions extends StatelessWidget { | ||
const NoRegions({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) => SliverFillRemaining( | ||
hasScrollBody: false, | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12), | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const Icon(Icons.auto_fix_off, size: 42), | ||
const SizedBox(height: 12), | ||
Text( | ||
'No failed downloads', | ||
style: Theme.of(context).textTheme.titleLarge, | ||
), | ||
const SizedBox(height: 6), | ||
const Text( | ||
"If a download fails unexpectedly, it'll appear here! You can " | ||
'then finish the end of the download.', | ||
textAlign: TextAlign.center, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} |
Oops, something went wrong.