mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2026-03-24 04:46:56 +00:00
[PR #3459] [MERGED] feat: go_router refactor and bottom navigation bar in mobile #5731
Labels
No labels
2024
2025
2026
acct mgmt
AI
automation
bug
calendar
ci
CJK
cloud
code-block
collaboration
copy-paste
database
data migration
data sync
deploy
desktop
develop
develop
documentation
duplicate
editor
editor-plugin
emoji
export
files
flutter-only
follow-up
formula
good first issue for devs
good first issue for experienced devs
grid
hacktoberfest
HACKTOBERFEST-ACCEPTED
help wanted
i18n
icons
images
importer
improvements
infra
install
integrations
IR
kanban board
login
look and joy
mentorship
mobile
mobile
needs design
new feature
new feature
non-coding
notes
notifications
onboarding
organization
P0+
permission
platform-linux
platform-mac
platform-windows
plugins
program
pull-request
Q1 25
Q1 26
Q2 24
Q2 25
Q3 24
Q3 25
Q4 24
Q4 25
react
regression
rust
rust
Rust-only
Rust-only
Rust-starter
Rust-starter
self-hosted
shortcuts
side panel
slash-menu
sync v2
table
tablet
task
tauri
templates
tests
themes
translation
v0.5.6
v0.5.8
v0.5.9
v0.6.0
v0.6.1
v0.6.4
v0.6.7
v0.6.8
v0.7.1
v0.7.4
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.8.0
v0.8.4
v0.8.5
v0.8.9
web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AppFlowy-IO/AppFlowy#5731
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/3459
Author: @hyj1204
Created: 9/19/2023
Status: ✅ Merged
Merged: 9/28/2023
Merged by: @LucasXu0
Base:
main← Head:feat/navigation_refactor📝 Commits (10+)
5b58f5brefactor: refactor navigator in auth pages to go_router0111bc3feat: add bottom navigation bar as StatefulShellRoute0a184b4chore: remove unused import filese760e71feat: add mobile icons and improve appbar in home page75f0a01chore: clean code and remove unused import filesd72f54efix: flutter analyze9783708chore: make arguments name as const67deb2cchore: extract routes methods6caa061chore: add comments and delete unnecessary key76f0279chore: update key value to const📊 Changes
38 files changed (+894 additions, -277 deletions)
View changed files
📝
frontend/appflowy_flutter/lib/mobile/application/mobile_theme_data.dart(+14 -2)➕
frontend/appflowy_flutter/lib/mobile/presentation/details_placeholder_page.dart(+99 -0)➕
frontend/appflowy_flutter/lib/mobile/presentation/home/home.dart(+1 -0)➕
frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart(+80 -0)➕
frontend/appflowy_flutter/lib/mobile/presentation/mobile_bottom_navigation_bar.dart(+94 -0)➖
frontend/appflowy_flutter/lib/mobile/presentation/mobile_home_page.dart(+0 -47)➕
frontend/appflowy_flutter/lib/mobile/presentation/presentation.dart(+4 -0)➕
frontend/appflowy_flutter/lib/mobile/presentation/root_placeholder_page.dart(+54 -0)📝
frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart(+28 -10)➕
frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart(+296 -0)📝
frontend/appflowy_flutter/lib/startup/tasks/prelude.dart(+1 -0)📝
frontend/appflowy_flutter/lib/user/presentation/helpers/handle_user_profile_result.dart(+8 -8)📝
frontend/appflowy_flutter/lib/user/presentation/helpers/helpers.dart(+1 -1)📝
frontend/appflowy_flutter/lib/user/presentation/router.dart(+48 -114)📝
frontend/appflowy_flutter/lib/user/presentation/screens/encrypt_secret_screen.dart(+5 -1)📝
frontend/appflowy_flutter/lib/user/presentation/screens/screens.dart(+1 -0)📝
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/sign_in_screen.dart(+5 -3)📝
frontend/appflowy_flutter/lib/user/presentation/screens/skip_log_in_screen.dart(+2 -6)📝
frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart(+11 -10)📝
frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart(+4 -0)...and 18 more files
📄 Description
Feature Preview
Navigator.push. I usego_routerpackage mainly for navigation on mobile. The authentication workflow is still the same as the previous code, the only difference is I addcontext.goto replace the previous page(same asNavigator.pushReplacement), so the splash screen will be replaced by home page after the user login. On the home page, if the user clicks 'back' (android back button), the app will quit instead of back to login/skipLoginPage.SplashScreen. Due to it is the root page of the app, I set'/'as its routeName.go_router) are registed inappflowy_flutter/lib/startup/tasks/generate_router.dartI utilized the StatefulShellRoute.indexedStack to build the bottom navigation bar. This approach enables each tab to retain its own state, as demonstrated in the following video.
Currently, every tab page is just some example code and I will implement them in the future.
https://github.com/AppFlowy-IO/AppFlowy/assets/14248245/26aef070-ca76-4f7e-9b9d-633df8163ad4
go_router note:
When it comes to passing the arguments between the pages. I set
extrato aMap<String, dynamic>to carry all the arguments, then get it from thestateinpageBuilder.Set argument names as constant(start with arg) on the screen page, then use them as the key in the
Map<String, dynamic>.Pass this
Map<String, dynamic>asextrato GoRoute.Head part and constructor of
DesktopHomeScreenpageBuilderThis is my first time using the "go_router" package in the project. Please let me know if there are any issues or a better way to implement it.
PR Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.