Closed Jhalakupadhyay closed 3 weeks ago
This PR refactors the navigation system by introducing a MainScreen widget that manages a single instance of each screen through an IndexedStack, replacing the previous navigation-based approach. The changes improve the app's architecture by centralizing navigation control and screen management.
sequenceDiagram
actor User
participant MainScreen
participant CommonDrawer
participant Navigator
User ->> CommonDrawer: Tap on drawer item
CommonDrawer ->> MainScreen: onTap(index)
MainScreen ->> MainScreen: setState()
MainScreen ->> MainScreen: updateOrientation()
MainScreen ->> Navigator: pop()
Navigator -->> User: Update UI based on currentIndex
classDiagram
class MainScreen {
+int currentIndex
+List<String> appBarTitles
+void initState()
+void onDrawerItemTapped(int index)
+void updateOrientation()
+void dispose()
+Widget build(BuildContext context)
}
class CommonDrawer {
+Function(int) onTap
+int selectedIndex
+Widget build(BuildContext context)
}
MainScreen --> CommonDrawer : uses
Change | Details | Files |
---|---|---|
Introduced a new MainScreen widget to manage screen navigation and state |
|
lib/view/main_screen.dart lib/main.dart |
Refactored the navigation drawer implementation |
|
lib/view/widgets/navigation_drawer.dart |
Simplified CommonScaffold widget and screen implementations |
|
lib/view/widgets/common_scaffold_widget.dart lib/view/about_us_screen.dart lib/view/draw_badge_screen.dart lib/view/homescreen.dart lib/view/save_badge_screen.dart lib/view/saved_clipart.dart lib/view/settings_screen.dart |
1082
Summary by Sourcery
Refactor the navigation drawer to maintain a single instance of each class, improving state management and reducing redundancy in navigation logic.
Bug Fixes:
Enhancements: