Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/ navigation remake attempt #118

Merged
merged 7 commits into from
Aug 3, 2024

Conversation

simon-the-shark
Copy link
Member

@simon-the-shark simon-the-shark commented Aug 1, 2024

Preview

WhatsApp.Video.2024-08-01.at.22.39.40.mp4

PR Desc

Small remake of the navigation (yet again:))

  1. small animations/transitions changes, but this can be easily changeable
  • tab bar has slide + fade (prev only slide)
  • details have slide from bottom
  • both have 200ms duration
  1. Refactor to type-safe generated routes with auto_route and other small refactoring.
  2. Now we preserve state of every route - hopefully flutter will handle big and fat statefull navigation stack (my device didn't have any issues in tests) - but it's something to have in mind the future (I have ideas for potencial fixes, but they introduce some complexity)
  3. Behaviour/principials changes:
  • we pop detail views only when we change tab using bottom navbar. ONLY. This means no popping in other cases like "lista >' button in some other detail view
  • we only change tabs when explicitly asked. So when we enter detail view from homescreen directly (or from other detail view) - we do not change tab. We change tabs only when using bottom navbar and "lista >" ref buttons etc.

tell me what you think

@simon-the-shark simon-the-shark self-assigned this Aug 1, 2024
@simon-the-shark simon-the-shark force-pushed the refactor/navigation-remake branch from eece632 to cfe9917 Compare August 3, 2024 12:41
@simon-the-shark
Copy link
Member Author

simon-the-shark commented Aug 3, 2024

NOTE: #130 reverses detail views transition builder to default one

Copy link
Member

@mikolaj-jalocha mikolaj-jalocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work here. I'm not a navigation Sensei here but even for me (beginner in complex Flutter's concepts, eg. navigation 🙃) everything looks nice and cool. Personally I didn't notice sth strange.

I checked the auto_route lib, excellent in docs and easy-to-use. Wejust need to add annotation and configure route in controller... Good choice I guess. WDYT about updating readme? Even with some refrence to docs, like with internalization module.

In my opinion the nav stack in typical scenario won't be extremely large. So this should not be the problem. Even Android Studio emulator did well.

We could always think of adding feature for tracking app performance and watch the behaviour on prod. Once I read sth about it here. Wonder what u think ;)

Comment on lines 4 to 11
abstract class TransitionsConfig {
static const durationInMiliseconds = 200;
static const detailDurationInMiliseconds = 200;
static const slideLeftBuilder = TransitionsBuilders.slideLeftWithFade;
static const slideRightBuilder = TransitionsBuilders.slideRightWithFade;
static const fallbackBuilder = TransitionsBuilders.fadeIn;
static const detailViewBuilder = TransitionsBuilders.slideBottom;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually very good that they're parametrized in one section. Imo UX's nice.

@@ -73,7 +70,7 @@ class _DataListBuildingsTiles extends ConsumerWidget {
buildingName: mapItem.name,
imageUrl: mapItem.cover?.filename_disk?.directusUrl,
onTap: () async {
await BuildingsSection.goToMapTab(ref);
unawaited(ref.navigateBuildings());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unawaited here's very very nice since we don't use the Future

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter screams if you don't do it :) now you have to either await the future or unwait

@@ -0,0 +1,47 @@
import "package:flutter_riverpod/flutter_riverpod.dart";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I was wondering "from where the ref.navigateHome() come from" extremely useful extension here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've been playing around with different approaches and this in one place was usefull when making any changes

@simon-the-shark
Copy link
Member Author

simon-the-shark commented Aug 3, 2024

Thanks for checking out the changes. Readme link is a good idea too. And about the navigation stack, let's hope for now that flutter handle it well on its own. And yeah, performance and crashlytics are probably a must have before production

@simon-the-shark simon-the-shark merged commit e419a3b into main Aug 3, 2024
2 checks passed
@simon-the-shark simon-the-shark deleted the refactor/navigation-remake branch August 3, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants