├── .gitignore ├── .metadata ├── CHANGELOG.md ├── CONTRIBUTORS.md ├── LICENSE ├── README.md ├── doc └── assets │ ├── badges.png │ ├── iconText.png │ ├── roll.gif │ ├── shrink-out-in.gif │ ├── snap.gif │ └── spin-out-in.gif ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── 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 │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── 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.swift │ │ ├── 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 │ │ └── Runner-Bridging-Header.h ├── lib │ └── main.dart ├── pubspec.lock └── pubspec.yaml ├── lib ├── indexed.dart └── rolling_nav_bar.dart ├── pubspec.lock ├── pubspec.yaml └── test ├── clicks_test.dart ├── rolling_nav_bar_test.dart └── stateful_test_widget.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | 77 | **/.last_build_id 78 | -------------------------------------------------------------------------------- /.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: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.0.4] - 2021-02-17 2 | 3 | - Fixed problem where a supplied `onTap()` callback could not call `setState()` 4 | 5 | ## [0.0.3] - 2020-12-19 6 | 7 | - Ensured onTap callback always fires, even if index is current 8 | 9 | ## [0.0.2] - 2020-08-08 10 | 11 | - Added RTL support 12 | - Verified functionality with Flutter 1.20 13 | 14 | ## [0.0.1] - 2020-01-07 15 | 16 | - Removed `children` constructor in favor of `builder` pattern 17 | 18 | ## [0.0.1-alpha+8] - 2019-12-28 19 | 20 | - Added customization for badge colors 21 | 22 | ## [0.0.1-alpha+7] - 2019-12-28 23 | 24 | - Added support for icon badges 25 | 26 | ## [0.0.1-alpha+6] - 2019-12-19 27 | 28 | - Fixed typos. Functionally equivalent to 0.0.1-alpha+5 29 | 30 | ## [0.0.1-alpha+5] - 2019-12-19 31 | 32 | - Added ability to programmatically drive new nav bar index 33 | 34 | ## [0.0.1-alpha+4] - 2019-12-17 35 | 36 | - Fixed bug with null error when not passing `iconText` 37 | - Added general sanity tests 38 | 39 | ## [0.0.1-alpha-3] - 2019-12-17 40 | 41 | - Added support for icon text 42 | 43 | ## [0.0.1-alpha-2] - 2019-12-17 44 | 45 | - More README clarifications 46 | 47 | ## [0.0.1-alpha-1] - 2019-12-17 48 | 49 | - Variable name clean-up and other documentation enhancements 50 | 51 | ## [0.0.1-alpha] - 2019-12-15 52 | 53 | - Initial release of `RollingNavBar` with four animation types: roll, snap, fade-out-and-in, and spin-out-and-in 54 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | craiglabenz 2 | mjohnsullivan 3 | olof-dev 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Craig Labenz 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 | # rolling_nav_bar 2 | 3 | A bottom nav bar with layout inspired by [this design](https://dribbble.com/shots/5713130-Greeny-app) and with heavily customizable animations, colors, and shapes. 4 | 5 | ## Getting Started 6 | 7 | To get started, place your `RollingNavBar` in the `bottomNavigationCar` slot of a 8 | `Scaffold`, wrapped in a widget that provides max height. For example: 9 | 10 | ```dart 11 | Scaffold( 12 | bottomNavigationBar: Container( 13 | height: 95, 14 | child: RollingNavBar( 15 | // nav items 16 | ), 17 | ) 18 | ); 19 | ``` 20 | 21 | Alternatively, you can place it directly using a `Stack`: 22 | 23 | ```dart 24 | Scaffold( 25 | body: Stack( 26 | children: [ 27 | Positioned( 28 | bottom: 0, 29 | height: 95, 30 | width: MediaQuery.of(context).size.width, 31 | child: RollingNavBar( 32 | // nav items 33 | ), 34 | ) 35 | ] 36 | ) 37 | ); 38 | ``` 39 | 40 | ## Customization 41 | 42 | `RollingNavBar` is heavily customizable and works with 3, 4, or 5 navigation elements. 43 | Each element is also fully customizable through the two primary ways to specify child 44 | navigation elements. 45 | 46 | The first option is to pass a list of `IconData` objects, along with optional lists 47 | of `Color` objects. 48 | 49 | ```dart 50 | RollingNavBar.iconData( 51 | iconData: [ 52 | Icons.home, 53 | Icons.people, 54 | Icons.settings, 55 | ], 56 | indicatorColors: [ 57 | Colors.red, 58 | Colors.yellow, 59 | Colors.blue, 60 | ], 61 | ) 62 | ``` 63 | 64 | The second option is to provide a widget builder, though this comes with some loss of 65 | helpful active state management. 66 | 67 | ```dart 68 | RollingNavBar.builder( 69 | builder: (context, index, info, update) { 70 | // The `iconData` constructor handles all active state management, 71 | // but this constructor, as it deals with completed widgets, must 72 | // assume that you have already made all relevant considerations. 73 | var textStyle = index == info.nextIndex 74 | ? TextStyle(color: Colors.white) 75 | : TextStyle(color: Colors.grey); 76 | return Text('${index + 1}', style: style); 77 | }, 78 | indicatorColors: [ 79 | Colors.red, 80 | Colors.yellow, 81 | Colors.blue, 82 | ], 83 | numChildren: 3, 84 | ) 85 | ``` 86 | 87 | ## Animation Types 88 | 89 | `RollingNavBar` comes with four animation flavors for the active indicator's transition from 90 | tab to tab. 91 | 92 | The first animation type is the namesake: `AnimationType.roll`: 93 | 94 | ```dart 95 | RollingNavBar.iconData( 96 | animationCurve: Curves.easeOut, // `easeOut` (the default) is recommended here 97 | animationType: AnimationType.roll, 98 | baseAnimationSpeed: 200, // milliseconds 99 | iconData: [ 100 | ... 101 | ], 102 | ) 103 | ``` 104 | 105 | Roll Example 106 | 107 |
108 | 109 | > Note: For the `roll` animation type, your supplied animation speed is a multiplier considered against the distance the indicator must travel. This ensures a constant speed of travel no matter where the user clicks. 110 | 111 | --- 112 | 113 | The second animation type is a fade-and-reappear effect: 114 | 115 | ```dart 116 | RollingNavBar.iconData( 117 | animationCurve: Curves.linear, // `linear` is recommended for `shrinkOutIn` 118 | animationType: AnimationType.shrinkOutIn, 119 | baseAnimationSpeed: 500, // slower animations look nicer for `shrinkOutIn` 120 | iconData: [ 121 | ... 122 | ], 123 | ) 124 | ``` 125 | 126 | Shrink-out-in Example 127 | 128 |
129 | 130 | > Note: For the `shinkOutIn` animation type, your supplied animation speed is constant, since the active indicator never travels the intermediate distance. 131 | 132 | --- 133 | 134 | The third animation type is a spinning version of fade-and-reappear: 135 | 136 | ```dart 137 | RollingNavBar.iconData( 138 | animationCurve: Curves.linear, // `linear` is recommended for `spinOutIn` 139 | animationType: AnimationType.spinOutIn, 140 | baseAnimationSpeed: 500, // slower animations look nicer for `spinOutIn` 141 | iconData: [ 142 | ... 143 | ], 144 | ) 145 | ``` 146 | 147 | Spin-out-in Example 148 | 149 |
150 | 151 | > Note: Like with `shinkOutIn`, for the `spinOutIn` animation type, your supplied animation speed is constant, since the active indicator never travels the intermediate distance. 152 | 153 | --- 154 | 155 | The final animation flavor is a non-animation: 156 | 157 | ```dart 158 | RollingNavBar.iconData( 159 | // `animationCurve` and `baseAnimationSpeed` are ignored 160 | animationType: AnimationType.snap, 161 | iconData: [ 162 | ... 163 | ], 164 | ) 165 | ``` 166 | 167 | Snap Example 168 | 169 |
170 | 171 | ## Hooking into the animation 172 | 173 | In the demo, the background of the larger hexagon matches the background of 174 | the nav bar hexagon. To achieve this and similar effects, two callbacks, `onTap` and 175 | `onAnimate`, are available. `onAnimate` can be particularly helpful for syncing 176 | visual effects elsewhere in your app with nav bar progress. 177 | 178 | ## Tab Item Text 179 | 180 | If using the `iconData` constructor, you are also able to pass a list of widgets 181 | to render as text below inactive icons. 182 | 183 | ```dart 184 | RollingNavBar.iconData( 185 | // A list of length one implies the same color for all icons 186 | iconColors: [ 187 | Colors.grey[800], 188 | ], 189 | iconData: [ 190 | Icons.home, 191 | Icons.friends, 192 | Icons.settings, 193 | ], 194 | iconText: [ 195 | Text('Home', style: TextStyle(color: Colors.grey, fontSize: 12)), 196 | Text('Friends', style: TextStyle(color: Colors.grey, fontSize: 12)), 197 | Text('Settings', style: TextStyle(color: Colors.grey, fontSize: 12)), 198 | ] 199 | ) 200 | ``` 201 | 202 | Icon Text Example 203 | 204 | ## Icon badges 205 | 206 | Using the [Badges](https://pub.dev/packages/badges) library, `RollingNavBar` is able to easily expose nav bar badges. The following works with either constructor. 207 | 208 | ```dart 209 | RollingNavBar.iconData( 210 | badges: [ 211 | Text('1', style: TextStyle(Colors.white)), 212 | Text('1', style: TextStyle(Colors.white)), 213 | null, 214 | null, 215 | Text('1', style: TextStyle(Colors.white)), 216 | ], 217 | iconData: [ 218 | Icons.home, 219 | Icons.friends, 220 | Icons.account, 221 | Icons.chat, 222 | Icons.settings, 223 | ], 224 | ``` 225 | 226 | Badges Example 227 | 228 | ## Driving Navigation Bar Changes 229 | 230 | You can programmatically change the active navigation bar tab by passing a new `activeIndex` to the `RollingNavBar` widget. However, there are two steps to successfully keeping everything in sync. 231 | 232 | ```dart 233 | class _MyAppState extends State { 234 | int activeIndex; 235 | 236 | /// Handler that responds to navigation events (likely derived 237 | /// from user clicks) and keeps the parent in sync. 238 | void _onTap(int index) { 239 | setState(() { 240 | activeIndex = index; 241 | }); 242 | } 243 | 244 | /// Handler for when you want to programmatically change 245 | /// the active index. Calling `setState()` here causes 246 | /// Flutter to re-render the tree, which `RollingNavBar` 247 | /// responds to by running its normal animation. 248 | /// 249 | /// Note: This is an example function that you can define 250 | /// and call wherever you like. That is why it is not passed 251 | /// to `RollingNavBar.iconData` in the `build` method. 252 | void changeActiveIndex(int index) { 253 | setState((){ 254 | activeIndex = index; 255 | }); 256 | } 257 | 258 | Widget build(BuildContext context) { 259 | return RollingNavBar.iconData( 260 | activeIndex: activeIndex, 261 | iconData: iconData, 262 | onTap: _onTap, 263 | ); 264 | } 265 | } 266 | ``` 267 | -------------------------------------------------------------------------------- /doc/assets/badges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/doc/assets/badges.png -------------------------------------------------------------------------------- /doc/assets/iconText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/doc/assets/iconText.png -------------------------------------------------------------------------------- /doc/assets/roll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/doc/assets/roll.gif -------------------------------------------------------------------------------- /doc/assets/shrink-out-in.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/doc/assets/shrink-out-in.gif -------------------------------------------------------------------------------- /doc/assets/snap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/doc/assets/snap.gif -------------------------------------------------------------------------------- /doc/assets/spin-out-in.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/doc/assets/spin-out-in.gif -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /example/.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: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/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 plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/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-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/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/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/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 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 97C146F11CF9000F007C117D /* Supporting Files */, 94 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 95 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 96 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 97 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 98 | ); 99 | path = Runner; 100 | sourceTree = ""; 101 | }; 102 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 97C146ED1CF9000F007C117D /* Runner */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 115 | buildPhases = ( 116 | 9740EEB61CF901F6004384FC /* Run Script */, 117 | 97C146EA1CF9000F007C117D /* Sources */, 118 | 97C146EB1CF9000F007C117D /* Frameworks */, 119 | 97C146EC1CF9000F007C117D /* Resources */, 120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = Runner; 128 | productName = Runner; 129 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 97C146E61CF9000F007C117D /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = "The Chromium Authors"; 140 | TargetAttributes = { 141 | 97C146ED1CF9000F007C117D = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | LastSwiftMigration = 1100; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 148 | compatibilityVersion = "Xcode 3.2"; 149 | developmentRegion = en; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 97C146E51CF9000F007C117D; 156 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 97C146ED1CF9000F007C117D /* Runner */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 97C146EC1CF9000F007C117D /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 171 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 172 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 173 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Thin Binary"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 193 | }; 194 | 9740EEB61CF901F6004384FC /* Run Script */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Run Script"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 97C146EA1CF9000F007C117D /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 216 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C146FB1CF9000F007C117D /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C147001CF9000F007C117D /* Base */, 235 | ); 236 | name = LaunchScreen.storyboard; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | CLANG_ANALYZER_NONNULL = YES; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 252 | CLANG_WARN_BOOL_CONVERSION = YES; 253 | CLANG_WARN_COMMA = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_EMPTY_BODY = YES; 258 | CLANG_WARN_ENUM_CONVERSION = YES; 259 | CLANG_WARN_INFINITE_RECURSION = YES; 260 | CLANG_WARN_INT_CONVERSION = YES; 261 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 263 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 266 | CLANG_WARN_STRICT_PROTOTYPES = YES; 267 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_NS_ASSERTIONS = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_UNDECLARED_SELECTOR = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 281 | GCC_WARN_UNUSED_FUNCTION = YES; 282 | GCC_WARN_UNUSED_VARIABLE = YES; 283 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 284 | MTL_ENABLE_DEBUG_INFO = NO; 285 | SDKROOT = iphoneos; 286 | SUPPORTED_PLATFORMS = iphoneos; 287 | TARGETED_DEVICE_FAMILY = "1,2"; 288 | VALIDATE_PRODUCT = YES; 289 | }; 290 | name = Profile; 291 | }; 292 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 293 | isa = XCBuildConfiguration; 294 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | CLANG_ENABLE_MODULES = YES; 298 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 299 | ENABLE_BITCODE = NO; 300 | FRAMEWORK_SEARCH_PATHS = ( 301 | "$(inherited)", 302 | "$(PROJECT_DIR)/Flutter", 303 | ); 304 | INFOPLIST_FILE = Runner/Info.plist; 305 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 306 | LIBRARY_SEARCH_PATHS = ( 307 | "$(inherited)", 308 | "$(PROJECT_DIR)/Flutter", 309 | ); 310 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 313 | SWIFT_VERSION = 5.0; 314 | VERSIONING_SYSTEM = "apple-generic"; 315 | }; 316 | name = Profile; 317 | }; 318 | 97C147031CF9000F007C117D /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ALWAYS_SEARCH_USER_PATHS = NO; 322 | CLANG_ANALYZER_NONNULL = YES; 323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 324 | CLANG_CXX_LIBRARY = "libc++"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 328 | CLANG_WARN_BOOL_CONVERSION = YES; 329 | CLANG_WARN_COMMA = YES; 330 | CLANG_WARN_CONSTANT_CONVERSION = YES; 331 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INFINITE_RECURSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 339 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 342 | CLANG_WARN_STRICT_PROTOTYPES = YES; 343 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 344 | CLANG_WARN_UNREACHABLE_CODE = YES; 345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 347 | COPY_PHASE_STRIP = NO; 348 | DEBUG_INFORMATION_FORMAT = dwarf; 349 | ENABLE_STRICT_OBJC_MSGSEND = YES; 350 | ENABLE_TESTABILITY = YES; 351 | GCC_C_LANGUAGE_STANDARD = gnu99; 352 | GCC_DYNAMIC_NO_PIC = NO; 353 | GCC_NO_COMMON_BLOCKS = YES; 354 | GCC_OPTIMIZATION_LEVEL = 0; 355 | GCC_PREPROCESSOR_DEFINITIONS = ( 356 | "DEBUG=1", 357 | "$(inherited)", 358 | ); 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 366 | MTL_ENABLE_DEBUG_INFO = YES; 367 | ONLY_ACTIVE_ARCH = YES; 368 | SDKROOT = iphoneos; 369 | TARGETED_DEVICE_FAMILY = "1,2"; 370 | }; 371 | name = Debug; 372 | }; 373 | 97C147041CF9000F007C117D /* Release */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ALWAYS_SEARCH_USER_PATHS = NO; 377 | CLANG_ANALYZER_NONNULL = YES; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 383 | CLANG_WARN_BOOL_CONVERSION = YES; 384 | CLANG_WARN_COMMA = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 387 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 388 | CLANG_WARN_EMPTY_BODY = YES; 389 | CLANG_WARN_ENUM_CONVERSION = YES; 390 | CLANG_WARN_INFINITE_RECURSION = YES; 391 | CLANG_WARN_INT_CONVERSION = YES; 392 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 393 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 394 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 395 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 396 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 397 | CLANG_WARN_STRICT_PROTOTYPES = YES; 398 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | SDKROOT = iphoneos; 417 | SUPPORTED_PLATFORMS = iphoneos; 418 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 419 | TARGETED_DEVICE_FAMILY = "1,2"; 420 | VALIDATE_PRODUCT = YES; 421 | }; 422 | name = Release; 423 | }; 424 | 97C147061CF9000F007C117D /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 427 | buildSettings = { 428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 429 | CLANG_ENABLE_MODULES = YES; 430 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 431 | ENABLE_BITCODE = NO; 432 | FRAMEWORK_SEARCH_PATHS = ( 433 | "$(inherited)", 434 | "$(PROJECT_DIR)/Flutter", 435 | ); 436 | INFOPLIST_FILE = Runner/Info.plist; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 438 | LIBRARY_SEARCH_PATHS = ( 439 | "$(inherited)", 440 | "$(PROJECT_DIR)/Flutter", 441 | ); 442 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 445 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 446 | SWIFT_VERSION = 5.0; 447 | VERSIONING_SYSTEM = "apple-generic"; 448 | }; 449 | name = Debug; 450 | }; 451 | 97C147071CF9000F007C117D /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 454 | buildSettings = { 455 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 456 | CLANG_ENABLE_MODULES = YES; 457 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 458 | ENABLE_BITCODE = NO; 459 | FRAMEWORK_SEARCH_PATHS = ( 460 | "$(inherited)", 461 | "$(PROJECT_DIR)/Flutter", 462 | ); 463 | INFOPLIST_FILE = Runner/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 465 | LIBRARY_SEARCH_PATHS = ( 466 | "$(inherited)", 467 | "$(PROJECT_DIR)/Flutter", 468 | ); 469 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 472 | SWIFT_VERSION = 5.0; 473 | VERSIONING_SYSTEM = "apple-generic"; 474 | }; 475 | name = Release; 476 | }; 477 | /* End XCBuildConfiguration section */ 478 | 479 | /* Begin XCConfigurationList section */ 480 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 97C147031CF9000F007C117D /* Debug */, 484 | 97C147041CF9000F007C117D /* Release */, 485 | 249021D3217E4FDB00AE95B9 /* Profile */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 97C147061CF9000F007C117D /* Debug */, 494 | 97C147071CF9000F007C117D /* Release */, 495 | 249021D4217E4FDB00AE95B9 /* Profile */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | /* End XCConfigurationList section */ 501 | }; 502 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 503 | } 504 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/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/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/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/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craiglabenz/flutter_rolling_nav_bar/273e7ba627e9ce76027fdf058ca6e55f6011ca6f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/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/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/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/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 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/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:polygon_clipper/polygon_clipper.dart'; 4 | import 'package:rolling_nav_bar/indexed.dart'; 5 | import 'package:rolling_nav_bar/rolling_nav_bar.dart'; 6 | 7 | void main() => runApp(MyApp()); 8 | 9 | double scaledHeight(BuildContext context, double baseSize) { 10 | return baseSize * (MediaQuery.of(context).size.height / 800); 11 | } 12 | 13 | double scaledWidth(BuildContext context, double baseSize) { 14 | return baseSize * (MediaQuery.of(context).size.width / 375); 15 | } 16 | 17 | class MyApp extends StatefulWidget { 18 | // This widget is the root of your application. 19 | @override 20 | _MyAppState createState() => _MyAppState(); 21 | } 22 | 23 | class _MyAppState extends State { 24 | Color logoColor; 25 | int activeIndex; 26 | 27 | var iconData = [ 28 | Icons.home, 29 | Icons.people, 30 | Icons.account_circle, 31 | Icons.chat, 32 | Icons.settings, 33 | ]; 34 | 35 | var badges = [null, null, null, null, null]; 36 | 37 | var iconText = [ 38 | Text('Home', style: TextStyle(color: Colors.grey, fontSize: 12)), 39 | Text('Friends', style: TextStyle(color: Colors.grey, fontSize: 12)), 40 | Text('Account', style: TextStyle(color: Colors.grey, fontSize: 12)), 41 | Text('Chat', style: TextStyle(color: Colors.grey, fontSize: 12)), 42 | Text('Settings', style: TextStyle(color: Colors.grey, fontSize: 12)), 43 | ]; 44 | 45 | var indicatorColors = [ 46 | Colors.red, 47 | Colors.orange, 48 | Colors.green, 49 | Colors.blue, 50 | Colors.purple, 51 | ]; 52 | 53 | List get badgeWidgets => indexed(badges) 54 | .map((Indexed indexed) => indexed.value != null 55 | ? Text(indexed.value.toString(), 56 | style: TextStyle( 57 | color: indexed.index == activeIndex 58 | ? indicatorColors[indexed.index] 59 | : Colors.white, 60 | )) 61 | : null) 62 | .toList(); 63 | 64 | @override 65 | void initState() { 66 | logoColor = Colors.red[600]; 67 | activeIndex = 0; 68 | super.initState(); 69 | } 70 | 71 | void incrementIndex() { 72 | setState(() { 73 | activeIndex = activeIndex < (iconData.length - 1) ? activeIndex + 1 : 0; 74 | }); 75 | } 76 | 77 | _onAnimate(AnimationUpdate update) { 78 | setState(() { 79 | logoColor = update.color; 80 | }); 81 | } 82 | 83 | _onTap(int index) { 84 | if (activeIndex == index) { 85 | _incrementBadge(); 86 | } 87 | activeIndex = index; 88 | setState(() {}); 89 | } 90 | 91 | void _incrementBadge() { 92 | badges[activeIndex] = 93 | badges[activeIndex] == null ? 1 : badges[activeIndex] + 1; 94 | setState(() {}); 95 | } 96 | 97 | List get builderChildren => const [ 98 | Text('1', style: TextStyle(color: Colors.grey)), 99 | Text('2', style: TextStyle(color: Colors.grey)), 100 | Text('3', style: TextStyle(color: Colors.grey)), 101 | ]; 102 | 103 | @override 104 | Widget build(BuildContext context) { 105 | return MaterialApp( 106 | theme: ThemeData( 107 | scaffoldBackgroundColor: Colors.blue[100], 108 | ), 109 | home: Directionality( 110 | // textDirection: TextDirection.rtl, 111 | // textDirection: TextDirection.ltr, 112 | textDirection: Directionality.of(context) ?? TextDirection.ltr, 113 | child: Builder( 114 | builder: (BuildContext context) { 115 | double largeIconHeight = MediaQuery.of(context).size.width; 116 | double navBarHeight = scaledHeight(context, 85); 117 | double topOffset = (MediaQuery.of(context).size.height - 118 | largeIconHeight - 119 | MediaQuery.of(context).viewInsets.top - 120 | (navBarHeight * 2)) / 121 | 2; 122 | return Scaffold( 123 | floatingActionButton: FloatingActionButton( 124 | backgroundColor: logoColor, 125 | child: Icon(Icons.add), 126 | onPressed: _incrementBadge, 127 | ), 128 | appBar: AppBar( 129 | title: Text('Rolling Nav Bar: Tab ${activeIndex + 1}'), 130 | ), 131 | body: Stack( 132 | children: [ 133 | Positioned( 134 | top: topOffset, 135 | height: largeIconHeight, 136 | width: largeIconHeight, 137 | child: GestureDetector( 138 | onTap: incrementIndex, 139 | child: ClipPolygon( 140 | sides: 6, 141 | borderRadius: 15, 142 | child: Container( 143 | height: largeIconHeight, 144 | width: largeIconHeight, 145 | color: logoColor, 146 | child: Center( 147 | child: Padding( 148 | padding: EdgeInsets.fromLTRB(0, 100, 30, 0), 149 | child: Transform( 150 | transform: Matrix4.skew(0.1, -0.50), 151 | child: Text( 152 | 'Rolling\nNav Bar', 153 | textAlign: TextAlign.center, 154 | style: TextStyle( 155 | color: Colors.white, 156 | fontSize: scaledWidth(context, 63), 157 | fontFeatures: [ 158 | FontFeature.enable('smcp') 159 | ], 160 | shadows: [ 161 | Shadow( 162 | offset: Offset(5, 5), 163 | blurRadius: 3.0, 164 | color: Color.fromARGB(255, 0, 0, 0), 165 | ), 166 | Shadow( 167 | offset: Offset(5, 5), 168 | blurRadius: 8.0, 169 | color: Color.fromARGB(125, 0, 0, 255), 170 | ), 171 | ], 172 | ), 173 | ), 174 | ), 175 | ), 176 | ), 177 | ), 178 | ), 179 | ), 180 | ), 181 | ], 182 | ), 183 | bottomNavigationBar: Container( 184 | height: navBarHeight, 185 | width: MediaQuery.of(context).size.width, 186 | // Option 1: Recommended 187 | child: RollingNavBar.iconData( 188 | activeBadgeColors: [ 189 | Colors.white, 190 | ], 191 | activeIndex: activeIndex, 192 | animationCurve: Curves.linear, 193 | animationType: AnimationType.roll, 194 | baseAnimationSpeed: 200, 195 | badges: badgeWidgets, 196 | iconData: iconData, 197 | iconColors: [Colors.grey[800]], 198 | iconText: iconText, 199 | indicatorColors: indicatorColors, 200 | iconSize: 25, 201 | indicatorRadius: scaledHeight(context, 30), 202 | onAnimate: _onAnimate, 203 | onTap: _onTap, 204 | ), 205 | 206 | // Option 2: More complicated, but there if you need it 207 | // child: RollingNavBar.builder( 208 | // builder: ( 209 | // BuildContext context, 210 | // int index, 211 | // AnimationInfo info, 212 | // AnimationUpdate update, 213 | // ) { 214 | // return builderChildren[index]; 215 | // }, 216 | // badges: badgeWidgets.sublist(0, builderChildren.length), 217 | // indicatorColors: 218 | // indicatorColors.sublist(0, builderChildren.length), 219 | // numChildren: builderChildren.length, 220 | // onTap: _onTap, 221 | // ), 222 | ), 223 | ); 224 | }, 225 | ), 226 | ), 227 | ); 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.5.0-nullsafety.1" 11 | badges: 12 | dependency: transitive 13 | description: 14 | name: badges 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.1.0" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0-nullsafety.1" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.0-nullsafety.3" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.2.0-nullsafety.1" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.0-nullsafety.1" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.15.0-nullsafety.3" 53 | cupertino_icons: 54 | dependency: "direct main" 55 | description: 56 | name: cupertino_icons 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "0.1.3" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.2.0-nullsafety.1" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.10-nullsafety.1" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.3.0-nullsafety.3" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.8.0-nullsafety.1" 98 | pigment: 99 | dependency: transitive 100 | description: 101 | name: pigment 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.0.3" 105 | polygon_clipper: 106 | dependency: "direct main" 107 | description: 108 | name: polygon_clipper 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.0.2" 112 | rolling_nav_bar: 113 | dependency: "direct main" 114 | description: 115 | path: ".." 116 | relative: true 117 | source: path 118 | version: "0.0.3" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.8.0-nullsafety.2" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.10.0-nullsafety.1" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.1.0-nullsafety.1" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.1.0-nullsafety.1" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.2.0-nullsafety.1" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "0.2.19-nullsafety.2" 166 | tinycolor: 167 | dependency: transitive 168 | description: 169 | name: tinycolor 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.0.2" 173 | typed_data: 174 | dependency: transitive 175 | description: 176 | name: typed_data 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.3.0-nullsafety.3" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.1.0-nullsafety.3" 187 | sdks: 188 | dart: ">=2.10.0-110 <2.11.0" 189 | flutter: ">=0.2.5 <2.0.0" 190 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: Demonstration of the `flutter_rolling_nav_bar` package. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | polygon_clipper: ^1.0.2 21 | flutter: 22 | sdk: flutter 23 | 24 | rolling_nav_bar: 25 | path: ../ 26 | 27 | # The following adds the Cupertino Icons font to your application. 28 | # Use with the CupertinoIcons class for iOS style icons. 29 | cupertino_icons: ^0.1.2 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://dart.dev/tools/pub/pubspec 38 | 39 | # The following section is specific to Flutter. 40 | flutter: 41 | 42 | # The following line ensures that the Material Icons font is 43 | # included with your application, so that you can use the icons in 44 | # the material Icons class. 45 | uses-material-design: true 46 | 47 | # To add assets to your application, add an assets section, like this: 48 | # assets: 49 | # - images/a_dot_burr.jpeg 50 | # - images/a_dot_ham.jpeg 51 | 52 | # An image asset can refer to one or more resolution-specific "variants", see 53 | # https://flutter.dev/assets-and-images/#resolution-aware. 54 | 55 | # For details regarding adding assets from package dependencies, see 56 | # https://flutter.dev/assets-and-images/#from-packages 57 | 58 | # To add custom fonts to your application, add a fonts section here, 59 | # in this "flutter" section. Each entry in this list should have a 60 | # "family" key with the font family name, and a "fonts" key with a 61 | # list giving the asset and other descriptors for the font. For 62 | # example: 63 | # fonts: 64 | # - family: Schyler 65 | # fonts: 66 | # - asset: fonts/Schyler-Regular.ttf 67 | # - asset: fonts/Schyler-Italic.ttf 68 | # style: italic 69 | # - family: Trajan Pro 70 | # fonts: 71 | # - asset: fonts/TrajanPro.ttf 72 | # - asset: fonts/TrajanPro_Bold.ttf 73 | # weight: 700 74 | # 75 | # For details regarding fonts from package dependencies, 76 | # see https://flutter.dev/custom-fonts/#from-packages 77 | -------------------------------------------------------------------------------- /lib/indexed.dart: -------------------------------------------------------------------------------- 1 | library more.iterable.indexed; 2 | 3 | /// Returns a iterable that combines the index and value of an iterable. 4 | /// 5 | /// By default the index is zero based, but an arbitrary [offset] can be 6 | /// provided. 7 | /// 8 | /// For example, the expression 9 | /// 10 | /// indexed(['a', 'b'], offset: 1) 11 | /// .map((each) => '${each.index}: ${each.value}') 12 | /// .join(', '); 13 | /// 14 | /// returns 15 | /// 16 | /// '1: a, 2: b' 17 | /// 18 | Iterable> indexed(Iterable elements, {int offset = 0}) sync* { 19 | for (final element in elements) { 20 | yield Indexed(offset++, element); 21 | } 22 | } 23 | 24 | /// An indexed value. 25 | class Indexed { 26 | final int index; 27 | final E value; 28 | const Indexed(this.index, this.value); 29 | } 30 | -------------------------------------------------------------------------------- /lib/rolling_nav_bar.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'indexed.dart'; 4 | import 'package:badges/badges.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:polygon_clipper/polygon_clipper.dart'; 7 | import 'package:tinycolor/tinycolor.dart'; 8 | 9 | enum Direction { forward, backward, stationary } 10 | enum AnimationType { roll, shrinkOutIn, snap, spinOutIn } 11 | typedef Widget RollingNavBarChildBuilder( 12 | BuildContext context, 13 | int index, 14 | AnimationInfo animationInfo, 15 | AnimationUpdate animationUpdate, 16 | ); 17 | 18 | /// Container for the most primitive data necessary to drive our animation with 19 | /// functions to yield the next tier of calculated data for the animation. 20 | class AnimationInfo { 21 | /// Number of sides for the active indicator - e.g., 6 is a hexagon. 22 | final int numSides; 23 | 24 | /// Index toward which the active indicator is heading. 25 | final int newIndex; 26 | 27 | /// Index from which the active indicator is leaving. 28 | final int oldIndex; 29 | 30 | /// The amount of sides on the active indicator that it should roll as it 31 | /// traverses each list item. Calibrated to create a realistic rolling motion. 32 | final double sidesPerListItem; 33 | 34 | /// The amount of rotation applied to the active indicator at the start of 35 | /// this transition. 36 | final double startingRotation; 37 | 38 | AnimationInfo({ 39 | @required this.newIndex, 40 | @required this.numSides, 41 | @required this.oldIndex, 42 | @required this.sidesPerListItem, 43 | @required this.startingRotation, 44 | }); 45 | 46 | Direction get direction => 47 | newIndex > oldIndex ? Direction.forward : Direction.backward; 48 | int get indexDelta => (newIndex - oldIndex).abs(); 49 | 50 | /// Percent of a full rotation an active indicator should see for each of its 51 | /// sides. 52 | double get radiansPerSide => 2 * pi / numSides; 53 | 54 | /// Total rotation required to reach the new index. 55 | /// 56 | /// Note that this is correct because the active indicator holds its rotation 57 | /// value when it gets to an index. So when the user clicks on Tab 2, the 58 | /// indicator rolls there and holds. Imagine that it rolls 180°, or pi radians, 59 | /// and then is followed up by a click on thie third tab, requiring yet another 60 | /// 180° or pi radians. This number indicates that to reach the third tab, 61 | /// a total rotation value of 2pi radians is required, but already stored is 62 | /// that the active indicator has rotated pi radians (or 180°). 63 | double get radiansToRotate => newIndex * radiansPerSide * sidesPerListItem; 64 | 65 | /// Total rotation required to reach the new index, minus what has already 66 | /// been rotated. This number is fixed from the beginning of the transition 67 | /// and does not update as the active indicator animates. 68 | double get radiansToRotateDelta => direction == Direction.forward 69 | ? radiansToRotate - startingRotation 70 | : startingRotation - radiansToRotate; 71 | } 72 | 73 | /// Container for the state of a [RollingNavBar]'s animation, useful for syncing 74 | /// visual effects elsewhere in your app with nav bar animation progress. 75 | class AnimationUpdate { 76 | /// The relative value of the animation, taking into account the selected 77 | /// curve. 78 | final double animationValue; 79 | 80 | /// The current color of the active indicator as it is (optionally) linearly 81 | /// interpolated. 82 | final Color color; 83 | 84 | /// Whether the user has selected a tab before or after the previous tab. 85 | final Direction direction; 86 | 87 | /// The absolute value or progress of the animation, without taking into 88 | /// account the selected curve. 89 | final double percentAnimated; 90 | 91 | /// The current rotation of the active indicator, in radians. 92 | final double rotation; 93 | AnimationUpdate({ 94 | @required this.animationValue, 95 | @required this.color, 96 | @required this.direction, 97 | @required this.percentAnimated, 98 | @required this.rotation, 99 | }); 100 | } 101 | 102 | /// Bottom nav bar with playful and customizable transitions between active 103 | /// states. 104 | /// 105 | /// This widget is suitable for the bottom of a [Stack] or a [Scaffold]'s 106 | /// `bottomNavigationBar` slot, though in the latter, a sizing wrapping widget 107 | /// is required. 108 | /// 109 | /// [RollingNavBar] has two named constructors, `children` and `iconData`, and 110 | /// no default constructor. The two constructors exist to accept each of the 111 | /// possible children types - a list of widgets (`children`), or a list of raw 112 | /// [IconData] objects (`iconData`). Because [iconData] objects can be 113 | /// dynamically inserted into [Icon] classes with custom styles, this constructor 114 | /// offers much more helpful default active state handling. 115 | /// 116 | /// [RollingNavBar] is a [StatelessWidget] that wraps an internal 117 | /// [StatefulWidget] for the purposes of introducing a [LayoutBuilder] in the 118 | /// render pipeline. 119 | class RollingNavBar extends StatelessWidget { 120 | /// Optional set of colors for badges while above the active indicator. 121 | final List activeBadgeColors; 122 | 123 | /// Optional set of colors of each icon to display when in the active state. 124 | final List activeIconColors; 125 | 126 | /// Optional list of badges to apply to each nav item. [null] placeholders 127 | /// in the list are necessary for unbadged tab bar items. 128 | final List badges; 129 | 130 | /// Initial tab in the highlighted state. 131 | final int activeIndex; 132 | 133 | /// Behavior of the active indicator's transition from tab to tab. 134 | final Curve animationCurve; 135 | 136 | /// Indicator for desired animation behavior. 137 | final AnimationType animationType; 138 | 139 | /// Milliseconds for the background indicator to move one tab. 140 | final int baseAnimationSpeed; 141 | 142 | /// Optional builder function for the individual navigation icons. 143 | final RollingNavBarChildBuilder builder; 144 | 145 | /// Optional override for icon colors. If supplied, must have a length of one 146 | /// or the same length as [iconData]. A length of 1 indicates a single color 147 | /// for all tabs. 148 | final List iconColors; 149 | 150 | /// Icon data to render in the tab bar. Use this option if you want 151 | /// [RollingNavBar] to manage your tabs' colors. Pass this or [children]. 152 | final List iconData; 153 | 154 | /// Optional custom size for each tab bar icon. 155 | final double iconSize; 156 | 157 | /// Optional list of text widgets to display beneath inactive icons. 158 | final List iconText; 159 | 160 | /// Optional list of colors for the active indicator. If supplied, must have a 161 | /// length of one or the same length as [iconData]. A length of 1 indicates a 162 | /// single color for all tabs. 163 | final List indicatorColors; 164 | 165 | /// Rounded edge of the active indicator's corners. 166 | final double indicatorCornerRadius; 167 | 168 | /// Size of the background active indicator. 169 | final double indicatorRadius; 170 | 171 | /// Number of sides to the background active indicator. Value of `null` 172 | /// indicates a circle, which negates the rolling effect. 173 | final int indicatorSides; 174 | 175 | /// Optional display override for the nav bar's background. 176 | final BoxDecoration navBarDecoration; 177 | 178 | /// Used by the `builder()` constructor to know how many icons the tab bar 179 | /// should contain. 180 | final int numChildren; 181 | 182 | /// Optional handler which will be called on every tick of the animation. 183 | final Function(AnimationUpdate) onAnimate; 184 | 185 | /// Optional handler which is passed every updated active index. 186 | final Function(int) onTap; 187 | 188 | /// Rotation speed controller with a default value designed to create a 189 | /// realistic rolling illusion. 190 | final double sidesPerListItem; 191 | 192 | RollingNavBar.builder({ 193 | @required this.builder, 194 | @required this.numChildren, 195 | this.activeBadgeColors, 196 | this.activeIndex = 0, 197 | this.animationCurve = Curves.linear, 198 | this.animationType = AnimationType.roll, 199 | this.badges, 200 | this.baseAnimationSpeed = 200, 201 | this.indicatorColors = const [Colors.black], 202 | this.indicatorCornerRadius = 10, 203 | this.indicatorRadius = 25, 204 | this.indicatorSides = 6, 205 | this.navBarDecoration, 206 | this.onAnimate, 207 | this.onTap, 208 | this.sidesPerListItem, 209 | }) : activeIconColors = null, 210 | iconColors = null, 211 | iconData = null, 212 | iconSize = null, 213 | iconText = null, 214 | assert(activeBadgeColors == null || 215 | activeBadgeColors.length == 1 || 216 | activeBadgeColors.length == numChildren), 217 | assert(badges == null || badges.length == numChildren), 218 | assert(indicatorSides > 2), 219 | assert(numChildren != null); 220 | RollingNavBar.iconData({ 221 | @required this.iconData, 222 | this.activeBadgeColors, 223 | this.activeIconColors, 224 | this.activeIndex = 0, 225 | this.animationCurve = Curves.linear, 226 | this.animationType = AnimationType.roll, 227 | this.badges, 228 | this.baseAnimationSpeed = 200, 229 | this.iconColors = const [Colors.black], 230 | this.iconSize, 231 | this.iconText, 232 | this.indicatorColors = const [Colors.pink], 233 | this.indicatorCornerRadius = 10, 234 | this.indicatorRadius = 25, 235 | this.indicatorSides = 6, 236 | this.navBarDecoration, 237 | this.onAnimate, 238 | this.onTap, 239 | this.sidesPerListItem, 240 | }) : numChildren = iconData.length, 241 | builder = null, 242 | assert(iconText == null || iconText.length == iconData.length), 243 | assert(indicatorSides > 2), 244 | assert(activeBadgeColors == null || 245 | activeBadgeColors.length == 1 || 246 | activeBadgeColors.length == iconData.length), 247 | assert(activeIconColors == null || 248 | activeIconColors.length == 1 || 249 | activeIconColors.length == iconData.length), 250 | assert(badges == null || badges.length == iconData.length), 251 | assert(iconColors.length == 1 || iconColors.length == iconData.length), 252 | assert(indicatorColors.length == 1 || 253 | indicatorColors.length == iconData.length); 254 | 255 | Widget build(BuildContext context) { 256 | return LayoutBuilder( 257 | builder: (BuildContext context, BoxConstraints constraints) { 258 | return _RollingNavBarInner( 259 | activeBadgeColors: activeBadgeColors, 260 | activeIconColors: activeIconColors, 261 | activeIndex: activeIndex, 262 | animationCurve: animationCurve, 263 | animationType: animationType, 264 | badges: badges, 265 | baseAnimationSpeed: baseAnimationSpeed, 266 | builder: builder, 267 | height: constraints.maxHeight, 268 | iconColors: iconColors, 269 | iconData: iconData, 270 | iconSize: iconSize, 271 | iconText: iconText, 272 | indicatorColors: indicatorColors, 273 | indicatorCornerRadius: indicatorCornerRadius, 274 | indicatorRadius: indicatorRadius, 275 | indicatorSides: indicatorSides, 276 | isLtr: Directionality.of(context).index == 1, 277 | navBarDecoration: navBarDecoration, 278 | numChildren: numChildren, 279 | onAnimate: onAnimate, 280 | onTap: onTap, 281 | sidesPerListItem: sidesPerListItem, 282 | width: constraints.maxWidth, 283 | ); 284 | }, 285 | ); 286 | } 287 | } 288 | 289 | class _RollingNavBarInner extends StatefulWidget { 290 | final List activeBadgeColors; 291 | final List activeIconColors; 292 | final int activeIndex; 293 | final Curve animationCurve; 294 | final AnimationType animationType; 295 | final List badges; 296 | final int baseAnimationSpeed; 297 | final RollingNavBarChildBuilder builder; 298 | final double height; 299 | final List iconColors; 300 | final List iconData; 301 | final List iconText; 302 | final List indicatorColors; 303 | final double indicatorCornerRadius; 304 | final double indicatorRadius; 305 | final int indicatorSides; 306 | final double iconSize; 307 | final bool isLtr; 308 | final int numChildren; 309 | final Function(AnimationUpdate) onAnimate; 310 | final Function(int) onTap; 311 | final double sidesPerListItem; 312 | final BoxDecoration navBarDecoration; 313 | final double width; 314 | _RollingNavBarInner({ 315 | @required this.activeBadgeColors, 316 | @required this.activeIconColors, 317 | @required this.activeIndex, 318 | @required this.animationCurve, 319 | @required this.animationType, 320 | @required this.badges, 321 | @required this.baseAnimationSpeed, 322 | @required this.builder, 323 | @required this.height, 324 | @required this.iconColors, 325 | @required this.iconData, 326 | @required this.iconSize, 327 | @required this.iconText, 328 | @required this.indicatorColors, 329 | @required this.indicatorCornerRadius, 330 | @required this.indicatorRadius, 331 | @required this.indicatorSides, 332 | @required this.isLtr, 333 | @required this.numChildren, 334 | @required this.onAnimate, 335 | @required this.onTap, 336 | @required this.sidesPerListItem, 337 | @required this.navBarDecoration, 338 | @required this.width, 339 | }); 340 | @override 341 | _RollingNavBarInnerState createState() => _RollingNavBarInnerState(); 342 | } 343 | 344 | class _RollingNavBarInnerState extends State<_RollingNavBarInner> 345 | with TickerProviderStateMixin { 346 | // Data needed for any `AnimationType` 347 | int activeIndex; 348 | int widgetActiveIndex; 349 | Color indicatorColor; 350 | 351 | AnimationInfo animationInfo; 352 | AnimationUpdate animationUpdate; 353 | 354 | // Size-based parameters 355 | double maxIndicatorRadius; 356 | double indicatorRadius; 357 | 358 | // Rotation-based parameters 359 | double indicatorRotation; // in radians 360 | double indicatorX; 361 | double sidesPerListItem; 362 | 363 | // Controllers for any `AnimationType` 364 | AnimationController indicatorAnimationController; 365 | Animation indicatorAnimationTween; 366 | 367 | @override 368 | void initState() { 369 | super.initState(); 370 | widgetActiveIndex = widget.activeIndex; 371 | activeIndex = widget.activeIndex; 372 | sidesPerListItem = widget.sidesPerListItem ?? _calculateSidesPerListItem(); 373 | maxIndicatorRadius = widget.indicatorRadius; 374 | indicatorColor = widget.indicatorColors.length > activeIndex 375 | ? widget.indicatorColors[activeIndex] 376 | : widget.indicatorColors.first; 377 | indicatorRadius = widget.indicatorRadius; 378 | indicatorRotation = 0; 379 | indicatorX = activeIndex * tabChunkWidth; 380 | animationUpdate = initializeAnimationUpdate(); 381 | animationInfo = initializeAnimationInfo(); 382 | } 383 | 384 | AnimationUpdate initializeAnimationUpdate() { 385 | return AnimationUpdate( 386 | animationValue: 0, 387 | rotation: 0, 388 | percentAnimated: 0, 389 | direction: Direction.stationary, 390 | color: _getActiveIconColor(), 391 | ); 392 | } 393 | 394 | AnimationInfo initializeAnimationInfo() { 395 | return AnimationInfo( 396 | startingRotation: 0, 397 | newIndex: 0, 398 | oldIndex: 0, 399 | numSides: widget.indicatorSides, 400 | sidesPerListItem: sidesPerListItem, 401 | ); 402 | } 403 | 404 | AnimationUpdate getAnimationCompletedUpdate() { 405 | return AnimationUpdate( 406 | animationValue: 1, 407 | rotation: animationUpdate.rotation, 408 | percentAnimated: 1, 409 | direction: Direction.stationary, 410 | color: _getActiveIconColor(), 411 | ); 412 | } 413 | 414 | /// Measure of the available space for each nav item. 415 | double get tabChunkWidth => widget.width / widget.numChildren; 416 | 417 | /// The X coordinate our active indicator needs to reach after each click. 418 | /// This is only valid *after* updating `activeIndex`. 419 | double get targetX => activeIndex * tabChunkWidth; 420 | 421 | double _calculateSidesPerListItem() { 422 | int numChildren = widget.numChildren.clamp(3, 5); 423 | return { 424 | 3: 4, 425 | 4: 3, 426 | 5: 3, 427 | }[numChildren]; 428 | } 429 | 430 | @override 431 | void dispose() { 432 | if (indicatorAnimationController != null) 433 | indicatorAnimationController.dispose(); 434 | super.dispose(); 435 | } 436 | 437 | void _setActive(int newIndex) { 438 | if (newIndex == activeIndex) return; 439 | 440 | var _originalIndex = activeIndex; 441 | 442 | setState(() { 443 | activeIndex = newIndex; 444 | }); 445 | 446 | animationInfo = AnimationInfo( 447 | newIndex: newIndex, 448 | numSides: widget.indicatorSides, 449 | oldIndex: _originalIndex, 450 | sidesPerListItem: sidesPerListItem, 451 | startingRotation: indicatorRotation, 452 | ); 453 | 454 | // Kick off the animation 455 | if (widget.animationType == AnimationType.roll) { 456 | _rollActiveIndicator(animationInfo); 457 | } else if (widget.animationType == AnimationType.snap) { 458 | _snapActiveIndicator(animationInfo); 459 | } else if (widget.animationType == AnimationType.spinOutIn) { 460 | _spinOutInActiveIndicator(animationInfo); 461 | } else if (widget.animationType == AnimationType.shrinkOutIn) { 462 | _spinOutInActiveIndicator(animationInfo, shouldRotate: false); 463 | } 464 | } 465 | 466 | void _rollActiveIndicator(AnimationInfo info) { 467 | double _indicatorXAnimationStart = indicatorX; 468 | indicatorAnimationController = AnimationController( 469 | duration: 470 | Duration(milliseconds: widget.baseAnimationSpeed * info.indexDelta), 471 | vsync: this, 472 | ); 473 | Animation curve = CurvedAnimation( 474 | parent: indicatorAnimationController, curve: widget.animationCurve); 475 | indicatorAnimationTween = Tween(begin: 0, end: 1).animate(curve) 476 | ..addListener(() { 477 | if (info.direction == Direction.forward) { 478 | indicatorRotation = 479 | info.startingRotation + (info.radiansToRotateDelta * curve.value); 480 | } else { 481 | indicatorRotation = 482 | info.startingRotation - (info.radiansToRotateDelta * curve.value); 483 | } 484 | indicatorX = _indicatorXAnimationStart + 485 | (targetX - _indicatorXAnimationStart) * curve.value; 486 | indicatorColor = _getRollerColor( 487 | info.oldIndex, 488 | info.newIndex, 489 | curve.value, 490 | ); 491 | setState(() {}); 492 | if (widget.onAnimate != null) { 493 | animationUpdate = AnimationUpdate( 494 | animationValue: curve.value, 495 | color: indicatorColor, 496 | direction: info.direction, 497 | percentAnimated: indicatorAnimationController.value, 498 | rotation: indicatorRotation, 499 | ); 500 | widget.onAnimate(animationUpdate); 501 | } 502 | }) 503 | ..addStatusListener((AnimationStatus status) { 504 | if (status == AnimationStatus.completed) { 505 | animationUpdate = getAnimationCompletedUpdate(); 506 | } 507 | }); 508 | 509 | indicatorAnimationController.forward(); 510 | } 511 | 512 | void _snapActiveIndicator(AnimationInfo info) { 513 | setState(() { 514 | indicatorX = targetX; 515 | indicatorColor = _getRollerColor(activeIndex, activeIndex, 1.0); 516 | }); 517 | if (widget.onAnimate != null) { 518 | animationUpdate = AnimationUpdate( 519 | animationValue: 1, 520 | color: indicatorColor, 521 | direction: info.direction, 522 | percentAnimated: 1, 523 | rotation: indicatorRotation, 524 | ); 525 | widget.onAnimate(animationUpdate); 526 | } 527 | } 528 | 529 | void _spinOutInActiveIndicator(AnimationInfo info, 530 | {bool shouldRotate = true}) { 531 | indicatorAnimationController = AnimationController( 532 | duration: Duration(milliseconds: widget.baseAnimationSpeed), 533 | vsync: this, 534 | ); 535 | 536 | // One rotation to spin out, one to spin in 537 | double totalRadiansToRotate = 2 * pi * 2; 538 | 539 | Animation curve = CurvedAnimation( 540 | parent: indicatorAnimationController, 541 | curve: widget.animationCurve, 542 | ); 543 | indicatorAnimationTween = Tween(begin: 0, end: 1).animate(curve) 544 | ..addListener(() { 545 | if (curve.value < 0.5) { 546 | double percentToHalf = curve.value * 2; 547 | indicatorRadius = maxIndicatorRadius * (1 - percentToHalf); 548 | } else { 549 | double percentPastHalf = (curve.value - 0.5) * 2; 550 | indicatorRadius = maxIndicatorRadius * percentPastHalf; 551 | indicatorX = targetX; 552 | } 553 | indicatorColor = 554 | _getRollerColor(info.oldIndex, info.newIndex, curve.value); 555 | indicatorRotation = shouldRotate 556 | ? totalRadiansToRotate * curve.value 557 | : indicatorRotation; 558 | setState(() {}); 559 | 560 | if (widget.onAnimate != null) { 561 | animationUpdate = AnimationUpdate( 562 | animationValue: 1, 563 | color: indicatorColor, 564 | direction: info.direction, 565 | percentAnimated: indicatorAnimationController.value, 566 | rotation: indicatorRotation, 567 | ); 568 | widget.onAnimate(animationUpdate); 569 | } 570 | }); 571 | indicatorAnimationController.forward(); 572 | } 573 | 574 | Color _getRollerColor(int oldIndex, int newIndex, double animationValue) { 575 | if (widget.indicatorColors.length == 1) return widget.indicatorColors.first; 576 | return Color.lerp( 577 | widget.indicatorColors[oldIndex], 578 | widget.indicatorColors[newIndex], 579 | animationValue, 580 | ); 581 | } 582 | 583 | double get maxWidth => 584 | (widget.numChildren - 1) * tabChunkWidth + (tabChunkWidth / 2); 585 | 586 | @override 587 | Widget build(BuildContext context) { 588 | double Function(double) directionalityCenterXTransform = widget.isLtr 589 | ? (x) => x + (tabChunkWidth / 2) - indicatorRadius 590 | : (x) => maxWidth - x - indicatorRadius; 591 | return Container( 592 | height: widget.height, 593 | decoration: widget.navBarDecoration ?? 594 | BoxDecoration( 595 | color: Colors.white, 596 | ), 597 | child: Stack( 598 | children: [ 599 | ActiveIndicator( 600 | centerX: directionalityCenterXTransform(indicatorX), 601 | centerY: (widget.height / 2) - indicatorRadius, 602 | color: indicatorColor, 603 | cornerRadius: widget.indicatorCornerRadius, 604 | height: indicatorRadius * 2, 605 | numSides: widget.indicatorSides, 606 | rotation: widget.isLtr ? indicatorRotation : indicatorRotation * -1, 607 | width: indicatorRadius * 2, 608 | ), 609 | Positioned( 610 | height: widget.height, 611 | width: widget.width, 612 | child: Row( 613 | mainAxisAlignment: MainAxisAlignment.spaceAround, 614 | children: widget.builder != null 615 | ? buildChildren() 616 | : indexed(widget.iconData).map(_buildNavBarIcon).toList(), 617 | ), 618 | ), 619 | ], 620 | ), 621 | ); 622 | } 623 | 624 | /// Because `widget.colors` can either have a matching length as the children 625 | /// count, or simply 1 item which stands for a full list of the same color, 626 | /// we have to make this check. 627 | int get colorIndex => 628 | widget.indicatorColors.length == widget.numChildren ? activeIndex : 0; 629 | 630 | /// Because `widget.activeIconColors` can either have a matching length as the 631 | /// children count, or simply 1 item which stands for a full list of the same 632 | /// color, we have to make this check. 633 | int get activeIconColorIndex => 634 | widget.activeIconColors.length == widget.numChildren ? activeIndex : 0; 635 | 636 | Color _getActiveIconColor() { 637 | if (widget.activeIconColors == null) { 638 | return TinyColor(widget.indicatorColors[colorIndex]).lighten(30).color; 639 | } 640 | return widget.activeIconColors[activeIconColorIndex]; 641 | } 642 | 643 | Color _getInactiveIconColor(int index) { 644 | return widget.iconColors.length == widget.numChildren 645 | ? widget.iconColors[index] 646 | : widget.iconColors.first; 647 | } 648 | 649 | Color _getBadgeColor(int index) { 650 | if (index == activeIndex && widget.activeBadgeColors != null) { 651 | return widget.activeBadgeColors.length == 1 652 | ? widget.activeBadgeColors[0] 653 | : widget.activeBadgeColors[index]; 654 | } 655 | 656 | int inactiveIndex = 657 | widget.indicatorColors.length >= (index + 1) ? index : 0; 658 | return activeIndex == index 659 | ? TinyColor(widget.indicatorColors[colorIndex]).lighten(30).color 660 | : widget.indicatorColors[inactiveIndex]; 661 | } 662 | 663 | List buildChildren() { 664 | return List.generate(widget.numChildren, (i) => i) 665 | .map( 666 | (int index) => _buildNavBarItem( 667 | widget.builder( 668 | context, 669 | index, 670 | animationInfo, 671 | animationUpdate, 672 | ), 673 | Indexed(index, index), 674 | ), 675 | ) 676 | .toList(); 677 | } 678 | 679 | Widget _buildNavBarIcon(Indexed indexed) { 680 | final bool isActive = activeIndex == indexed.index; 681 | return _buildNavBarItem( 682 | Icon( 683 | indexed.value, 684 | color: isActive 685 | ? _getActiveIconColor() 686 | : _getInactiveIconColor(indexed.index), 687 | size: widget.iconSize, 688 | ), 689 | indexed, 690 | ); 691 | } 692 | 693 | Widget _buildNavBarItem(Widget child, Indexed indexed) { 694 | final bool isActive = activeIndex == indexed.index; 695 | return _NavBarItem( 696 | child, 697 | badge: widget.badges != null && widget.badges.length >= indexed.index + 1 698 | ? widget.badges[indexed.index] 699 | : null, 700 | badgeColor: _getBadgeColor(indexed.index), 701 | isActive: isActive, 702 | height: widget.height, 703 | key: Key('nav-bar-child-${indexed.index}'), 704 | maxWidth: tabChunkWidth, 705 | onPressed: () { 706 | _setActive(indexed.index); 707 | // Invoke the optional handler for each tap event. 708 | if (widget.onTap != null) { 709 | widget.onTap(indexed.index); 710 | } 711 | }, 712 | textWidget: widget.iconText != null && 713 | !isActive && 714 | widget.iconText.length == widget.numChildren 715 | ? widget.iconText[indexed.index] 716 | : null, 717 | ); 718 | } 719 | 720 | @override 721 | void didUpdateWidget(Widget oldWidget) { 722 | super.didUpdateWidget(oldWidget); 723 | if (widgetActiveIndex != widget.activeIndex) { 724 | setState(() { 725 | widgetActiveIndex = widget.activeIndex; 726 | _setActive(widget.activeIndex); 727 | }); 728 | } 729 | } 730 | } 731 | 732 | /// Foreground widget for each nav bar item. 733 | class _NavBarItem extends StatelessWidget { 734 | final Widget badge; 735 | final Color badgeColor; 736 | final Widget child; 737 | final bool isActive; 738 | final double height; 739 | final Function onPressed; 740 | final double maxWidth; 741 | final Widget textWidget; 742 | const _NavBarItem( 743 | this.child, { 744 | @required this.onPressed, 745 | this.badge, 746 | this.badgeColor, 747 | this.isActive = false, 748 | this.height, 749 | this.maxWidth, 750 | this.textWidget, 751 | Key key, 752 | }) : super(key: key); 753 | 754 | @override 755 | Widget build(BuildContext context) { 756 | return GestureDetector( 757 | behavior: HitTestBehavior.opaque, // Reduces rate of missed taps 758 | onTap: onPressed, 759 | child: Container( 760 | height: height, 761 | width: maxWidth, 762 | child: Column( 763 | mainAxisAlignment: MainAxisAlignment.center, 764 | children: [ 765 | _OptionalBadge( 766 | badge: badge, 767 | child: child, 768 | color: badgeColor, 769 | ), 770 | textWidget ?? Container(), 771 | ], 772 | ), 773 | ), 774 | ); 775 | } 776 | } 777 | 778 | class _OptionalBadge extends StatelessWidget { 779 | final Widget badge; 780 | final Widget child; 781 | final Color color; 782 | _OptionalBadge({this.badge, this.child, this.color, Key key}) 783 | : assert(child != null), 784 | super(key: key); 785 | 786 | @override 787 | Widget build(BuildContext context) { 788 | return badge != null 789 | ? Badge( 790 | badgeColor: color, 791 | badgeContent: badge, 792 | child: child, 793 | ) 794 | : child; 795 | } 796 | } 797 | 798 | /// Colorful indicator for each [_NavBarItem] that animates back and forth 799 | /// across the screen as the user taps. 800 | class ActiveIndicator extends StatelessWidget { 801 | final double centerX; 802 | final double centerY; 803 | final Color color; 804 | final double cornerRadius; 805 | final double height; 806 | final double width; 807 | final double rotation; 808 | final int numSides; 809 | const ActiveIndicator({ 810 | @required this.centerX, 811 | @required this.centerY, 812 | @required this.color, 813 | @required this.cornerRadius, 814 | @required this.height, 815 | @required this.width, 816 | @required this.numSides, 817 | this.rotation = 0, 818 | Key key, 819 | }) : super(key: key); 820 | 821 | @override 822 | Widget build(BuildContext context) { 823 | return Positioned( 824 | top: centerY, 825 | left: centerX, 826 | height: height, 827 | width: width, 828 | child: Transform.rotate( 829 | angle: rotation, 830 | child: ClipPolygon( 831 | sides: numSides, 832 | borderRadius: cornerRadius, 833 | child: Container( 834 | decoration: BoxDecoration( 835 | color: color, 836 | borderRadius: BorderRadius.circular(height), 837 | ), 838 | ), 839 | ), 840 | ), 841 | ); 842 | } 843 | } 844 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.5.0-nullsafety.1" 11 | badges: 12 | dependency: "direct main" 13 | description: 14 | name: badges 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.1.0" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0-nullsafety.1" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.0-nullsafety.3" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.2.0-nullsafety.1" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.0-nullsafety.1" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.15.0-nullsafety.3" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0-nullsafety.1" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.10-nullsafety.1" 77 | meta: 78 | dependency: transitive 79 | description: 80 | name: meta 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.3.0-nullsafety.3" 84 | path: 85 | dependency: transitive 86 | description: 87 | name: path 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.8.0-nullsafety.1" 91 | pigment: 92 | dependency: transitive 93 | description: 94 | name: pigment 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.0.3" 98 | polygon_clipper: 99 | dependency: "direct main" 100 | description: 101 | name: polygon_clipper 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.0.2" 105 | sky_engine: 106 | dependency: transitive 107 | description: flutter 108 | source: sdk 109 | version: "0.0.99" 110 | source_span: 111 | dependency: transitive 112 | description: 113 | name: source_span 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.8.0-nullsafety.2" 117 | stack_trace: 118 | dependency: transitive 119 | description: 120 | name: stack_trace 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.10.0-nullsafety.1" 124 | stream_channel: 125 | dependency: transitive 126 | description: 127 | name: stream_channel 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "2.1.0-nullsafety.1" 131 | string_scanner: 132 | dependency: transitive 133 | description: 134 | name: string_scanner 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.1.0-nullsafety.1" 138 | term_glyph: 139 | dependency: transitive 140 | description: 141 | name: term_glyph 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.2.0-nullsafety.1" 145 | test_api: 146 | dependency: transitive 147 | description: 148 | name: test_api 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "0.2.19-nullsafety.2" 152 | tinycolor: 153 | dependency: "direct main" 154 | description: 155 | name: tinycolor 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.0.2" 159 | typed_data: 160 | dependency: transitive 161 | description: 162 | name: typed_data 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.3.0-nullsafety.3" 166 | vector_math: 167 | dependency: transitive 168 | description: 169 | name: vector_math 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.1.0-nullsafety.3" 173 | sdks: 174 | dart: ">=2.10.0-110 <2.11.0" 175 | flutter: ">=0.2.5 <2.0.0" 176 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rolling_nav_bar 2 | description: A Flutter nav bar with a rolling active indicator behind each icon 3 | version: 0.0.4 4 | homepage: https://github.com/craiglabenz/flutter_rolling_nav_bar 5 | 6 | environment: 7 | sdk: ">=2.8.0 <3.0.0" 8 | 9 | dependencies: 10 | badges: ^1.1.0 11 | polygon_clipper: ^1.0.2 12 | tinycolor: ^1.0.2 13 | flutter: 14 | sdk: flutter 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | flutter: 21 | -------------------------------------------------------------------------------- /test/clicks_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | import './stateful_test_widget.dart'; 5 | 6 | void main() { 7 | Widget _rollingNavBarApp([Function(int) onTap]) { 8 | return MaterialApp( 9 | home: StatefulTestWidget(onTap), 10 | ); 11 | } 12 | 13 | group('RollingNavBar renders correctly', () { 14 | testWidgets( 15 | 'with on an ontap that doesn\'t call setState', 16 | (WidgetTester tester) async { 17 | final app = _rollingNavBarApp(); 18 | await tester.pumpWidget(app); 19 | await tester.tap(find.byKey(Key('nav-bar-child-2'))); 20 | await tester.pump(); 21 | // Not just that the onTap callback was fired, 22 | // but that the new stuff renders. 23 | expect(find.text('Active Index: 2'), findsOneWidget); 24 | }, 25 | ); 26 | 27 | testWidgets( 28 | 'with calls onTap when tapped index is already active', 29 | (WidgetTester tester) async { 30 | bool callbackFired = false; 31 | final app = _rollingNavBarApp((_) => callbackFired = true); 32 | await tester.pumpWidget(app); 33 | await tester.tap(find.byKey(Key('nav-bar-child-0'))); 34 | await tester.pump(); 35 | // Not just that the onTap callback was fired, 36 | // but that the new stuff renders. 37 | expect(callbackFired, true); 38 | }, 39 | ); 40 | 41 | testWidgets( 42 | 'with on separate action that forces a new index', 43 | (WidgetTester tester) async { 44 | final app = _rollingNavBarApp(); 45 | await tester.pumpWidget(app); 46 | // Taps on the FAB increment the index 47 | await tester.tap(find.byKey(Key('FAB'))); 48 | await tester.pump(); 49 | // Not just that the onTap callback was fired, 50 | // but that the new stuff renders. 51 | expect(find.text('Active Index: 1'), findsOneWidget); 52 | }, 53 | ); 54 | }); 55 | } 56 | -------------------------------------------------------------------------------- /test/rolling_nav_bar_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | import 'package:rolling_nav_bar/rolling_nav_bar.dart'; 5 | 6 | void main() { 7 | // Helper function to remove lots of meaningless lines of code from 8 | // appearing and test after test below 9 | Widget _materialApp( 10 | RollingNavBar navBar, { 11 | double height: 100, 12 | double width: 400, 13 | }) { 14 | return MaterialApp( 15 | home: Scaffold( 16 | bottomNavigationBar: Container( 17 | child: navBar, 18 | height: height, 19 | width: width, 20 | ), 21 | ), 22 | ); 23 | } 24 | 25 | group('RollingNavBar builds correctly', () { 26 | testWidgets('with simplest iconData parameters', 27 | (WidgetTester tester) async { 28 | await tester.pumpWidget( 29 | _materialApp( 30 | RollingNavBar.iconData( 31 | iconData: [Icons.home, Icons.person, Icons.settings], 32 | ), 33 | ), 34 | ); 35 | expect(find.byIcon(Icons.home), findsOneWidget); 36 | expect(find.byIcon(Icons.person), findsOneWidget); 37 | expect(find.byIcon(Icons.settings), findsOneWidget); 38 | }); 39 | 40 | testWidgets('with simplest builder parameters', 41 | (WidgetTester tester) async { 42 | final textWidgets = [ 43 | Text('Home'), 44 | Text('Friends'), 45 | Text('Settings') 46 | ]; 47 | await tester.pumpWidget( 48 | _materialApp( 49 | RollingNavBar.builder( 50 | builder: (BuildContext context, int index, AnimationInfo info, 51 | AnimationUpdate update) { 52 | return textWidgets[index]; 53 | }, 54 | numChildren: 3, 55 | ), 56 | ), 57 | ); 58 | expect(find.text('Home'), findsOneWidget); 59 | expect(find.text('Friends'), findsOneWidget); 60 | expect(find.text('Settings'), findsOneWidget); 61 | }); 62 | 63 | testWidgets('with builder onTap', (WidgetTester tester) async { 64 | int tapped; 65 | await tester.pumpWidget( 66 | _materialApp( 67 | RollingNavBar.builder( 68 | builder: (BuildContext context, int index, AnimationInfo info, 69 | AnimationUpdate update) { 70 | return Text(index.toString(), key: Key('key-$index')); 71 | }, 72 | numChildren: 3, 73 | onTap: (int index) { 74 | tapped = index; 75 | }, 76 | ), 77 | ), 78 | ); 79 | await tester.tap(find.byKey(Key('key-1'))); 80 | expect(tapped, 1); 81 | }); 82 | 83 | testWidgets('with iconData onTap', (WidgetTester tester) async { 84 | int tapped; 85 | await tester.pumpWidget( 86 | _materialApp( 87 | RollingNavBar.iconData( 88 | iconData: [ 89 | Icons.home, 90 | Icons.person, 91 | Icons.settings, 92 | ], 93 | onTap: (int index) { 94 | tapped = index; 95 | }, 96 | ), 97 | ), 98 | ); 99 | await tester.tap(find.byKey(Key('nav-bar-child-2'))); 100 | expect(tapped, 2); 101 | }); 102 | 103 | testWidgets('with iconData and text', (WidgetTester tester) async { 104 | await tester.pumpWidget( 105 | _materialApp( 106 | RollingNavBar.iconData( 107 | iconData: [Icons.home, Icons.person, Icons.settings], 108 | iconText: [Text('Home'), Text('Friends'), Text('Settings')], 109 | ), 110 | ), 111 | ); 112 | expect(find.byIcon(Icons.home), findsOneWidget); 113 | expect(find.byIcon(Icons.person), findsOneWidget); 114 | expect(find.byIcon(Icons.settings), findsOneWidget); 115 | // Finds nothing because is starting active widget 116 | expect(find.text('Home'), findsNothing); 117 | // Inactive tabs render their iconText 118 | expect(find.text('Friends'), findsOneWidget); 119 | expect(find.text('Settings'), findsOneWidget); 120 | }); 121 | testWidgets('with iconData and text and specified starting active index', 122 | (WidgetTester tester) async { 123 | await tester.pumpWidget( 124 | _materialApp( 125 | RollingNavBar.iconData( 126 | activeIndex: 1, 127 | iconData: [Icons.home, Icons.person, Icons.settings], 128 | iconText: [Text('Home'), Text('Friends'), Text('Settings')], 129 | ), 130 | ), 131 | ); 132 | // Inactive tabs render their iconText 133 | expect(find.text('Home'), findsOneWidget); 134 | // Finds nothing because is starting active widget 135 | expect(find.text('Friends'), findsNothing); 136 | expect(find.text('Settings'), findsOneWidget); 137 | }); 138 | testWidgets('with a custom active indicator color', 139 | (WidgetTester tester) async { 140 | await tester.pumpWidget( 141 | _materialApp( 142 | RollingNavBar.iconData( 143 | activeIndex: 1, 144 | iconData: [Icons.home, Icons.person, Icons.settings], 145 | iconText: [Text('Home'), Text('Friends'), Text('Settings')], 146 | indicatorColors: [Colors.orange], 147 | ), 148 | ), 149 | ); 150 | // Inactive tabs render their iconText 151 | Finder activeIndicator = find.byType(ActiveIndicator); 152 | expect(activeIndicator, findsOneWidget); 153 | 154 | final activeIndicatorWidget = 155 | tester.firstWidget(activeIndicator) as ActiveIndicator; 156 | expect(activeIndicatorWidget.color, Colors.orange); 157 | }); 158 | }); 159 | } 160 | -------------------------------------------------------------------------------- /test/stateful_test_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:rolling_nav_bar/rolling_nav_bar.dart'; 4 | 5 | class StatefulTestWidget extends StatefulWidget { 6 | final Function(int) onTap; 7 | StatefulTestWidget([this.onTap]); 8 | 9 | @override 10 | _StatefulTestWidget createState() => _StatefulTestWidget(); 11 | } 12 | 13 | class _StatefulTestWidget extends State { 14 | int activeIndex = 0; 15 | 16 | _onTap(int index) { 17 | setState(() { 18 | activeIndex = index; 19 | }); 20 | } 21 | 22 | _forceNewIndex(int index) { 23 | setState(() { 24 | activeIndex = index; 25 | }); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | body: Text('Active Index: $activeIndex', key: Key('activeIndexLabel')), 32 | bottomNavigationBar: Container( 33 | child: RollingNavBar.iconData( 34 | activeIndex: activeIndex, 35 | iconData: [Icons.home, Icons.person, Icons.settings], 36 | iconText: [Text('Home'), Text('Friends'), Text('Settings')], 37 | indicatorColors: [Colors.orange], 38 | onTap: (int index) { 39 | _onTap(index); 40 | if (widget.onTap != null) { 41 | widget.onTap(index); 42 | } 43 | }, 44 | ), 45 | height: 100, 46 | width: 400, 47 | ), 48 | floatingActionButton: FloatingActionButton( 49 | child: Icon(Icons.add), 50 | key: Key('FAB'), 51 | onPressed: () { 52 | _forceNewIndex(activeIndex + 1); 53 | setState(() {}); 54 | }, 55 | ), 56 | ); 57 | } 58 | } 59 | --------------------------------------------------------------------------------