diff --git a/.gitignore b/.gitignore index 3820a95..ab644d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,45 +1,67 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp +# ----------------------------- +# OS / Editor +# ----------------------------- .DS_Store -.atom/ -.build/ -.buildlog/ -.history -.svn/ -.swiftpm/ -migrate_working_dir/ - -# IntelliJ related +*.swp +*.swo +*.tmp +*.orig +*.rej +.idea/ *.iml *.ipr *.iws -.idea/ -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ +# VS Code (keep shared recommendations if added) +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id +# ----------------------------- +# Dart / Flutter +# ----------------------------- .dart_tool/ +.flutter-plugins .flutter-plugins-dependencies -.pub-cache/ +.packages .pub/ +.pub-cache/ /build/ -/coverage/ +coverage/ +**/doc/api/ -# Symbolication related +# Generated symbol / map files app.*.symbols - -# Obfuscation related app.*.map.json -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release +# ----------------------------- +# Android +# ----------------------------- +android/.gradle/ +android/app/debug/ +android/app/profile/ +android/app/release/ + +# ----------------------------- +# iOS / macOS generated +# ----------------------------- +ios/Flutter/ephemeral/ +ios/Flutter/.last_build_id +ios/Pods/ +ios/.symlinks/ +ios/Runner.xcworkspace/xcuserdata/ +ios/Runner.xcodeproj/xcuserdata/ + +macos/Flutter/ephemeral/ +macos/Pods/ +macos/.symlinks/ +macos/Runner.xcworkspace/xcuserdata/ +macos/Runner.xcodeproj/xcuserdata/ + +# ----------------------------- +# Linux / Windows generated +# ----------------------------- +linux/flutter/ephemeral/ +windows/flutter/ephemeral/ diff --git a/docs/progress.md b/docs/progress.md index d377205..dc9058b 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -2,6 +2,11 @@ Updated: 2026-02-15 +## Workflow Rule + +- After every sensible change, the final step is a Git commit with a clear message. +- Keep changes in small, logical commits so future sessions can revert or continue safely. + ## Latest Milestone (2026-02-15): Product UI Flow Implemented The app now has a real multi-screen user experience on macOS (and other platforms), not just a placeholder screen. @@ -10,7 +15,8 @@ Delivered UI architecture: - App shell with responsive navigation: - desktop: left sidebar + content pane - - compact: bottom navigation + - compact: bottom navigation (reduced to 4 primary tabs) + - compact secondary actions (`Sync`, `Settings`) moved into a `More` menu to avoid tab overload on iOS/mobile - Views implemented: - Dashboard - People @@ -52,6 +58,50 @@ Validation status after UI milestone: - `flutter analyze` -> pass - `flutter test` -> pass +## Current Gap Analysis (2026-02-15) + +### What we have now + +- Backend gateway architecture with REST + fake implementations, typed DTOs, retries, refresh, and tests. +- OpenAPI + ADR documentation baseline. +- Product UI shell with responsive desktop/mobile navigation and key views. +- Offline-safe default behavior with fake backend mode. + +### What is still missing + +- Local database persistence and repository wiring (currently demo in-memory data). +- Full CRUD flows (create/edit/delete) for people, captures, reminder rules, gift/event ideas. +- Auth UX flows (sign-in, session-expired recovery, sign-out confirmation). +- Real sync orchestration layer (queue, cursor lifecycle, conflict policy UI). +- Notifications/reminders delivery and scheduling integration. +- End-to-end and integration tests for app flows beyond unit/widget basics. + +## Implementation Plan (Next) + +### Phase 1: Data Foundation + +1. Introduce local DB schema + repository interfaces for core entities. +2. Replace `LocalRepository` demo data with persisted data access. +3. Add migration/test coverage for DB reads/writes. + +### Phase 2: Core Product Flows + +1. Build People CRUD and detail editing screens. +2. Build Moments/Captures create-and-list workflows. +3. Add Ideas and Reminder Rule management. + +### Phase 3: Sync + Auth UX + +1. Add sync queue service and cursor management use cases. +2. Add conflict handling strategy and UI states. +3. Implement sign-in/session lifecycle screens and provider state. + +### Phase 4: Quality + Release Readiness + +1. Add CI for analyze/test and optional build smoke checks. +2. Expand widget/integration tests for primary user journeys. +3. Add observability hooks and production hardening pass. + ## Current Status The Flutter app now includes a production-grade backend integration scaffold with an offline-first posture: diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..37cd4a7 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,23 @@ +PODS: + - Flutter (1.0.0) + - flutter_secure_storage_darwin (10.0.0): + - Flutter + - FlutterMacOS + +DEPENDENCIES: + - Flutter (from `Flutter`) + - flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + flutter_secure_storage_darwin: + :path: ".symlinks/plugins/flutter_secure_storage_darwin/darwin" + +SPEC CHECKSUMS: + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23 + +PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e + +COCOAPODS: 1.16.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index beb9f5f..f2008f7 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,8 +8,10 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 15BE7299C8BED38E2BC0A6A0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C88FBC0E3BAB70074730065 /* Pods_Runner.framework */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 5E1E9B720DF095CAC1A2FF8A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD3F9117486EC23DF50E2D6A /* Pods_RunnerTests.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -41,15 +43,19 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0E770A251CA9930160492DC4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 4C88FBC0E3BAB70074730065 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6881917E7D40106AEFE87622 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9708213885153303B111D6D9 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -57,6 +63,10 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9B7CFEE2CE4B7B1DCB85B3E1 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + CD3F9117486EC23DF50E2D6A /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E9B506D809ABF2A50BF6135B /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + F2C7EE505B336533B62B23EB /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -64,6 +74,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15BE7299C8BED38E2BC0A6A0 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E2BAEB33085D4BFE88A55D45 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5E1E9B720DF095CAC1A2FF8A /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -78,6 +97,29 @@ path = RunnerTests; sourceTree = ""; }; + 3D195739A0A78D037BF244F8 /* Pods */ = { + isa = PBXGroup; + children = ( + E9B506D809ABF2A50BF6135B /* Pods-Runner.debug.xcconfig */, + 9B7CFEE2CE4B7B1DCB85B3E1 /* Pods-Runner.release.xcconfig */, + 0E770A251CA9930160492DC4 /* Pods-Runner.profile.xcconfig */, + F2C7EE505B336533B62B23EB /* Pods-RunnerTests.debug.xcconfig */, + 9708213885153303B111D6D9 /* Pods-RunnerTests.release.xcconfig */, + 6881917E7D40106AEFE87622 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 4AB2C4F013679895B559EE42 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4C88FBC0E3BAB70074730065 /* Pods_Runner.framework */, + CD3F9117486EC23DF50E2D6A /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -96,6 +138,8 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, + 3D195739A0A78D037BF244F8 /* Pods */, + 4AB2C4F013679895B559EE42 /* Frameworks */, ); sourceTree = ""; }; @@ -131,8 +175,10 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 38116227E31B7524BBB62C35 /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, + E2BAEB33085D4BFE88A55D45 /* Frameworks */, ); buildRules = ( ); @@ -148,12 +194,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 79CC25B0ACE153A200E6F4FE /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 6F8015E3E410C301706C3C43 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -225,6 +273,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 38116227E31B7524BBB62C35 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -241,6 +311,45 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 6F8015E3E410C301706C3C43 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 79CC25B0ACE153A200E6F4FE /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -383,6 +492,7 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = F2C7EE505B336533B62B23EB /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -400,6 +510,7 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9708213885153303B111D6D9 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -415,6 +526,7 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6881917E7D40106AEFE87622 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/lib/features/home/app_shell.dart b/lib/features/home/app_shell.dart index cf80c6a..128fc24 100644 --- a/lib/features/home/app_shell.dart +++ b/lib/features/home/app_shell.dart @@ -19,18 +19,24 @@ class _AppShellState extends ConsumerState { int _index = 0; static const List<_ShellDestination> _destinations = <_ShellDestination>[ - _ShellDestination('Dashboard', Icons.dashboard_rounded), - _ShellDestination('People', Icons.people_alt_rounded), - _ShellDestination('Moments', Icons.auto_awesome_rounded), - _ShellDestination('Signals', Icons.tips_and_updates_rounded), - _ShellDestination('Sync', Icons.sync_rounded), - _ShellDestination('Settings', Icons.settings_rounded), + _ShellDestination('Dashboard', Icons.dashboard_rounded, 0), + _ShellDestination('People', Icons.people_alt_rounded, 1), + _ShellDestination('Moments', Icons.auto_awesome_rounded, 2), + _ShellDestination('Signals', Icons.tips_and_updates_rounded, 3), + _ShellDestination('Sync', Icons.sync_rounded, 4), + _ShellDestination('Settings', Icons.settings_rounded, 5), ]; + static const List<_ShellDestination> _compactPrimaryDestinations = + <_ShellDestination>[ + _ShellDestination('Dashboard', Icons.dashboard_rounded, 0), + _ShellDestination('People', Icons.people_alt_rounded, 1), + _ShellDestination('Moments', Icons.auto_awesome_rounded, 2), + _ShellDestination('Signals', Icons.tips_and_updates_rounded, 3), + ]; + @override Widget build(BuildContext context) { - final Widget body = _screenFor(_index); - return DecoratedBox( decoration: const BoxDecoration( gradient: LinearGradient( @@ -49,15 +55,36 @@ class _AppShellState extends ConsumerState { child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { if (constraints.maxWidth < 1000) { + final int compactIndex = _compactSelectedIndex(_index); + final _ShellDestination active = + _compactPrimaryDestinations[compactIndex]; return _CompactShell( - index: _index, - body: body, - destinations: _destinations, + title: active.label, + index: compactIndex, + body: _screenFor(active.screenIndex), + destinations: _compactPrimaryDestinations, onChange: (int value) { setState(() { - _index = value; + _index = _compactPrimaryDestinations[value].screenIndex; }); }, + onOpenSecondary: (_SecondaryDestination destination) { + final int screenIndex = switch (destination) { + _SecondaryDestination.sync => 4, + _SecondaryDestination.settings => 5, + }; + + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) { + return _CompactSecondaryScreen( + title: _destinations[screenIndex].label, + child: _screenFor(screenIndex), + ); + }, + ), + ); + }, ); } @@ -77,7 +104,7 @@ class _AppShellState extends ConsumerState { duration: const Duration(milliseconds: 250), child: KeyedSubtree( key: ValueKey(_index), - child: body, + child: _screenFor(_index), ), ), ), @@ -90,6 +117,15 @@ class _AppShellState extends ConsumerState { ); } + int _compactSelectedIndex(int fullIndex) { + for (int i = 0; i < _compactPrimaryDestinations.length; i += 1) { + if (_compactPrimaryDestinations[i].screenIndex == fullIndex) { + return i; + } + } + return 0; + } + Widget _screenFor(int index) { switch (index) { case 0: @@ -227,22 +263,60 @@ class _Sidebar extends StatelessWidget { class _CompactShell extends StatelessWidget { const _CompactShell({ + required this.title, required this.index, required this.body, required this.destinations, required this.onChange, + required this.onOpenSecondary, }); + final String title; final int index; final Widget body; final List<_ShellDestination> destinations; final ValueChanged onChange; + final ValueChanged<_SecondaryDestination> onOpenSecondary; @override Widget build(BuildContext context) { return Column( children: [ - Expanded(child: body), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: Row( + children: [ + Expanded( + child: Text( + title, + style: Theme.of(context).textTheme.titleLarge, + ), + ), + PopupMenuButton<_SecondaryDestination>( + tooltip: 'More', + icon: const Icon(Icons.more_horiz_rounded), + onSelected: onOpenSecondary, + itemBuilder: (BuildContext context) => + >[ + const PopupMenuItem<_SecondaryDestination>( + value: _SecondaryDestination.sync, + child: Text('Sync'), + ), + const PopupMenuItem<_SecondaryDestination>( + value: _SecondaryDestination.settings, + child: Text('Settings'), + ), + ], + ), + ], + ), + ), + Expanded( + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 220), + child: KeyedSubtree(key: ValueKey(index), child: body), + ), + ), NavigationBar( selectedIndex: index, onDestinationSelected: onChange, @@ -260,9 +334,37 @@ class _CompactShell extends StatelessWidget { } } +class _CompactSecondaryScreen extends StatelessWidget { + const _CompactSecondaryScreen({required this.title, required this.child}); + + final String title; + final Widget child; + + @override + Widget build(BuildContext context) { + return DecoratedBox( + decoration: const BoxDecoration( + gradient: LinearGradient( + colors: [Color(0xFFF3F8FB), Color(0xFFEAF1F8)], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar(title: Text(title)), + body: child, + ), + ); + } +} + +enum _SecondaryDestination { sync, settings } + class _ShellDestination { - const _ShellDestination(this.label, this.icon); + const _ShellDestination(this.label, this.icon, this.screenIndex); final String label; final IconData icon; + final int screenIndex; }