├── .github └── workflows │ └── flutter.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example ├── README.md └── simple_login │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── esarbanis │ │ │ │ └── simplelogin │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle │ ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── main.m │ ├── lib │ ├── main.dart │ └── src │ │ ├── app_store.dart │ │ ├── dashboard │ │ ├── dashboard_bloc.dart │ │ └── dashboard_page.dart │ │ ├── login │ │ ├── login_bloc.dart │ │ └── login_page.dart │ │ └── simple_login_app.dart │ └── pubspec.yaml ├── generate_changelog.sh ├── lib ├── flutter_redux_navigation.dart └── src │ ├── navigate_to_action.dart │ ├── navigation_destination.dart │ ├── navigation_holder.dart │ ├── navigation_middleware.dart │ └── navigation_state.dart ├── pubspec.lock ├── pubspec.yaml └── test └── src ├── navigate_to_action_test.dart ├── navigation_middleware_test.dart └── navigation_state_test.dart /.github/workflows/flutter.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: Flutter 7 | 8 | on: 9 | push: 10 | branches: [ "master" ] 11 | pull_request: 12 | branches: [ "master" ] 13 | 14 | jobs: 15 | basic-checks: 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | 21 | - uses: subosito/flutter-action@v2 22 | with: 23 | flutter-version: '3.13.9' 24 | channel: 'stable' 25 | 26 | - name: Install dependencies 27 | run: flutter pub get 28 | 29 | # Uncomment this step to verify the use of 'dart format' on each commit. 30 | - name: Verify formatting 31 | run: dart format --output=none --set-exit-if-changed . 32 | 33 | # Consider passing '--fatal-infos' for slightly stricter analysis. 34 | - name: Analyze project source 35 | run: flutter analyze 36 | 37 | # Your project will need to have tests in test/ and a dependency on 38 | # package:test for this step to succeed. Note that Flutter projects will 39 | # want to change this to 'flutter test'. 40 | - name: Run tests 41 | run: flutter test 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | ios/.generated/ 9 | ios/Flutter/Generated.xcconfig 10 | ios/Runner/GeneratedPluginRegistrant.* 11 | 12 | .idea/ 13 | *.iml 14 | 15 | lib/generated/ 16 | res/values/ 17 | 18 | # Ignore VS Code settings files 19 | .vscode/ -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 58c8489fcdb4e4ef6c010117584c9b23d15221aa 8 | channel: beta 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [v0.7.1](https://github.com/flutterings/flutter_redux_navigation/tree/v0.7.1) (2022-01-19) 4 | 5 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.7.0...v0.7.1) 6 | 7 | **Closed issues:** 8 | 9 | - Support Redux 5.0.0 [\#23](https://github.com/flutterings/flutter_redux_navigation/issues/23) 10 | - How to dispatch a navigation action during widget build? [\#19](https://github.com/flutterings/flutter_redux_navigation/issues/19) 11 | - Navigation Called Twice [\#16](https://github.com/flutterings/flutter_redux_navigation/issues/16) 12 | - Wrong paths using navigation replace. [\#4](https://github.com/flutterings/flutter_redux_navigation/issues/4) 13 | 14 | **Merged pull requests:** 15 | 16 | - Add alias so NavigationDestination does not break [\#26](https://github.com/flutterings/flutter_redux_navigation/pull/26) ([leonardo2204](https://github.com/leonardo2204)) 17 | 18 | ## [v0.7.0](https://github.com/flutterings/flutter_redux_navigation/tree/v0.7.0) (2021-04-14) 19 | 20 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.6.0...v0.7.0) 21 | 22 | **Closed issues:** 23 | 24 | - Null safety [\#22](https://github.com/flutterings/flutter_redux_navigation/issues/22) 25 | - Please update to dependency version 5.0.0 of redux [\#21](https://github.com/flutterings/flutter_redux_navigation/issues/21) 26 | 27 | **Merged pull requests:** 28 | 29 | - Make the NavigationMiddleware constructor const [\#20](https://github.com/flutterings/flutter_redux_navigation/pull/20) ([hacker1024](https://github.com/hacker1024)) 30 | 31 | ## [v0.6.0](https://github.com/flutterings/flutter_redux_navigation/tree/v0.6.0) (2020-04-05) 32 | 33 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.5.1...v0.6.0) 34 | 35 | **Closed issues:** 36 | 37 | - Accessing route arguments from NavigatorHolder [\#17](https://github.com/flutterings/flutter_redux_navigation/issues/17) 38 | - Please do a new release [\#15](https://github.com/flutterings/flutter_redux_navigation/issues/15) 39 | 40 | **Merged pull requests:** 41 | 42 | - Keep track of previous and current arguments for named routes. [\#18](https://github.com/flutterings/flutter_redux_navigation/pull/18) ([Erfa](https://github.com/Erfa)) 43 | 44 | ## [v0.5.1](https://github.com/flutterings/flutter_redux_navigation/tree/v0.5.1) (2020-01-06) 45 | 46 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.5.0...v0.5.1) 47 | 48 | **Closed issues:** 49 | 50 | - Navigator.popUntil [\#11](https://github.com/flutterings/flutter_redux_navigation/issues/11) 51 | 52 | **Merged pull requests:** 53 | 54 | - Add support for popUntil action. [\#14](https://github.com/flutterings/flutter_redux_navigation/pull/14) ([lukevenediger](https://github.com/lukevenediger)) 55 | 56 | ## [v0.5.0](https://github.com/flutterings/flutter_redux_navigation/tree/v0.5.0) (2019-12-30) 57 | 58 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.4.1...v0.5.0) 59 | 60 | **Closed issues:** 61 | 62 | - support for redux 4.0.0 [\#12](https://github.com/flutterings/flutter_redux_navigation/issues/12) 63 | 64 | **Merged pull requests:** 65 | 66 | - feat\(redux\): update redux dependency to 4.0.0 [\#13](https://github.com/flutterings/flutter_redux_navigation/pull/13) ([esarbanis](https://github.com/esarbanis)) 67 | 68 | ## [v0.4.1](https://github.com/flutterings/flutter_redux_navigation/tree/v0.4.1) (2019-04-19) 69 | 70 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.4.0...v0.4.1) 71 | 72 | **Closed issues:** 73 | 74 | - Replacement for pushNamedAndRemoveUntil [\#6](https://github.com/flutterings/flutter_redux_navigation/issues/6) 75 | 76 | ## [v0.4.0](https://github.com/flutterings/flutter_redux_navigation/tree/v0.4.0) (2019-03-21) 77 | 78 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.3.3...v0.4.0) 79 | 80 | **Closed issues:** 81 | 82 | - Arguments [\#1](https://github.com/flutterings/flutter_redux_navigation/issues/1) 83 | 84 | ## [v0.3.3](https://github.com/flutterings/flutter_redux_navigation/tree/v0.3.3) (2019-03-14) 85 | 86 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.3.2...v0.3.3) 87 | 88 | ## [v0.3.2](https://github.com/flutterings/flutter_redux_navigation/tree/v0.3.2) (2019-03-12) 89 | 90 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/v0.3.1...v0.3.2) 91 | 92 | ## [v0.3.1](https://github.com/flutterings/flutter_redux_navigation/tree/v0.3.1) (2019-03-03) 93 | 94 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.3.0...v0.3.1) 95 | 96 | ## [0.3.0](https://github.com/flutterings/flutter_redux_navigation/tree/0.3.0) (2019-01-06) 97 | 98 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.2.0...0.3.0) 99 | 100 | ## [0.2.0](https://github.com/flutterings/flutter_redux_navigation/tree/0.2.0) (2019-01-04) 101 | 102 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.1.1...0.2.0) 103 | 104 | ## [0.1.1](https://github.com/flutterings/flutter_redux_navigation/tree/0.1.1) (2018-12-28) 105 | 106 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.1.0...0.1.1) 107 | 108 | ## [0.1.0](https://github.com/flutterings/flutter_redux_navigation/tree/0.1.0) (2018-12-28) 109 | 110 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.0.3...0.1.0) 111 | 112 | ## [0.0.3](https://github.com/flutterings/flutter_redux_navigation/tree/0.0.3) (2018-12-28) 113 | 114 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.0.2...0.0.3) 115 | 116 | ## [0.0.2](https://github.com/flutterings/flutter_redux_navigation/tree/0.0.2) (2018-12-28) 117 | 118 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/0.0.1...0.0.2) 119 | 120 | ## [0.0.1](https://github.com/flutterings/flutter_redux_navigation/tree/0.0.1) (2018-12-28) 121 | 122 | [Full Changelog](https://github.com/flutterings/flutter_redux_navigation/compare/d1c0678b1a74eb4f9000b1b06f31f222ca5a5f20...0.0.1) 123 | 124 | 125 | 126 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 127 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Efthymis Sarmpanis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/flutterings/flutter_redux_navigation.svg?branch=master)](https://travis-ci.org/flutterings/flutter_redux_navigation) 2 | [![codecov](https://codecov.io/gh/flutterings/flutter_redux_navigation/branch/master/graph/badge.svg)](https://codecov.io/gh/flutterings/flutter_redux_navigation) 3 | 4 | # Flutter Navigation for redux 5 | 6 | Navigation Middleware for Flutter's redux library. 7 | 8 | Basic classes that enables page navigation through by utilizing [Redux](https://pub.dartlang.org/packages/redux) Store middleware facility. 9 | 10 | This package is built to work with [Redux.dart](https://pub.dartlang.org/packages/redux) 4.0.0+. 11 | 12 | ## Redux Middleware 13 | 14 | * `NavigationMiddleware` - The Middleware that reacts to `NavigateToAction`s. 15 | 16 | ## Examples 17 | 18 | Take a look in the [examples](example) directory. 19 | 20 | ## How to setup navigation 21 | 22 | ```dart 23 | import 'package:flutter/material.dart'; 24 | import 'package:redux/redux.dart'; 25 | 26 | class AppState { 27 | final String name; 28 | 29 | const AppState(this.name); 30 | 31 | factory AppState.initial() => AppState(null); 32 | factory AppState.changeName(String name) => AppState(name); 33 | } 34 | 35 | class AppNameChangedAction { 36 | final String name; 37 | 38 | AppNameChangedAction(this.name); 39 | } 40 | 41 | AppState _onAppNameChanged(AppState state, AppNameChangedAction action) => 42 | state.changeName(action.name); 43 | 44 | final appReducer = combineReducers([ 45 | TypedReducer(_onAppNameChanged), 46 | ]); 47 | 48 | 49 | final store = new Store(combineReducers([appReducer]), 50 | initialState: AppState.initial(), 51 | middleware: [ 52 | NavigationMiddleware(), 53 | ]); 54 | 55 | class MyApp extends StatelessWidget { 56 | @override 57 | Widget build(BuildContext context) { 58 | return StoreProvider( 59 | store: store, 60 | child: MaterialApp( 61 | title: 'My App', 62 | navigatorKey: NavigatorHolder.navigatorKey, 63 | ) 64 | ); 65 | } 66 | } 67 | 68 | void main() => runApp(MyApp()); 69 | ``` 70 | 71 | ## How to navigate 72 | 73 | Let's say you wish to navigate from a `LoginPage` to some dashboard page, you only need to dispatch a `NavigateToAction.replace` action with the appropriate path, which is registered to the dashboard page. 74 | 75 | ```dart 76 | import 'package:flutter/material.dart'; 77 | import 'package:flutter_redux/flutter_redux.dart'; 78 | 79 | class LoginPage extends StatefulWidget { 80 | @override 81 | State createState() => LoginPageState(); 82 | } 83 | 84 | class LoginPageState extends State { 85 | @override 86 | Widget build(BuildContext context) { 87 | return StoreConnector( 88 | converter: (store) { 89 | return store; 90 | }, 91 | builder: (BuildContext context, Store store) { 92 | return Scaffold(body: Builder( 93 | builder: (BuildContext context) { 94 | return Column( 95 | mainAxisAlignment: MainAxisAlignment.center, 96 | children: [ 97 | RaisedButton( 98 | onPressed: () { 99 | store.dispatch(NavigateToAction.replace('/dashboard')); 100 | }, 101 | child: Text('Login'), 102 | ) 103 | ], 104 | ); 105 | }, 106 | )); 107 | }, 108 | ); 109 | } 110 | } 111 | ``` 112 | 113 | ## How to use pre and post navigation hooks 114 | 115 | Let's use the same example as before, but now let's assume that you want to start a loader whilst navigating to the dashboard and stop it once you have navigated. 116 | 117 | ```dart 118 | import 'package:flutter/material.dart'; 119 | import 'package:flutter_redux/flutter_redux.dart'; 120 | 121 | class LoginPage extends StatefulWidget { 122 | @override 123 | State createState() => LoginPageState(); 124 | } 125 | 126 | class LoginPageState extends State { 127 | @override 128 | Widget build(BuildContext context) { 129 | return StoreConnector( 130 | converter: (store) { 131 | return store; 132 | }, 133 | builder: (BuildContext context, Store store) { 134 | return Scaffold(body: Builder( 135 | builder: (BuildContext context) { 136 | return Column( 137 | mainAxisAlignment: MainAxisAlignment.center, 138 | children: [ 139 | RaisedButton( 140 | onPressed: () { 141 | store.dispatch( 142 | NavigateToAction.replace( 143 | '/dashboard', 144 | preNavigation: () => store.dispatch(StartLoadingAction()), 145 | postNavigation: () => store.dispatch(StopLoadingAction()), 146 | ), 147 | ); 148 | }, 149 | child: Text('Login'), 150 | ) 151 | ], 152 | ); 153 | }, 154 | )); 155 | }, 156 | ); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | * [Simple Login Example](https://github.com/esarbanis/flutter_redux_navigation/tree/master/example/simple_login) - A simple example to demonstrate the replacement navigation through `NavigationToAction`s. 4 | -------------------------------------------------------------------------------- /example/simple_login/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /example/simple_login/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: a226c0f0d9f5d699a3d706fd9060edf6da45b13b 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/simple_login/README.md: -------------------------------------------------------------------------------- 1 | # simple_login 2 | 3 | Example Application to display the navigation replacement functionality. 4 | 5 | ## Usage 6 | Run the application as any other flutter application and boot up your emulator (or physical device). 7 | 8 | Press on the `Login` button in the 'Login Page' and you will be redirected to the 'Dashboard Page', with no back button. 9 | 10 | Press on the `Logout` button on the 'Dashboard Page' and you will be redirected to the 'Login Page' with no back button. -------------------------------------------------------------------------------- /example/simple_login/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "io.github.esarbanis.simplelogin" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/java/io/github/esarbanis/simplelogin/MainActivity.java: -------------------------------------------------------------------------------- 1 | package io.github.esarbanis.simplelogin; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/simple_login/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/simple_login/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/simple_login/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/simple_login/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/simple_login/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/simple_login/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/simple_login/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/simple_login/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 9740EEB11CF90186004384FC /* Flutter */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 77 | 3B80C3931E831B6300D905FE /* App.framework */, 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 97C146ED1CF9000F007C117D /* Runner */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 135 | buildPhases = ( 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 0910; 159 | ORGANIZATIONNAME = "The Chromium Authors"; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | }; 164 | }; 165 | }; 166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 167 | compatibilityVersion = "Xcode 3.2"; 168 | developmentRegion = English; 169 | hasScannedForEncodings = 0; 170 | knownRegions = ( 171 | en, 172 | Base, 173 | ); 174 | mainGroup = 97C146E51CF9000F007C117D; 175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 97C146ED1CF9000F007C117D /* Runner */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 97C146EC1CF9000F007C117D /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 214 | }; 215 | 9740EEB61CF901F6004384FC /* Run Script */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputPaths = ( 221 | ); 222 | name = "Run Script"; 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 228 | }; 229 | /* End PBXShellScriptBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 97C146EA1CF9000F007C117D /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 237 | 97C146F31CF9000F007C117D /* main.m in Sources */, 238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXVariantGroup section */ 245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C146FB1CF9000F007C117D /* Base */, 249 | ); 250 | name = Main.storyboard; 251 | sourceTree = ""; 252 | }; 253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 97C147001CF9000F007C117D /* Base */, 257 | ); 258 | name = LaunchScreen.storyboard; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXVariantGroup section */ 262 | 263 | /* Begin XCBuildConfiguration section */ 264 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 265 | isa = XCBuildConfiguration; 266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | VALIDATE_PRODUCT = YES; 309 | }; 310 | name = Profile; 311 | }; 312 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 313 | isa = XCBuildConfiguration; 314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 318 | DEVELOPMENT_TEAM = S8QB4VV633; 319 | ENABLE_BITCODE = NO; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | INFOPLIST_FILE = Runner/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | LIBRARY_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "$(PROJECT_DIR)/Flutter", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = io.github.esarbanis.simpleLogin; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | VERSIONING_SYSTEM = "apple-generic"; 333 | }; 334 | name = Profile; 335 | }; 336 | 97C147031CF9000F007C117D /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = dwarf; 366 | ENABLE_STRICT_OBJC_MSGSEND = YES; 367 | ENABLE_TESTABILITY = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_DYNAMIC_NO_PIC = NO; 370 | GCC_NO_COMMON_BLOCKS = YES; 371 | GCC_OPTIMIZATION_LEVEL = 0; 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 383 | MTL_ENABLE_DEBUG_INFO = YES; 384 | ONLY_ACTIVE_ARCH = YES; 385 | SDKROOT = iphoneos; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Debug; 389 | }; 390 | 97C147041CF9000F007C117D /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_ANALYZER_NONNULL = YES; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 401 | CLANG_WARN_BOOL_CONVERSION = YES; 402 | CLANG_WARN_COMMA = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | VALIDATE_PRODUCT = YES; 435 | }; 436 | name = Release; 437 | }; 438 | 97C147061CF9000F007C117D /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 444 | ENABLE_BITCODE = NO; 445 | FRAMEWORK_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "$(PROJECT_DIR)/Flutter", 448 | ); 449 | INFOPLIST_FILE = Runner/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | LIBRARY_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | PRODUCT_BUNDLE_IDENTIFIER = io.github.esarbanis.simpleLogin; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | VERSIONING_SYSTEM = "apple-generic"; 458 | }; 459 | name = Debug; 460 | }; 461 | 97C147071CF9000F007C117D /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 464 | buildSettings = { 465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 467 | ENABLE_BITCODE = NO; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | INFOPLIST_FILE = Runner/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | LIBRARY_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | PRODUCT_BUNDLE_IDENTIFIER = io.github.esarbanis.simpleLogin; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | VERSIONING_SYSTEM = "apple-generic"; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 97C147031CF9000F007C117D /* Debug */, 491 | 97C147041CF9000F007C117D /* Release */, 492 | 249021D3217E4FDB00AE95B9 /* Profile */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147061CF9000F007C117D /* Debug */, 501 | 97C147071CF9000F007C117D /* Release */, 502 | 249021D4217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | }; 509 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 510 | } 511 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutterings/flutter_redux_navigation/44d1d079530e7c1affc8f873fc6c950d619d53bb/example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | simple_login 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/simple_login/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/simple_login/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:simple_login/src/simple_login_app.dart'; 3 | 4 | void main() => runApp(SimpleLoginApp()); -------------------------------------------------------------------------------- /example/simple_login/lib/src/app_store.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 2 | import 'package:redux/redux.dart'; 3 | 4 | 5 | class AppState { 6 | 7 | AppState(); 8 | 9 | factory AppState.initial() => AppState(); 10 | } 11 | 12 | final store = new Store(combineReducers([]), 13 | initialState: AppState.initial(), 14 | middleware: [ 15 | NavigationMiddleware(), 16 | ]); -------------------------------------------------------------------------------- /example/simple_login/lib/src/dashboard/dashboard_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 2 | import 'package:redux/redux.dart'; 3 | import 'package:simple_login/src/app_store.dart'; 4 | 5 | class DashboardBloc { 6 | final Store _store; 7 | 8 | DashboardBloc(this._store); 9 | 10 | void logout() { 11 | this._store.dispatch(NavigateToAction.replace("/login")); 12 | } 13 | } -------------------------------------------------------------------------------- /example/simple_login/lib/src/dashboard/dashboard_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux/flutter_redux.dart'; 3 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 4 | import 'package:simple_login/src/app_store.dart'; 5 | import 'package:simple_login/src/dashboard/dashboard_bloc.dart'; 6 | 7 | class DashboardPage extends StatefulWidget { 8 | @override 9 | _DashboardPageState createState() => _DashboardPageState(); 10 | } 11 | 12 | class _DashboardPageState extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return StoreConnector( 16 | converter: (store) { 17 | return DashboardBloc(store); 18 | }, 19 | builder: (BuildContext context, DashboardBloc bloc) { 20 | return Scaffold( 21 | drawer: Drawer( 22 | child: ListView(padding: EdgeInsets.zero, children: [ 23 | DrawerHeader( 24 | child: Text('Simple Login Example'), 25 | ), 26 | ListTile( 27 | title: Text('Dashboard'), 28 | selected: NavigatorHolder.state.currentDestination?.path == '/dashboard', 29 | ) 30 | ]), 31 | ), 32 | appBar: AppBar( 33 | title: Text('Dashboard Page'), 34 | ), 35 | body: Builder( 36 | builder: (BuildContext context) { 37 | return Container( 38 | alignment: Alignment.center, 39 | child: RaisedButton( 40 | onPressed: bloc.logout, 41 | child: Text('Logout'), 42 | ), 43 | ); 44 | }, 45 | )); 46 | }, 47 | ); 48 | ; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /example/simple_login/lib/src/login/login_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 2 | import 'package:redux/redux.dart'; 3 | import 'package:simple_login/src/app_store.dart'; 4 | 5 | class LoginBloc { 6 | final Store _store; 7 | 8 | LoginBloc(this._store); 9 | 10 | void login() { 11 | this._store.dispatch(NavigateToAction.replace("/dashboard")); 12 | } 13 | } -------------------------------------------------------------------------------- /example/simple_login/lib/src/login/login_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux/flutter_redux.dart'; 3 | import 'package:simple_login/src/app_store.dart'; 4 | import 'package:simple_login/src/login/login_bloc.dart'; 5 | 6 | class LoginPage extends StatefulWidget { 7 | @override 8 | _LoginPageState createState() => _LoginPageState(); 9 | } 10 | 11 | class _LoginPageState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return StoreConnector( 15 | converter: (store) { 16 | return LoginBloc(store); 17 | }, 18 | builder: (BuildContext context, LoginBloc bloc) { 19 | return Scaffold( 20 | appBar: AppBar( 21 | title: Text('Login Page'), 22 | ), 23 | body: Builder( 24 | builder: (BuildContext context) { 25 | return Container( 26 | alignment: Alignment.center, 27 | child: RaisedButton( 28 | onPressed: bloc.login, 29 | child: Text('Login'), 30 | ), 31 | ); 32 | }, 33 | )); 34 | }, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /example/simple_login/lib/src/simple_login_app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 3 | import 'package:flutter_redux/flutter_redux.dart'; 4 | import 'package:simple_login/src/app_store.dart'; 5 | import 'package:simple_login/src/dashboard/dashboard_page.dart'; 6 | import 'package:simple_login/src/login/login_page.dart'; 7 | 8 | class SimpleLoginApp extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | return StoreProvider( 12 | store: store, 13 | child: MaterialApp( 14 | title: 'Simple Login Example', 15 | theme: ThemeData( 16 | primarySwatch: Colors.blue, 17 | ), 18 | navigatorKey: NavigatorHolder.navigatorKey, 19 | onGenerateRoute: _getRoute, 20 | ), 21 | ); 22 | } 23 | 24 | Route _getRoute(RouteSettings settings) { 25 | switch (settings.name) { 26 | case '/login': 27 | return _buildRoute(settings, LoginPage()); 28 | case '/dashboard': 29 | return _buildRoute(settings, DashboardPage()); 30 | default: 31 | return _buildRoute(settings, LoginPage()); 32 | } 33 | } 34 | 35 | MaterialPageRoute _buildRoute(RouteSettings settings, Widget builder) { 36 | return new MaterialPageRoute( 37 | settings: settings, 38 | builder: (BuildContext context) => builder, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /example/simple_login/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: simple_login 2 | description: Example Application to display the replacement navigation functionality. 3 | 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | cupertino_icons: ^0.1.2 14 | flutter_redux: ^0.8.2 15 | flutter_redux_navigation: 16 | path: ../../ 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | 23 | flutter: 24 | 25 | uses-material-design: true 26 | -------------------------------------------------------------------------------- /generate_changelog.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | sudo gem install github_changelog_generator 3 | github_changelog_generator -u $GITHUB_USER -p flutter_redux_navigation 4 | -------------------------------------------------------------------------------- /lib/flutter_redux_navigation.dart: -------------------------------------------------------------------------------- 1 | library flutter_redux_navigation; 2 | 3 | export 'package:flutter_redux_navigation/src/navigation_state.dart'; 4 | export 'package:flutter_redux_navigation/src/navigation_holder.dart'; 5 | export 'package:flutter_redux_navigation/src/navigate_to_action.dart'; 6 | export 'package:flutter_redux_navigation/src/navigation_middleware.dart'; 7 | -------------------------------------------------------------------------------- /lib/src/navigate_to_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | /// Controls the type of navigation method. 4 | enum NavigationType { 5 | /// The [Navigator.pushReplacementNamed] will be called. 6 | shouldReplace, 7 | 8 | /// The [Navigator.pop] will be called. 9 | shouldPop, 10 | 11 | /// The [Navigator.pushNamed] will be called. 12 | shouldPush, 13 | 14 | /// The [Navigator.pushNamedAndRemoveUntil] will be called. 15 | shouldPushNamedAndRemoveUntil, 16 | 17 | /// The [Navigator.popUntil] will be called 18 | shouldPopUntil 19 | } 20 | 21 | /// The action to be dispatched in the store in order to trigger a navigation. 22 | class NavigateToAction { 23 | final String? name; 24 | 25 | /// Controls the method to be called on the [Navigator] with the specified 26 | /// [name]. 27 | final NavigationType type; 28 | 29 | /// Optional callback function to be called before the actual navigation. 30 | /// e.g. activate the loader. 31 | final Function? preNavigation; 32 | 33 | /// Optional callback function to be called after the actual navigation. 34 | /// e.g. de-activate the loader. 35 | final Function? postNavigation; 36 | 37 | /// Optional object to be passed either in [NavigationType.shouldPush] or 38 | /// [NavigationType.shouldReplace]. 39 | /// 40 | /// It will be ignored if passed with type [NavigationType.shouldPop] 41 | final Object? arguments; 42 | 43 | /// Optional object to be passed either in [NavigationType.shouldPushNamedAndRemoveUntil] 44 | /// or in [NavigationType.shouldPopUntil] 45 | /// 46 | /// It will be ignored if passed with any other type. 47 | final RoutePredicate? predicate; 48 | 49 | /// Create a navigation action. 50 | /// 51 | /// The [name] parameter must not be null. 52 | /// The [preNavigation] and [postNavigation] parameters are optional. 53 | NavigateToAction(this.name, 54 | {this.type = NavigationType.shouldPush, 55 | this.preNavigation, 56 | this.postNavigation, 57 | this.arguments, 58 | this.predicate}) 59 | : assert(() { 60 | if (type == NavigationType.shouldPushNamedAndRemoveUntil) { 61 | return predicate != null; 62 | } 63 | if (type == NavigationType.shouldPopUntil) { 64 | return predicate != null; 65 | } 66 | if (type != NavigationType.shouldPop) { 67 | return name != null && name.isNotEmpty; 68 | } 69 | return true; 70 | }()); 71 | 72 | factory NavigateToAction.push(String name, 73 | {Function? preNavigation, 74 | Function? postNavigation, 75 | Object? arguments}) => 76 | NavigateToAction(name, 77 | preNavigation: preNavigation, 78 | postNavigation: postNavigation, 79 | arguments: arguments); 80 | 81 | factory NavigateToAction.pop( 82 | {Function? preNavigation, Function? postNavigation}) => 83 | NavigateToAction(null, 84 | type: NavigationType.shouldPop, 85 | preNavigation: preNavigation, 86 | postNavigation: postNavigation); 87 | 88 | factory NavigateToAction.popUntil( 89 | {Function? preNavigation, 90 | Function? postNavigation, 91 | RoutePredicate? predicate}) => 92 | NavigateToAction(null, 93 | type: NavigationType.shouldPopUntil, 94 | preNavigation: preNavigation, 95 | postNavigation: postNavigation, 96 | predicate: predicate); 97 | 98 | factory NavigateToAction.replace(String name, 99 | {Function? preNavigation, 100 | Function? postNavigation, 101 | Object? arguments}) => 102 | NavigateToAction(name, 103 | type: NavigationType.shouldReplace, 104 | preNavigation: preNavigation, 105 | postNavigation: postNavigation, 106 | arguments: arguments); 107 | 108 | factory NavigateToAction.pushNamedAndRemoveUntil( 109 | String name, RoutePredicate predicate, 110 | {Function? preNavigation, 111 | Function? postNavigation, 112 | Object? arguments}) => 113 | NavigateToAction(name, 114 | type: NavigationType.shouldPushNamedAndRemoveUntil, 115 | preNavigation: preNavigation, 116 | postNavigation: postNavigation, 117 | predicate: predicate, 118 | arguments: arguments); 119 | } 120 | -------------------------------------------------------------------------------- /lib/src/navigation_destination.dart: -------------------------------------------------------------------------------- 1 | /// Groups together the path and arguments of a navigation destination 2 | class NavigationDestination { 3 | final String path; 4 | final Object? arguments; 5 | 6 | NavigationDestination(this.path, this.arguments); 7 | } 8 | -------------------------------------------------------------------------------- /lib/src/navigation_holder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux_navigation/src/navigation_state.dart'; 3 | 4 | /// Provides a way to keep a reference of the [NavigatorState] globally. 5 | /// It also keeps a global reference of the [NavigationState]. 6 | class NavigatorHolder { 7 | static final navigatorKey = GlobalKey(); 8 | static NavigationState? state; 9 | } 10 | -------------------------------------------------------------------------------- /lib/src/navigation_middleware.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_redux_navigation/src/navigate_to_action.dart'; 3 | import 'package:flutter_redux_navigation/src/navigation_destination.dart'; 4 | import 'package:flutter_redux_navigation/src/navigation_holder.dart'; 5 | import 'package:flutter_redux_navigation/src/navigation_state.dart'; 6 | import 'package:redux/redux.dart'; 7 | 8 | /// Intercepts all dispatched [NavigateToAction] in the [Store] and performs 9 | /// the navigation on the `currentState` of [NavigatorHolder.navigatorKey]. 10 | /// 11 | /// It can perform either a `replace`, a `push`, a `pushNamedAndRemoveUntil` 12 | /// a `pop`, or a `popUntil` navigation action. 13 | /// Prerequisite is to have register the appropriate navigation paths in 14 | /// `onGenerateRoute` method passed to [MaterialApp]. 15 | class NavigationMiddleware implements MiddlewareClass { 16 | final NavigatorState? currentState; 17 | 18 | const NavigationMiddleware({this.currentState}); 19 | 20 | @override 21 | void call(Store store, dynamic action, NextDispatcher next) { 22 | if (action is NavigateToAction) { 23 | final navigationAction = action; 24 | final currentState = 25 | this.currentState ?? NavigatorHolder.navigatorKey.currentState; 26 | 27 | if (action.preNavigation != null) { 28 | action.preNavigation!(); 29 | } 30 | 31 | switch (navigationAction.type) { 32 | case NavigationType.shouldReplace: 33 | currentState!.pushReplacementNamed(navigationAction.name!, 34 | arguments: navigationAction.arguments); 35 | this._setState(NavigationDestination( 36 | navigationAction.name!, navigationAction.arguments)); 37 | break; 38 | case NavigationType.shouldPop: 39 | currentState!.pop(); 40 | this._setState(NavigatorHolder.state?.previousDestination); 41 | break; 42 | case NavigationType.shouldPopUntil: 43 | currentState!.popUntil(navigationAction.predicate!); 44 | this._setState(null); 45 | break; 46 | case NavigationType.shouldPushNamedAndRemoveUntil: 47 | currentState!.pushNamedAndRemoveUntil( 48 | navigationAction.name!, navigationAction.predicate!, 49 | arguments: navigationAction.arguments); 50 | this._setState(null); 51 | break; 52 | default: 53 | currentState!.pushNamed(navigationAction.name!, 54 | arguments: navigationAction.arguments); 55 | this._setState(NavigationDestination( 56 | navigationAction.name!, navigationAction.arguments)); 57 | } 58 | 59 | if (action.postNavigation != null) { 60 | action.postNavigation!(); 61 | } 62 | } 63 | 64 | next(action); 65 | } 66 | 67 | void _setState(NavigationDestination? currentDestination) { 68 | NavigatorHolder.state = NavigationState.transition( 69 | NavigatorHolder.state?.currentDestination, currentDestination); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/src/navigation_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_redux_navigation/src/navigation_destination.dart'; 2 | 3 | /// It keeps the current and previous path of the navigation. 4 | class NavigationState { 5 | final NavigationDestination? previousDestination; 6 | final NavigationDestination? currentDestination; 7 | 8 | @Deprecated('Use previousDestination.path instead') 9 | String? get previousPath => previousDestination?.path; 10 | 11 | @Deprecated('Use currentDestination.path instead') 12 | String? get currentPath => currentDestination?.path; 13 | 14 | NavigationState(this.previousDestination, this.currentDestination); 15 | 16 | factory NavigationState.initial() => NavigationState(null, null); 17 | 18 | factory NavigationState.transition(NavigationDestination? previousDestination, NavigationDestination? currentDestination) => 19 | NavigationState(previousDestination, currentDestination); 20 | } 21 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "33.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "3.1.0" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.0.0" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.8.2" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.2.1" 46 | built_collection: 47 | dependency: transitive 48 | description: 49 | name: built_collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "5.0.0" 53 | built_value: 54 | dependency: transitive 55 | description: 56 | name: built_value 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "8.0.4" 60 | characters: 61 | dependency: transitive 62 | description: 63 | name: characters 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.2.0" 67 | charcode: 68 | dependency: transitive 69 | description: 70 | name: charcode 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.3.1" 74 | cli_util: 75 | dependency: transitive 76 | description: 77 | name: cli_util 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "0.3.0" 81 | clock: 82 | dependency: transitive 83 | description: 84 | name: clock 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.1.0" 88 | code_builder: 89 | dependency: transitive 90 | description: 91 | name: code_builder 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "4.1.0" 95 | collection: 96 | dependency: transitive 97 | description: 98 | name: collection 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.15.0" 102 | convert: 103 | dependency: transitive 104 | description: 105 | name: convert 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "3.0.0" 109 | crypto: 110 | dependency: transitive 111 | description: 112 | name: crypto 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "3.0.1" 116 | dart_style: 117 | dependency: transitive 118 | description: 119 | name: dart_style 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "2.2.1" 123 | fake_async: 124 | dependency: transitive 125 | description: 126 | name: fake_async 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.2.0" 130 | file: 131 | dependency: transitive 132 | description: 133 | name: file 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "6.1.0" 137 | fixnum: 138 | dependency: transitive 139 | description: 140 | name: fixnum 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "1.0.0" 144 | flutter: 145 | dependency: "direct main" 146 | description: flutter 147 | source: sdk 148 | version: "0.0.0" 149 | flutter_test: 150 | dependency: "direct dev" 151 | description: flutter 152 | source: sdk 153 | version: "0.0.0" 154 | glob: 155 | dependency: transitive 156 | description: 157 | name: glob 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "2.0.1" 161 | logging: 162 | dependency: transitive 163 | description: 164 | name: logging 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "1.0.1" 168 | matcher: 169 | dependency: transitive 170 | description: 171 | name: matcher 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "0.12.11" 175 | meta: 176 | dependency: transitive 177 | description: 178 | name: meta 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "1.7.0" 182 | mockito: 183 | dependency: "direct dev" 184 | description: 185 | name: mockito 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "5.0.17" 189 | package_config: 190 | dependency: transitive 191 | description: 192 | name: package_config 193 | url: "https://pub.dartlang.org" 194 | source: hosted 195 | version: "2.0.0" 196 | path: 197 | dependency: transitive 198 | description: 199 | name: path 200 | url: "https://pub.dartlang.org" 201 | source: hosted 202 | version: "1.8.0" 203 | pedantic: 204 | dependency: transitive 205 | description: 206 | name: pedantic 207 | url: "https://pub.dartlang.org" 208 | source: hosted 209 | version: "1.11.0" 210 | pub_semver: 211 | dependency: transitive 212 | description: 213 | name: pub_semver 214 | url: "https://pub.dartlang.org" 215 | source: hosted 216 | version: "2.0.0" 217 | redux: 218 | dependency: "direct main" 219 | description: 220 | name: redux 221 | url: "https://pub.dartlang.org" 222 | source: hosted 223 | version: "5.0.0" 224 | sky_engine: 225 | dependency: transitive 226 | description: flutter 227 | source: sdk 228 | version: "0.0.99" 229 | source_gen: 230 | dependency: transitive 231 | description: 232 | name: source_gen 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "1.2.1" 236 | source_span: 237 | dependency: transitive 238 | description: 239 | name: source_span 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.8.1" 243 | stack_trace: 244 | dependency: transitive 245 | description: 246 | name: stack_trace 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.10.0" 250 | stream_channel: 251 | dependency: transitive 252 | description: 253 | name: stream_channel 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "2.1.0" 257 | string_scanner: 258 | dependency: transitive 259 | description: 260 | name: string_scanner 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.1.0" 264 | term_glyph: 265 | dependency: transitive 266 | description: 267 | name: term_glyph 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "1.2.0" 271 | test_api: 272 | dependency: transitive 273 | description: 274 | name: test_api 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "0.4.3" 278 | typed_data: 279 | dependency: transitive 280 | description: 281 | name: typed_data 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "1.3.0" 285 | vector_math: 286 | dependency: transitive 287 | description: 288 | name: vector_math 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "2.1.1" 292 | watcher: 293 | dependency: transitive 294 | description: 295 | name: watcher 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "1.0.0" 299 | yaml: 300 | dependency: transitive 301 | description: 302 | name: yaml 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "3.1.0" 306 | sdks: 307 | dart: ">=2.14.0 <3.0.0" 308 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_redux_navigation 2 | description: A simple reactive navigation middleware for Flutter's redux library. 3 | version: 0.7.1 4 | homepage: https://github.com/flutterings/flutter_redux_navigation 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | redux: ^5.0.0 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | mockito: ^5.0.4 19 | 20 | flutter: 21 | -------------------------------------------------------------------------------- /test/src/navigate_to_action_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | test('should pass the NavigationType.shouldPop and no route name', () { 6 | var action = NavigateToAction.pop(); 7 | expect(action.type, NavigationType.shouldPop); 8 | expect(action.name, isNull); 9 | }); 10 | 11 | test('should pass the NavigationType.shouldPopUntil and no route name', () { 12 | var action = NavigateToAction.popUntil(predicate: (_) => false); 13 | expect(action.type, NavigationType.shouldPopUntil); 14 | expect(action.name, isNull); 15 | }); 16 | 17 | test('should pass the NavigationType.shouldReplace and route name', () { 18 | var action = NavigateToAction.replace('name'); 19 | expect(action.type, NavigationType.shouldReplace); 20 | expect(action.name, 'name'); 21 | }); 22 | 23 | test('should pass the NavigationType.shouldPush and route name', () { 24 | var action = NavigateToAction.push('name'); 25 | expect(action.type, NavigationType.shouldPush); 26 | expect(action.name, 'name'); 27 | }); 28 | 29 | test('should have a default type of NavigationType.shouldPush', () { 30 | var action = NavigateToAction('name'); 31 | expect(action.type, NavigationType.shouldPush); 32 | }); 33 | 34 | test( 35 | 'should throw AssertionError if the route name is null or empty on NavigationType.shouldPush', 36 | () { 37 | expect(() => NavigateToAction(null), throwsAssertionError); 38 | expect(() => NavigateToAction(''), throwsAssertionError); 39 | }); 40 | 41 | test( 42 | 'should throw AssertionError if the route name is null or empty on NavigationType.shouldReplace', 43 | () { 44 | expect(() => NavigateToAction(null, type: NavigationType.shouldReplace), 45 | throwsAssertionError); 46 | expect(() => NavigateToAction('', type: NavigationType.shouldReplace), 47 | throwsAssertionError); 48 | }); 49 | 50 | test('should allow null or empty route name on NavigationType.shouldPop', () { 51 | expect(() => NavigateToAction(null, type: NavigationType.shouldPop), 52 | isNotNull); 53 | expect( 54 | () => NavigateToAction('', type: NavigationType.shouldPop), isNotNull); 55 | }); 56 | 57 | test('should allow null or empty route name on NavigationType.shouldPopUntil', 58 | () { 59 | expect( 60 | () => NavigateToAction(null, 61 | type: NavigationType.shouldPopUntil, predicate: (_) => false), 62 | isNotNull); 63 | expect( 64 | () => NavigateToAction('', 65 | type: NavigationType.shouldPopUntil, predicate: (_) => false), 66 | isNotNull); 67 | }); 68 | 69 | test( 70 | 'should throw AssertionError if the route name is null or empty or predicate is null on NavigationType.pushNamedAndRemoveUntil', 71 | () { 72 | expect( 73 | () => NavigateToAction(null, 74 | type: NavigationType.shouldPushNamedAndRemoveUntil), 75 | throwsAssertionError); 76 | expect( 77 | () => NavigateToAction('', 78 | type: NavigationType.shouldPushNamedAndRemoveUntil), 79 | throwsAssertionError); 80 | expect( 81 | () => NavigateToAction('name', 82 | type: NavigationType.shouldPushNamedAndRemoveUntil), 83 | throwsAssertionError); 84 | }); 85 | 86 | test( 87 | 'should throw AssertionError if the predicate is null on NavigationType.popUntil', 88 | () { 89 | expect(() => NavigateToAction(null, type: NavigationType.shouldPopUntil), 90 | throwsAssertionError); 91 | }); 92 | } 93 | -------------------------------------------------------------------------------- /test/src/navigation_middleware_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:mockito/mockito.dart'; 5 | import 'package:redux/redux.dart'; 6 | 7 | class TestState {} 8 | 9 | class NoopAction {} 10 | 11 | class MockStore extends Mock implements Store {} 12 | 13 | class MockNavigatorState extends Mock implements NavigatorState { 14 | @override 15 | String toString({DiagnosticLevel minLevel = DiagnosticLevel.debug}) { 16 | return super.toString(); 17 | } 18 | } 19 | 20 | void main() { 21 | setUp(() { 22 | MaterialApp( 23 | navigatorKey: NavigatorHolder.navigatorKey, 24 | ); 25 | NavigatorHolder.state = null; 26 | }); 27 | 28 | test('should not handle other than NavigateToActions', () { 29 | final store = MockStore(); 30 | final log = []; 31 | 32 | NavigationMiddleware().call(store, NoopAction(), (_) => log.add('next')); 33 | 34 | expect(log, ['next']); 35 | }); 36 | 37 | group('currentState', () { 38 | test('should call pushNamed on currentState', () { 39 | final store = MockStore(); 40 | final navigatorState = MockNavigatorState(); 41 | 42 | NavigationMiddleware(currentState: navigatorState) 43 | .call(store, NavigateToAction.push('/name'), (_) {}); 44 | 45 | verifyNever(navigatorState.pushReplacementNamed(any!)); 46 | verifyNever(navigatorState.pop()); 47 | verifyNever(navigatorState.popUntil(any!)); 48 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 49 | verify(navigatorState.pushNamed('/name')); 50 | }); 51 | 52 | test('should call pushNamed on currentState with arguments', () { 53 | final store = MockStore(); 54 | final navigatorState = MockNavigatorState(); 55 | final arguments = {}; 56 | 57 | NavigationMiddleware(currentState: navigatorState).call( 58 | store, NavigateToAction.push('/name', arguments: arguments), (_) {}); 59 | 60 | verifyNever(navigatorState.pushReplacementNamed(any!)); 61 | verifyNever(navigatorState.pop()); 62 | verifyNever(navigatorState.popUntil(any!)); 63 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 64 | verify(navigatorState.pushNamed('/name', arguments: arguments)); 65 | }); 66 | 67 | test('should call pushReplacementNamed on currentState', () { 68 | final store = MockStore(); 69 | final navigatorState = MockNavigatorState(); 70 | 71 | NavigationMiddleware(currentState: navigatorState) 72 | .call(store, NavigateToAction.replace('/name'), (_) {}); 73 | 74 | verifyNever(navigatorState.pushNamed(any!)); 75 | verifyNever(navigatorState.pop()); 76 | verifyNever(navigatorState.popUntil(any!)); 77 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 78 | verify(navigatorState.pushReplacementNamed('/name')); 79 | }); 80 | 81 | test('should call pushReplacementNamed on currentState with arguments', () { 82 | final store = MockStore(); 83 | final navigatorState = MockNavigatorState(); 84 | final arguments = {}; 85 | 86 | NavigationMiddleware(currentState: navigatorState).call(store, 87 | NavigateToAction.replace('/name', arguments: arguments), (_) {}); 88 | 89 | verifyNever(navigatorState.pushNamed(any!)); 90 | verifyNever(navigatorState.pop()); 91 | verifyNever(navigatorState.popUntil(any!)); 92 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 93 | verify( 94 | navigatorState.pushReplacementNamed('/name', arguments: arguments)); 95 | }); 96 | 97 | test('should call pop on currentState', () { 98 | final store = MockStore(); 99 | final navigatorState = MockNavigatorState(); 100 | 101 | NavigationMiddleware(currentState: navigatorState) 102 | .call(store, NavigateToAction.pop(), (_) {}); 103 | 104 | verifyNever(navigatorState.pushNamed(any!)); 105 | verifyNever(navigatorState.popUntil(any!)); 106 | verifyNever(navigatorState.pushReplacementNamed(any!)); 107 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 108 | verify(navigatorState.pop()); 109 | }); 110 | 111 | test('should call pop on currentState', () { 112 | final store = MockStore(); 113 | final navigatorState = MockNavigatorState(); 114 | 115 | NavigationMiddleware(currentState: navigatorState) 116 | .call(store, NavigateToAction.pop(), (_) {}); 117 | 118 | verifyNever(navigatorState.pushNamed(any!)); 119 | verifyNever(navigatorState.popUntil(any!)); 120 | verifyNever(navigatorState.pushReplacementNamed(any!)); 121 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 122 | verify(navigatorState.pop()); 123 | }); 124 | 125 | test('should call pushNamedAndRemoveUntil on currentState', () { 126 | final store = MockStore(); 127 | final navigatorState = MockNavigatorState(); 128 | final predicate = (Route route) => false; 129 | 130 | NavigationMiddleware(currentState: navigatorState).call(store, 131 | NavigateToAction.pushNamedAndRemoveUntil('name', predicate), (_) {}); 132 | 133 | verifyNever(navigatorState.pushNamed(any!)); 134 | verifyNever(navigatorState.pushReplacementNamed(any!)); 135 | verifyNever(navigatorState.pop()); 136 | verifyNever(navigatorState.popUntil(any!)); 137 | verify(navigatorState.pushNamedAndRemoveUntil('name', predicate)); 138 | }); 139 | 140 | test('should call popUntil on currentState', () { 141 | final store = MockStore(); 142 | final navigatorState = MockNavigatorState(); 143 | final predicate = (Route route) => false; 144 | 145 | NavigationMiddleware(currentState: navigatorState) 146 | .call(store, NavigateToAction.popUntil(predicate: predicate), (_) {}); 147 | 148 | verifyNever(navigatorState.pushNamed(any!)); 149 | verifyNever(navigatorState.pushReplacementNamed(any!)); 150 | verifyNever(navigatorState.pop()); 151 | verifyNever(navigatorState.pushNamedAndRemoveUntil(any!, any!)); 152 | verify(navigatorState.popUntil(predicate)); 153 | }); 154 | }); 155 | 156 | group('navigation hooks', () { 157 | test('should call preNavigation before the actual navigation', () { 158 | final store = MockStore(); 159 | final navigatorState = MockNavigatorState(); 160 | final log = []; 161 | 162 | when(navigatorState.pushNamed('/name')) 163 | .thenAnswer((_) async => log.add('/name')); 164 | 165 | NavigationMiddleware(currentState: navigatorState).call( 166 | store, 167 | NavigateToAction.push('/name', 168 | preNavigation: () => log.add('preNavigation')), 169 | (_) {}); 170 | 171 | expect(log, ['preNavigation', '/name']); 172 | }); 173 | 174 | test('should call postNavigation after the actual navigation', () { 175 | final store = MockStore(); 176 | final navigatorState = MockNavigatorState(); 177 | final log = []; 178 | 179 | when(navigatorState.pushNamed('/name')) 180 | .thenAnswer((_) async => log.add('/name')); 181 | 182 | NavigationMiddleware(currentState: navigatorState).call( 183 | store, 184 | NavigateToAction.push('/name', 185 | postNavigation: () => log.add('postNavigation')), 186 | (_) {}); 187 | 188 | expect(log, ['/name', 'postNavigation']); 189 | }); 190 | 191 | test('should call both pre and post hooks around the actual navigation', 192 | () { 193 | final store = MockStore(); 194 | final navigatorState = MockNavigatorState(); 195 | final log = []; 196 | 197 | when(navigatorState.pushNamed('/name')) 198 | .thenAnswer((_) async => log.add('/name')); 199 | 200 | NavigationMiddleware(currentState: navigatorState).call( 201 | store, 202 | NavigateToAction.push( 203 | '/name', 204 | preNavigation: () => log.add('preNavigation'), 205 | postNavigation: () => log.add('postNavigation'), 206 | ), 207 | (_) {}); 208 | 209 | expect(log, ['preNavigation', '/name', 'postNavigation']); 210 | }); 211 | }); 212 | 213 | group('state', () { 214 | test( 215 | 'should start by keeping only the currentPath in the state on initial push transition', 216 | () { 217 | final store = MockStore(); 218 | final navigatorState = MockNavigatorState(); 219 | 220 | NavigationMiddleware(currentState: navigatorState) 221 | .call(store, NavigateToAction.push('/name'), (_) {}); 222 | 223 | expect(NavigatorHolder.state!.currentPath, '/name'); 224 | expect(NavigatorHolder.state!.previousPath, isNull); 225 | 226 | expect(NavigatorHolder.state!.currentDestination!.path, '/name'); 227 | expect(NavigatorHolder.state!.previousDestination, isNull); 228 | }); 229 | 230 | test( 231 | 'should start by keeping only the currentPath in the state on initial replace transition', 232 | () { 233 | final store = MockStore(); 234 | final navigatorState = MockNavigatorState(); 235 | 236 | NavigationMiddleware(currentState: navigatorState) 237 | .call(store, NavigateToAction.replace('/name'), (_) {}); 238 | 239 | expect(NavigatorHolder.state!.currentPath, '/name'); 240 | expect(NavigatorHolder.state!.previousPath, isNull); 241 | 242 | expect(NavigatorHolder.state!.currentDestination!.path, '/name'); 243 | expect(NavigatorHolder.state!.previousDestination, isNull); 244 | }); 245 | 246 | test( 247 | 'should store currentPath as the previousPath on every push transition', 248 | () { 249 | final store = MockStore(); 250 | final navigatorState = MockNavigatorState(); 251 | final middleware = NavigationMiddleware(currentState: navigatorState); 252 | 253 | middleware.call(store, NavigateToAction.push('/first'), (_) {}); 254 | middleware.call(store, NavigateToAction.push('/second'), (_) {}); 255 | 256 | expect(NavigatorHolder.state!.currentPath, '/second'); 257 | expect(NavigatorHolder.state!.previousPath, '/first'); 258 | 259 | expect(NavigatorHolder.state!.currentDestination!.path, '/second'); 260 | expect(NavigatorHolder.state!.previousDestination!.path, '/first'); 261 | }); 262 | 263 | test( 264 | 'should store currentPath as the previousPath on every replace transition', 265 | () { 266 | final store = MockStore(); 267 | final navigatorState = MockNavigatorState(); 268 | final middleware = NavigationMiddleware(currentState: navigatorState); 269 | 270 | middleware.call(store, NavigateToAction.replace('/first'), (_) {}); 271 | middleware.call(store, NavigateToAction.replace('/second'), (_) {}); 272 | 273 | expect(NavigatorHolder.state!.currentPath, '/second'); 274 | expect(NavigatorHolder.state!.previousPath, '/first'); 275 | 276 | expect(NavigatorHolder.state!.currentDestination!.path, '/second'); 277 | expect(NavigatorHolder.state!.previousDestination!.path, '/first'); 278 | }); 279 | 280 | test('should reverse the path order on every pop transition', () { 281 | final store = MockStore(); 282 | final navigatorState = MockNavigatorState(); 283 | final middleware = NavigationMiddleware(currentState: navigatorState); 284 | 285 | middleware.call(store, NavigateToAction.push('/first'), (_) {}); 286 | middleware.call(store, NavigateToAction.push('/second'), (_) {}); 287 | middleware.call(store, NavigateToAction.pop(), (_) {}); 288 | 289 | expect(NavigatorHolder.state!.currentPath, '/first'); 290 | expect(NavigatorHolder.state!.previousPath, '/second'); 291 | 292 | expect(NavigatorHolder.state!.currentDestination!.path, '/first'); 293 | expect(NavigatorHolder.state!.previousDestination!.path, '/second'); 294 | }); 295 | 296 | test('should keep initial state when initial navigation is pop', () { 297 | final store = MockStore(); 298 | final navigatorState = MockNavigatorState(); 299 | final middleware = NavigationMiddleware(currentState: navigatorState); 300 | 301 | middleware.call(store, NavigateToAction.pop(), (_) {}); 302 | 303 | expect(NavigatorHolder.state!.currentPath, isNull); 304 | expect(NavigatorHolder.state!.previousPath, isNull); 305 | 306 | expect(NavigatorHolder.state!.currentDestination, isNull); 307 | expect(NavigatorHolder.state!.previousDestination, isNull); 308 | }); 309 | 310 | test('should keep initial state when initial navigation is popped until', 311 | () { 312 | final store = MockStore(); 313 | final navigatorState = MockNavigatorState(); 314 | final middleware = NavigationMiddleware(currentState: navigatorState); 315 | 316 | middleware.call( 317 | store, NavigateToAction.popUntil(predicate: (_) => false), (_) {}); 318 | 319 | expect(NavigatorHolder.state!.currentPath, isNull); 320 | expect(NavigatorHolder.state!.previousPath, isNull); 321 | 322 | expect(NavigatorHolder.state!.currentDestination, isNull); 323 | expect(NavigatorHolder.state!.previousDestination, isNull); 324 | }); 325 | 326 | test( 327 | 'should report current path as null and previous path correctly when all navigations are popped', 328 | () { 329 | final store = MockStore(); 330 | final navigatorState = MockNavigatorState(); 331 | final middleware = NavigationMiddleware(currentState: navigatorState); 332 | 333 | middleware.call(store, NavigateToAction.push('/first'), (_) {}); 334 | middleware.call(store, NavigateToAction.push('/second'), (_) {}); 335 | middleware.call( 336 | store, NavigateToAction.popUntil(predicate: (_) => false), (_) {}); 337 | 338 | expect(NavigatorHolder.state!.currentPath, isNull); 339 | expect(NavigatorHolder.state!.previousPath, '/second'); 340 | 341 | expect(NavigatorHolder.state!.currentDestination, isNull); 342 | expect(NavigatorHolder.state!.previousDestination!.path, '/second'); 343 | }); 344 | }); 345 | } 346 | -------------------------------------------------------------------------------- /test/src/navigation_state_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_redux_navigation/flutter_redux_navigation.dart'; 2 | import 'package:flutter_redux_navigation/src/navigation_destination.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | test('should have null destinations as initial state', () { 7 | final state = NavigationState.initial(); 8 | 9 | expect(state.previousPath, isNull); 10 | expect(state.currentPath, isNull); 11 | 12 | expect(state.previousDestination, isNull); 13 | expect(state.currentDestination, isNull); 14 | }); 15 | 16 | test('should set previousDestination and currentDestination on transition', () { 17 | final state = NavigationState.transition( 18 | NavigationDestination('previousPath', 'previousArguments'), 19 | NavigationDestination('currentPath', 'currentArguments'), 20 | ); 21 | 22 | expect(state.previousPath, 'previousPath'); 23 | expect(state.currentPath, 'currentPath'); 24 | 25 | expect(state.previousDestination!.path, 'previousPath'); 26 | expect(state.previousDestination!.arguments, 'previousArguments'); 27 | expect(state.currentDestination!.path, 'currentPath'); 28 | expect(state.currentDestination!.arguments, 'currentArguments'); 29 | }); 30 | 31 | test( 32 | 'should allow null values for previousDestination, and currentDestination on transition', 33 | () { 34 | final state = NavigationState.transition(null, null); 35 | 36 | expect(state.previousPath, isNull); 37 | expect(state.currentPath, isNull); 38 | 39 | expect(state.previousDestination, isNull); 40 | expect(state.currentDestination, isNull); 41 | }); 42 | } 43 | --------------------------------------------------------------------------------