-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feat/ animate maps camera #351
Conversation
2bfbea6
to
a8391f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nicely worked-around.
Left few questions.
@@ -27,7 +29,9 @@ class BuildingTile extends ConsumerWidget { | |||
subtitle: context.changeNull(building.addressFormatted), | |||
isActive: isActive, | |||
onTap: () { | |||
ref.read(buildingsMapControllerProvider.notifier).onMarkerTap(building); | |||
unawaited( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this unawaited here because of linter complaints, or sth changed in whole logic that now it's async
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it wasn't async and now it is due to few reasons:
- we do not have controller straight away, we use
Completer
and await its completion - animation also takes time and is async, and previously camera jump wasn't async
@@ -35,7 +37,9 @@ class BuildingsView extends ConsumerWidget { | |||
point: item.location, | |||
child: GestureDetector( | |||
onTap: () { | |||
ref.read(buildingsMapControllerProvider.notifier).onMarkerTap(item); | |||
unawaited( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
fl_map.MapController build() { | ||
return fl_map.MapController(); | ||
// nasty, but no other option I think | ||
final _controllerCompleter = Completer<AnimatedMapController>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this Completer
here because of build errors? Or could we just create AnimatedMapController.future
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completer is just a native dart way to await somewhere until someother part of the code completes with value (in very imperative way with .complete(value)
- so imo ideal way in this example. But sure, there are few alternative ways to handle this. Riverpod provider could be a solution too, but more bulky
Nagranie.z.ekranu.2024-10-27.o.23.55.51.mov