Skip to content

Commit

Permalink
on temp location map marker tap show details bottom sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
LGro committed Jun 4, 2024
1 parent 43f05cc commit 1ecb6a2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/ui/map/cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Iterable<Location> contactToLocations(CoagContact contact) =>
label:
contact.details?.displayName ?? contact.systemContact!.displayName,
subLabel: l.name,
details: '',
marker: MarkerType.address));

Location temporaryLocationToLocation(
Expand All @@ -35,6 +36,7 @@ Location temporaryLocationToLocation(
subLabel: l.name,
longitude: l.longitude,
latitude: l.latitude,
details: '${l.start} - ${l.end}\nDetails: ${l.details}',
marker: MarkerType.temporary);

class MapCubit extends Cubit<MapState> {
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/map/cubit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions lib/ui/map/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,26 @@ class MapPage extends StatelessWidget {
Brightness.dark,
// TODO: Only add on tap action for other contacts, not the profile contact
// TODO: Style profile contact locations differently
onTap: (false)
? () {}
onTap: (location.marker == MarkerType.temporary)
? () async => showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
builder: (modalContext) => Padding(
padding: EdgeInsets.only(
left: 16,
top: 16,
right: 16,
bottom: 12 +
MediaQuery.of(modalContext)
.viewInsets
.bottom),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(location.details)
])))
: () {
unawaited(Navigator.push(
context,
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/map/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Location {
required this.latitude,
required this.label,
required this.subLabel,
required this.details,
required this.marker,
});
factory Location.fromJson(Map<String, dynamic> json) =>
Expand All @@ -32,6 +33,7 @@ class Location {
final double latitude;
final String label;
final String subLabel;
final String details;
final MarkerType marker;
Map<String, dynamic> toJson() => _$LocationToJson(this);
}
Expand Down

0 comments on commit 1ecb6a2

Please sign in to comment.