├── .github └── workflows │ └── test.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── 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 │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── 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 ├── images └── future_button.gif ├── lib ├── future_button.dart └── src │ ├── buttons │ ├── cupertino │ │ └── future_cupertino_button.dart │ └── material │ │ ├── future_flat_button.dart │ │ ├── future_icon_button.dart │ │ ├── future_outline_button.dart │ │ └── future_raised_button.dart │ └── generic_future_button.dart ├── pubspec.lock ├── pubspec.yaml └── test └── future_button_test.dart /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | pull_request: 5 | branches: [ master ] 6 | push: 7 | branches: [ master ] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Install Flutter 16 | uses: subosito/flutter-action@v1.3.2 17 | 18 | - name: Run Flutter tests 19 | run: | 20 | flutter analyze 21 | flutter test --coverage 22 | 23 | - name: Coveralls GitHub Action 24 | uses: coverallsapp/github-action@v1.1.2 25 | with: 26 | github-token: ${{ secrets.GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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: fba99f6cf9a14512e461e3122c8ddfaa25394e89 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.1.2] - 04.10.2020 2 | 3 | * Fix missing icons from Flutter v1.22.0 4 | 5 | ## [0.1.1] - 04.10.2020 6 | 7 | * Update `README.md` 8 | 9 | ## [0.1.0] - 04.10.2020 10 | 11 | * Support for showing the result of the action after the Future is completed 12 | 13 | ## [0.0.2] - 04.10.2020 14 | 15 | * Support for exceptions thrown in `onPressed` callback 16 | * Documentation improvements 17 | 18 | ## [0.0.1] - 01.10.2020 19 | 20 | * Initial release 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Erzhan (kekland) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # future_button 2 | [![Coverage Status](https://coveralls.io/repos/github/kekland/future_button/badge.svg?branch=master)](https://coveralls.io/github/kekland/future_button?branch=master) 3 | ![Build status](https://img.shields.io/github/workflow/status/kekland/future_button/Test) 4 | ![Pub version](https://img.shields.io/pub/v/future_button) 5 | 6 | Customizable Material and Cupertino buttons with progress indicators and more. 7 | 8 | Useful if you want to run some background tasks when user presses on the button, and then show the result of the task. 9 | 10 | ![Demonstration](https://github.com/kekland/future_button/blob/master/images/future_button.gif) 11 | 12 | ## How to use it 13 | 14 | Usage is extremely simple - right now 5 types of buttons are supported: 15 | 16 | - `CupertinoButton` (normal + filled) 17 | - `FlatButton` (normal + icon) 18 | - `IconButton` 19 | - `OutlineButton` (normal + icon) 20 | - `RaisedButton` (normal + icon) 21 | 22 | To convert a button to a `FutureButton`, just add a `Future` prefix and make sure that your `onPressed` callback is of type `Future Function()`, instead of usual `void Function()`. 23 | 24 | Everything that the package does can be customized. Below is the list of all parameters: 25 | 26 | ```dart 27 | /// The widget that's used as the progress indicator. 28 | /// You can substitute it with your own progress indicator if necessary. 29 | /// See [defaultMaterialProgressIndicatorBuilder] and[defaultCupertinoProgressIndicatorBuilder] for more info. 30 | final WidgetBuilder progressIndicatorBuilder; 31 | 32 | /// The location of progress indicator. 33 | /// See [ProgressIndicatorLocation] for more info. 34 | final ProgressIndicatorLocation progressIndicatorLocation; 35 | 36 | /// Whether to show the result of the Future. 37 | /// Will show [successIndicatorBuilder] if Future completes without errors. 38 | /// Otherwise, will show [failureIndicatorBuilder]. 39 | final bool showResult; 40 | 41 | /// Whether to animate the transitions using [AnimatedSwitcher]. 42 | /// Defaults to [true]. 43 | final bool animateTransitions; 44 | 45 | /// Indicator to show when the Future is completed successfully. 46 | /// Defaults to [defaultSuccessResultIndicatorBuilder]. 47 | final WidgetBuilder successIndicatorBuilder; 48 | 49 | /// Indicator to show when the Future fails. 50 | /// Defaults to [defaultFailureResultIndicatorBuilder]. 51 | final WidgetBuilder failureIndicatorBuilder; 52 | 53 | /// For how long should the result be shown for. 54 | /// Default to `Duration(seconds: 2)`. 55 | final Duration resultIndicatorDuration; 56 | 57 | /// Curve that's used to animate the button size. 58 | /// Defaults to [Curves.easeInOut]. 59 | final Curve animationCurve; 60 | 61 | /// Duration that's used to animate the button size. 62 | /// Defaults to `Duration(milliseconds: 150)`. 63 | final Duration animationDuration; 64 | ``` 65 | 66 | ## Example 67 | 68 | ```dart 69 | FutureRaisedButton.icon( 70 | icon: Icon(Icons.star), 71 | label: Text('Star'), 72 | onPressed: () async { 73 | // Do some background task 74 | await Future.delayed(Duration(seconds: 5)); 75 | }, 76 | ); 77 | ``` 78 | 79 | See `example` project for more details. 80 | 81 | ## Getting Started 82 | 83 | ### Depend on it 84 | 85 | Add this to your package's pubspec.yaml file: 86 | 87 | ``` 88 | dependencies: 89 | future_button: ^0.1.1 90 | ``` 91 | 92 | ### Install it 93 | 94 | You can install packages from the command line: 95 | 96 | ```bash 97 | $ flutter pub get 98 | ``` 99 | 100 | ### Import it 101 | 102 | Now in your Dart code, you can use: 103 | 104 | ```dart 105 | import 'package:future_button/future_button.dart'; 106 | ``` 107 | 108 | ## Contact me 109 | 110 | **E-mail**: `kk.erzhan@gmail.com` -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:pedantic/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /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 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 45 | -------------------------------------------------------------------------------- /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: fba99f6cf9a14512e461e3122c8ddfaa25394e89 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 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /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 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /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 localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /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 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | FRAMEWORK_SEARCH_PATHS = ( 293 | "$(inherited)", 294 | "$(PROJECT_DIR)/Flutter", 295 | ); 296 | INFOPLIST_FILE = Runner/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | LIBRARY_SEARCH_PATHS = ( 299 | "$(inherited)", 300 | "$(PROJECT_DIR)/Flutter", 301 | ); 302 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 305 | SWIFT_VERSION = 5.0; 306 | VERSIONING_SYSTEM = "apple-generic"; 307 | }; 308 | name = Profile; 309 | }; 310 | 97C147031CF9000F007C117D /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_NONNULL = YES; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_COMMA = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_EMPTY_BODY = YES; 326 | CLANG_WARN_ENUM_CONVERSION = YES; 327 | CLANG_WARN_INFINITE_RECURSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 334 | CLANG_WARN_STRICT_PROTOTYPES = YES; 335 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 339 | COPY_PHASE_STRIP = NO; 340 | DEBUG_INFORMATION_FORMAT = dwarf; 341 | ENABLE_STRICT_OBJC_MSGSEND = YES; 342 | ENABLE_TESTABILITY = YES; 343 | GCC_C_LANGUAGE_STANDARD = gnu99; 344 | GCC_DYNAMIC_NO_PIC = NO; 345 | GCC_NO_COMMON_BLOCKS = YES; 346 | GCC_OPTIMIZATION_LEVEL = 0; 347 | GCC_PREPROCESSOR_DEFINITIONS = ( 348 | "DEBUG=1", 349 | "$(inherited)", 350 | ); 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 358 | MTL_ENABLE_DEBUG_INFO = YES; 359 | ONLY_ACTIVE_ARCH = YES; 360 | SDKROOT = iphoneos; 361 | TARGETED_DEVICE_FAMILY = "1,2"; 362 | }; 363 | name = Debug; 364 | }; 365 | 97C147041CF9000F007C117D /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ALWAYS_SEARCH_USER_PATHS = NO; 369 | CLANG_ANALYZER_NONNULL = YES; 370 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 371 | CLANG_CXX_LIBRARY = "libc++"; 372 | CLANG_ENABLE_MODULES = YES; 373 | CLANG_ENABLE_OBJC_ARC = YES; 374 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 375 | CLANG_WARN_BOOL_CONVERSION = YES; 376 | CLANG_WARN_COMMA = YES; 377 | CLANG_WARN_CONSTANT_CONVERSION = YES; 378 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 379 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 380 | CLANG_WARN_EMPTY_BODY = YES; 381 | CLANG_WARN_ENUM_CONVERSION = YES; 382 | CLANG_WARN_INFINITE_RECURSION = YES; 383 | CLANG_WARN_INT_CONVERSION = YES; 384 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 385 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 386 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 389 | CLANG_WARN_STRICT_PROTOTYPES = YES; 390 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 396 | ENABLE_NS_ASSERTIONS = NO; 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_NO_COMMON_BLOCKS = YES; 400 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 401 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 402 | GCC_WARN_UNDECLARED_SELECTOR = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 404 | GCC_WARN_UNUSED_FUNCTION = YES; 405 | GCC_WARN_UNUSED_VARIABLE = YES; 406 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 407 | MTL_ENABLE_DEBUG_INFO = NO; 408 | SDKROOT = iphoneos; 409 | SUPPORTED_PLATFORMS = iphoneos; 410 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 411 | TARGETED_DEVICE_FAMILY = "1,2"; 412 | VALIDATE_PRODUCT = YES; 413 | }; 414 | name = Release; 415 | }; 416 | 97C147061CF9000F007C117D /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | CLANG_ENABLE_MODULES = YES; 422 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 423 | ENABLE_BITCODE = NO; 424 | FRAMEWORK_SEARCH_PATHS = ( 425 | "$(inherited)", 426 | "$(PROJECT_DIR)/Flutter", 427 | ); 428 | INFOPLIST_FILE = Runner/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 430 | LIBRARY_SEARCH_PATHS = ( 431 | "$(inherited)", 432 | "$(PROJECT_DIR)/Flutter", 433 | ); 434 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 435 | PRODUCT_NAME = "$(TARGET_NAME)"; 436 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 437 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 438 | SWIFT_VERSION = 5.0; 439 | VERSIONING_SYSTEM = "apple-generic"; 440 | }; 441 | name = Debug; 442 | }; 443 | 97C147071CF9000F007C117D /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | CLANG_ENABLE_MODULES = YES; 449 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 450 | ENABLE_BITCODE = NO; 451 | FRAMEWORK_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | INFOPLIST_FILE = Runner/Info.plist; 456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 457 | LIBRARY_SEARCH_PATHS = ( 458 | "$(inherited)", 459 | "$(PROJECT_DIR)/Flutter", 460 | ); 461 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 464 | SWIFT_VERSION = 5.0; 465 | VERSIONING_SYSTEM = "apple-generic"; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | 97C147031CF9000F007C117D /* Debug */, 476 | 97C147041CF9000F007C117D /* Release */, 477 | 249021D3217E4FDB00AE95B9 /* Profile */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 97C147061CF9000F007C117D /* Debug */, 486 | 97C147071CF9000F007C117D /* Release */, 487 | 249021D4217E4FDB00AE95B9 /* Profile */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 495 | } 496 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/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" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:future_button/future_button.dart'; 4 | 5 | void main() { 6 | runApp(MyApp()); 7 | } 8 | 9 | class MyApp extends StatelessWidget { 10 | // This widget is the root of your application. 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'Flutter Demo', 15 | theme: ThemeData( 16 | primarySwatch: Colors.blue, 17 | visualDensity: VisualDensity.adaptivePlatformDensity, 18 | ), 19 | home: MyHomePage(title: 'Future Button'), 20 | ); 21 | } 22 | } 23 | 24 | class MyHomePage extends StatefulWidget { 25 | final String title; 26 | 27 | MyHomePage({ 28 | Key key, 29 | this.title, 30 | }) : super(key: key); 31 | 32 | @override 33 | _MyHomePageState createState() => _MyHomePageState(); 34 | } 35 | 36 | class _MyHomePageState extends State { 37 | Future waitFor([int seconds = 2]) { 38 | return Future.delayed(Duration(seconds: seconds)); 39 | } 40 | 41 | Future waitForAndFail([int seconds = 2]) async { 42 | await Future.delayed(Duration(seconds: seconds)); 43 | throw Exception(); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | return Scaffold( 49 | appBar: AppBar( 50 | title: Text(widget.title), 51 | ), 52 | body: Center( 53 | child: Column( 54 | mainAxisAlignment: MainAxisAlignment.center, 55 | children: [ 56 | FutureRaisedButton( 57 | child: Text('Load'), 58 | onPressed: waitFor, 59 | showResult: true, 60 | ), 61 | FutureRaisedButton( 62 | child: Text('Load (right)'), 63 | onPressed: waitForAndFail, 64 | progressIndicatorLocation: ProgressIndicatorLocation.right, 65 | showResult: true, 66 | ), 67 | FutureRaisedButton.icon( 68 | icon: Icon(Icons.star), 69 | label: Text('Star'), 70 | onPressed: waitFor, 71 | showResult: false, 72 | ), 73 | FutureIconButton( 74 | icon: Icon(Icons.link), 75 | onPressed: waitFor, 76 | showResult: true, 77 | ), 78 | FutureCupertinoButton( 79 | child: Text('Like'), 80 | onPressed: waitFor, 81 | showResult: true, 82 | ), 83 | FutureCupertinoButton.filled( 84 | child: Text('Like'), 85 | onPressed: waitForAndFail, 86 | showResult: true, 87 | ), 88 | ], 89 | ), 90 | ), 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /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 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0-nullsafety.1" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0-nullsafety.3" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0-nullsafety.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0-nullsafety.1" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0-nullsafety.3" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.1.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 | future_button: 71 | dependency: "direct main" 72 | description: 73 | path: ".." 74 | relative: true 75 | source: path 76 | version: "0.1.2" 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 | sky_engine: 99 | dependency: transitive 100 | description: flutter 101 | source: sdk 102 | version: "0.0.99" 103 | source_span: 104 | dependency: transitive 105 | description: 106 | name: source_span 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.8.0-nullsafety.2" 110 | stack_trace: 111 | dependency: transitive 112 | description: 113 | name: stack_trace 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.10.0-nullsafety.1" 117 | stream_channel: 118 | dependency: transitive 119 | description: 120 | name: stream_channel 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "2.1.0-nullsafety.1" 124 | string_scanner: 125 | dependency: transitive 126 | description: 127 | name: string_scanner 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.1.0-nullsafety.1" 131 | term_glyph: 132 | dependency: transitive 133 | description: 134 | name: term_glyph 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.2.0-nullsafety.1" 138 | test_api: 139 | dependency: transitive 140 | description: 141 | name: test_api 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "0.2.19-nullsafety.2" 145 | typed_data: 146 | dependency: transitive 147 | description: 148 | name: typed_data 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.3.0-nullsafety.3" 152 | vector_math: 153 | dependency: transitive 154 | description: 155 | name: vector_math 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "2.1.0-nullsafety.3" 159 | sdks: 160 | dart: ">=2.10.0-110 <2.11.0" 161 | flutter: ">=1.17.0 <2.0.0" 162 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.7.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^0.1.3 31 | future_button: 32 | path: .. 33 | 34 | dev_dependencies: 35 | flutter_test: 36 | sdk: flutter 37 | 38 | # For information on the generic Dart part of this file, see the 39 | # following page: https://dart.dev/tools/pub/pubspec 40 | 41 | # The following section is specific to Flutter. 42 | flutter: 43 | 44 | # The following line ensures that the Material Icons font is 45 | # included with your application, so that you can use the icons in 46 | # the material Icons class. 47 | uses-material-design: true 48 | 49 | # To add assets to your application, add an assets section, like this: 50 | # assets: 51 | # - images/a_dot_burr.jpeg 52 | # - images/a_dot_ham.jpeg 53 | 54 | # An image asset can refer to one or more resolution-specific "variants", see 55 | # https://flutter.dev/assets-and-images/#resolution-aware. 56 | 57 | # For details regarding adding assets from package dependencies, see 58 | # https://flutter.dev/assets-and-images/#from-packages 59 | 60 | # To add custom fonts to your application, add a fonts section here, 61 | # in this "flutter" section. Each entry in this list should have a 62 | # "family" key with the font family name, and a "fonts" key with a 63 | # list giving the asset and other descriptors for the font. For 64 | # example: 65 | # fonts: 66 | # - family: Schyler 67 | # fonts: 68 | # - asset: fonts/Schyler-Regular.ttf 69 | # - asset: fonts/Schyler-Italic.ttf 70 | # style: italic 71 | # - family: Trajan Pro 72 | # fonts: 73 | # - asset: fonts/TrajanPro.ttf 74 | # - asset: fonts/TrajanPro_Bold.ttf 75 | # weight: 700 76 | # 77 | # For details regarding fonts from package dependencies, 78 | # see https://flutter.dev/custom-fonts/#from-packages 79 | -------------------------------------------------------------------------------- /images/future_button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekland/future_button/86c1754fabe5ac37654ce00a2e087fb877dbd335/images/future_button.gif -------------------------------------------------------------------------------- /lib/future_button.dart: -------------------------------------------------------------------------------- 1 | library future_button; 2 | 3 | export './src/buttons/material/future_flat_button.dart'; 4 | export './src/buttons/material/future_icon_button.dart'; 5 | export './src/buttons/material/future_outline_button.dart'; 6 | export './src/buttons/material/future_raised_button.dart'; 7 | 8 | export './src/buttons/cupertino/future_cupertino_button.dart'; 9 | 10 | export './src/generic_future_button.dart'; 11 | -------------------------------------------------------------------------------- /lib/src/buttons/cupertino/future_cupertino_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:future_button/src/generic_future_button.dart'; 3 | 4 | /// A Future version of [CupertinoButton]. 5 | /// See [CupertinoButton] for parameter descriptions. 6 | class FutureCupertinoButton extends GenericFutureButtonWidget { 7 | final EdgeInsetsGeometry padding; 8 | final Color color; 9 | final Color disabledColor; 10 | final double minSize; 11 | final double pressedOpacity; 12 | final BorderRadius borderRadius; 13 | final bool filled; 14 | 15 | /// Default [FutureCupertinoButton] constructor. 16 | /// If you want to make it filled, see [FutureCupertinoButton.filled]. 17 | /// See [CupertinoButton] for more info. 18 | FutureCupertinoButton({ 19 | Key key, 20 | @required FutureCallback onPressed, 21 | @required Widget child, 22 | Curve animationCurve, 23 | Duration animationDuration, 24 | bool showResult = false, 25 | bool animateTransitions = true, 26 | WidgetBuilder progressIndicatorBuilder, 27 | WidgetBuilder successIndicatorBuilder, 28 | WidgetBuilder failureIndicatorBuilder, 29 | Duration resultIndicatorDuration, 30 | ProgressIndicatorLocation progressIndicatorLocation, 31 | this.padding, 32 | this.color, 33 | this.minSize, 34 | this.disabledColor = CupertinoColors.quaternarySystemFill, 35 | this.pressedOpacity = 0.4, 36 | this.borderRadius = const BorderRadius.all(Radius.circular(8.0)), 37 | }) : filled = false, 38 | super( 39 | key: key, 40 | child: child, 41 | onPressed: onPressed, 42 | animationCurve: animationCurve, 43 | animationDuration: animationDuration, 44 | showResult: showResult, 45 | animateTransitions: animateTransitions, 46 | progressIndicatorBuilder: progressIndicatorBuilder ?? 47 | defaultCupertinoProgressIndicatorBuilder, 48 | successIndicatorBuilder: successIndicatorBuilder, 49 | failureIndicatorBuilder: failureIndicatorBuilder, 50 | resultIndicatorDuration: resultIndicatorDuration, 51 | progressIndicatorLocation: progressIndicatorLocation, 52 | ); 53 | 54 | /// A filled [FutureCupertinoButton]. 55 | /// See [CupertinoButton.filled] for more info. 56 | FutureCupertinoButton.filled({ 57 | Key key, 58 | @required FutureCallback onPressed, 59 | @required Widget child, 60 | Curve animationCurve, 61 | Duration animationDuration, 62 | bool showResult = false, 63 | bool animateTransitions = true, 64 | WidgetBuilder progressIndicatorBuilder, 65 | WidgetBuilder successIndicatorBuilder, 66 | WidgetBuilder failureIndicatorBuilder, 67 | Duration resultIndicatorDuration, 68 | ProgressIndicatorLocation progressIndicatorLocation, 69 | this.padding, 70 | this.minSize, 71 | this.disabledColor = CupertinoColors.quaternarySystemFill, 72 | this.pressedOpacity = 0.4, 73 | this.borderRadius = const BorderRadius.all(Radius.circular(8.0)), 74 | }) : filled = true, 75 | color = null, 76 | super( 77 | key: key, 78 | child: child, 79 | onPressed: onPressed, 80 | animationCurve: animationCurve, 81 | animationDuration: animationDuration, 82 | showResult: showResult, 83 | animateTransitions: animateTransitions, 84 | progressIndicatorBuilder: progressIndicatorBuilder ?? 85 | defaultCupertinoProgressIndicatorBuilder, 86 | successIndicatorBuilder: successIndicatorBuilder, 87 | failureIndicatorBuilder: failureIndicatorBuilder, 88 | resultIndicatorDuration: resultIndicatorDuration, 89 | progressIndicatorLocation: progressIndicatorLocation, 90 | ); 91 | 92 | @override 93 | _FutureCupertinoButtonState createState() => _FutureCupertinoButtonState(); 94 | } 95 | 96 | class _FutureCupertinoButtonState 97 | extends GenericFutureButtonState { 98 | @override 99 | Widget buildButton({ 100 | BuildContext context, 101 | Widget child, 102 | VoidCallback onPressed, 103 | }) { 104 | if (widget.filled) { 105 | return CupertinoButton.filled( 106 | child: child, 107 | onPressed: isEnabled ? onPressed : null, 108 | padding: widget.padding, 109 | minSize: widget.minSize, 110 | disabledColor: widget.disabledColor, 111 | pressedOpacity: widget.pressedOpacity, 112 | borderRadius: widget.borderRadius, 113 | ); 114 | } 115 | 116 | return CupertinoButton( 117 | child: child, 118 | onPressed: isEnabled ? onPressed : null, 119 | padding: widget.padding, 120 | color: widget.color, 121 | minSize: widget.minSize, 122 | disabledColor: widget.disabledColor, 123 | pressedOpacity: widget.pressedOpacity, 124 | borderRadius: widget.borderRadius, 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /lib/src/buttons/material/future_flat_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/rendering.dart'; 3 | import 'package:future_button/src/generic_future_button.dart'; 4 | 5 | /// A Future version of the material [FlatButton]. 6 | /// See [FlatButton] for parameter descriptions. 7 | class FutureFlatButton extends GenericFutureButtonWidget { 8 | final Widget icon; 9 | final VoidCallback onLongPress; 10 | final ValueChanged onHighlightChanged; 11 | final MouseCursor mouseCursor; 12 | final ButtonTextTheme textTheme; 13 | final Color textColor; 14 | final Color disabledTextColor; 15 | final Color color; 16 | final Color disabledColor; 17 | final Color focusColor; 18 | final Color hoverColor; 19 | final Color highlightColor; 20 | final Color splashColor; 21 | final Brightness colorBrightness; 22 | final EdgeInsetsGeometry padding; 23 | final VisualDensity visualDensity; 24 | final ShapeBorder shape; 25 | final Clip clipBehavior; 26 | final FocusNode focusNode; 27 | final bool autofocus; 28 | final MaterialTapTargetSize materialTapTargetSize; 29 | 30 | /// Default [FutureFlatButton] constructor. 31 | /// If you want to add an icon, see [FutureFlatButton.icon]. 32 | /// See [FlatButton] for more info. 33 | FutureFlatButton({ 34 | Key key, 35 | @required FutureCallback onPressed, 36 | @required Widget child, 37 | Curve animationCurve, 38 | Duration animationDuration, 39 | bool showResult = false, 40 | bool animateTransitions = true, 41 | WidgetBuilder progressIndicatorBuilder, 42 | WidgetBuilder successIndicatorBuilder, 43 | WidgetBuilder failureIndicatorBuilder, 44 | Duration resultIndicatorDuration, 45 | ProgressIndicatorLocation progressIndicatorLocation, 46 | this.onLongPress, 47 | this.onHighlightChanged, 48 | this.mouseCursor, 49 | this.textTheme, 50 | this.textColor, 51 | this.disabledTextColor, 52 | this.color, 53 | this.disabledColor, 54 | this.focusColor, 55 | this.hoverColor, 56 | this.highlightColor, 57 | this.splashColor, 58 | this.colorBrightness, 59 | this.padding, 60 | this.visualDensity, 61 | this.shape, 62 | this.clipBehavior = Clip.none, 63 | this.focusNode, 64 | this.autofocus = false, 65 | this.materialTapTargetSize, 66 | }) : icon = null, 67 | super( 68 | key: key, 69 | child: child, 70 | onPressed: onPressed, 71 | animationCurve: animationCurve, 72 | animationDuration: animationDuration, 73 | showResult: showResult, 74 | animateTransitions: animateTransitions, 75 | progressIndicatorBuilder: progressIndicatorBuilder, 76 | successIndicatorBuilder: successIndicatorBuilder, 77 | failureIndicatorBuilder: failureIndicatorBuilder, 78 | resultIndicatorDuration: resultIndicatorDuration, 79 | progressIndicatorLocation: progressIndicatorLocation, 80 | ); 81 | 82 | /// A [FutureFlatButton] with an icon. 83 | /// See [FlatButton.icon] for more info. 84 | FutureFlatButton.icon({ 85 | Key key, 86 | @required FutureCallback onPressed, 87 | @required Widget label, 88 | @required this.icon, 89 | Curve animationCurve, 90 | Duration animationDuration, 91 | bool showResult = false, 92 | bool animateTransitions = true, 93 | WidgetBuilder progressIndicatorBuilder, 94 | WidgetBuilder successIndicatorBuilder, 95 | WidgetBuilder failureIndicatorBuilder, 96 | Duration resultIndicatorDuration, 97 | ProgressIndicatorLocation progressIndicatorLocation, 98 | this.onLongPress, 99 | this.onHighlightChanged, 100 | this.mouseCursor, 101 | this.textTheme, 102 | this.textColor, 103 | this.disabledTextColor, 104 | this.color, 105 | this.disabledColor, 106 | this.focusColor, 107 | this.hoverColor, 108 | this.highlightColor, 109 | this.splashColor, 110 | this.colorBrightness, 111 | this.padding, 112 | this.visualDensity, 113 | this.shape, 114 | this.clipBehavior = Clip.none, 115 | this.focusNode, 116 | this.autofocus = false, 117 | this.materialTapTargetSize, 118 | }) : super( 119 | key: key, 120 | child: label, 121 | onPressed: onPressed, 122 | animationCurve: animationCurve, 123 | animationDuration: animationDuration, 124 | showResult: showResult, 125 | animateTransitions: animateTransitions, 126 | progressIndicatorBuilder: progressIndicatorBuilder, 127 | successIndicatorBuilder: successIndicatorBuilder, 128 | failureIndicatorBuilder: failureIndicatorBuilder, 129 | resultIndicatorDuration: resultIndicatorDuration, 130 | progressIndicatorLocation: progressIndicatorLocation, 131 | ); 132 | 133 | @override 134 | _FutureFlatButtonState createState() => _FutureFlatButtonState(); 135 | } 136 | 137 | class _FutureFlatButtonState 138 | extends GenericFutureButtonState { 139 | @override 140 | Widget buildButton({ 141 | BuildContext context, 142 | Widget child, 143 | VoidCallback onPressed, 144 | }) { 145 | if (widget.icon != null) { 146 | return FlatButton.icon( 147 | icon: widget.icon, 148 | label: child, 149 | onPressed: isEnabled ? onPressed : null, 150 | onLongPress: widget.onLongPress, 151 | onHighlightChanged: widget.onHighlightChanged, 152 | mouseCursor: widget.mouseCursor, 153 | textTheme: widget.textTheme, 154 | textColor: widget.textColor, 155 | disabledTextColor: widget.disabledTextColor, 156 | color: widget.color, 157 | disabledColor: widget.disabledColor, 158 | focusColor: widget.focusColor, 159 | hoverColor: widget.hoverColor, 160 | highlightColor: widget.highlightColor, 161 | splashColor: widget.splashColor, 162 | colorBrightness: widget.colorBrightness, 163 | padding: widget.padding, 164 | shape: widget.shape, 165 | focusNode: widget.focusNode, 166 | materialTapTargetSize: widget.materialTapTargetSize, 167 | autofocus: widget.autofocus, 168 | clipBehavior: widget.clipBehavior, 169 | ); 170 | } 171 | 172 | return FlatButton( 173 | child: child, 174 | onPressed: isEnabled ? onPressed : null, 175 | onLongPress: widget.onLongPress, 176 | onHighlightChanged: widget.onHighlightChanged, 177 | mouseCursor: widget.mouseCursor, 178 | textTheme: widget.textTheme, 179 | textColor: widget.textColor, 180 | disabledTextColor: widget.disabledTextColor, 181 | color: widget.color, 182 | disabledColor: widget.disabledColor, 183 | focusColor: widget.focusColor, 184 | hoverColor: widget.hoverColor, 185 | highlightColor: widget.highlightColor, 186 | splashColor: widget.splashColor, 187 | colorBrightness: widget.colorBrightness, 188 | padding: widget.padding, 189 | visualDensity: widget.visualDensity, 190 | shape: widget.shape, 191 | focusNode: widget.focusNode, 192 | materialTapTargetSize: widget.materialTapTargetSize, 193 | autofocus: widget.autofocus, 194 | clipBehavior: widget.clipBehavior, 195 | ); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /lib/src/buttons/material/future_icon_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/rendering.dart'; 3 | import 'package:future_button/src/generic_future_button.dart'; 4 | 5 | /// A Future version of the material [IconButton]. 6 | /// See [IconButton] for parameter descriptions. 7 | class FutureIconButton extends GenericFutureButtonWidget { 8 | final double iconSize; 9 | final VisualDensity visualDensity; 10 | final EdgeInsetsGeometry padding; 11 | final AlignmentGeometry alignment; 12 | final double splashRadius; 13 | final Color focusColor; 14 | final Color hoverColor; 15 | final Color color; 16 | final Color splashColor; 17 | final Color highlightColor; 18 | final Color disabledColor; 19 | final MouseCursor mouseCursor; 20 | final FocusNode focusNode; 21 | final bool autofocus; 22 | final String tooltip; 23 | final bool enableFeedback; 24 | final BoxConstraints constraints; 25 | 26 | /// Default [FutureIconButton] constructor. 27 | /// See [IconButton] for more info. 28 | FutureIconButton({ 29 | Key key, 30 | @required FutureCallback onPressed, 31 | @required Widget icon, 32 | Curve animationCurve, 33 | Duration animationDuration, 34 | bool showResult = false, 35 | bool animateTransitions = true, 36 | WidgetBuilder progressIndicatorBuilder, 37 | WidgetBuilder successIndicatorBuilder, 38 | WidgetBuilder failureIndicatorBuilder, 39 | Duration resultIndicatorDuration, 40 | this.iconSize = 24.0, 41 | this.visualDensity, 42 | this.padding = const EdgeInsets.all(8.0), 43 | this.alignment = Alignment.center, 44 | this.splashRadius, 45 | this.color, 46 | this.focusColor, 47 | this.hoverColor, 48 | this.highlightColor, 49 | this.splashColor, 50 | this.disabledColor, 51 | this.mouseCursor = SystemMouseCursors.click, 52 | this.focusNode, 53 | this.autofocus = false, 54 | this.tooltip, 55 | this.enableFeedback = true, 56 | this.constraints, 57 | }) : super( 58 | key: key, 59 | child: icon, 60 | onPressed: onPressed, 61 | animationCurve: animationCurve, 62 | animationDuration: animationDuration, 63 | showResult: showResult, 64 | animateTransitions: animateTransitions, 65 | progressIndicatorBuilder: progressIndicatorBuilder, 66 | successIndicatorBuilder: successIndicatorBuilder, 67 | failureIndicatorBuilder: failureIndicatorBuilder, 68 | resultIndicatorDuration: resultIndicatorDuration, 69 | progressIndicatorLocation: ProgressIndicatorLocation.center, 70 | ); 71 | 72 | @override 73 | _FutureIconButtonState createState() => _FutureIconButtonState(); 74 | } 75 | 76 | class _FutureIconButtonState 77 | extends GenericFutureButtonState { 78 | @override 79 | Widget buildButton({ 80 | BuildContext context, 81 | Widget child, 82 | VoidCallback onPressed, 83 | }) { 84 | return IconButton( 85 | icon: child, 86 | onPressed: isEnabled ? onPressed : null, 87 | iconSize: widget.iconSize, 88 | visualDensity: widget.visualDensity, 89 | padding: widget.padding, 90 | alignment: widget.alignment, 91 | splashRadius: widget.splashRadius, 92 | color: widget.color, 93 | focusColor: widget.focusColor, 94 | hoverColor: widget.hoverColor, 95 | highlightColor: widget.highlightColor, 96 | splashColor: widget.splashColor, 97 | disabledColor: widget.disabledColor, 98 | mouseCursor: widget.mouseCursor, 99 | focusNode: widget.focusNode, 100 | autofocus: widget.autofocus, 101 | tooltip: widget.tooltip, 102 | enableFeedback: widget.enableFeedback, 103 | constraints: widget.constraints, 104 | ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/src/buttons/material/future_outline_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/rendering.dart'; 3 | import 'package:future_button/src/generic_future_button.dart'; 4 | 5 | /// A Future version of the material [OutlineButton]. 6 | /// See [OutlineButton] for parameter descriptions. 7 | class FutureOutlineButton extends GenericFutureButtonWidget { 8 | final Widget icon; 9 | final VoidCallback onLongPress; 10 | final MouseCursor mouseCursor; 11 | final ButtonTextTheme textTheme; 12 | final Color textColor; 13 | final Color disabledTextColor; 14 | final Color color; 15 | final Color focusColor; 16 | final Color hoverColor; 17 | final Color highlightColor; 18 | final Color splashColor; 19 | final double highlightElevation; 20 | final BorderSide borderSide; 21 | final Color disabledBorderColor; 22 | final Color highlightedBorderColor; 23 | final EdgeInsetsGeometry padding; 24 | final VisualDensity visualDensity; 25 | final ShapeBorder shape; 26 | final Clip clipBehavior; 27 | final FocusNode focusNode; 28 | final bool autofocus; 29 | 30 | /// Default [FutureOutlineButton] constructor. 31 | /// If you want to add an icon, see [FutureOutlineButton.icon]. 32 | /// See [OutlineButton] for more info. 33 | FutureOutlineButton({ 34 | Key key, 35 | @required FutureCallback onPressed, 36 | @required Widget child, 37 | Curve animationCurve, 38 | Duration animationDuration, 39 | bool showResult = false, 40 | bool animateTransitions = true, 41 | WidgetBuilder progressIndicatorBuilder, 42 | WidgetBuilder successIndicatorBuilder, 43 | WidgetBuilder failureIndicatorBuilder, 44 | Duration resultIndicatorDuration, 45 | ProgressIndicatorLocation progressIndicatorLocation, 46 | this.onLongPress, 47 | this.mouseCursor, 48 | this.textTheme, 49 | this.textColor, 50 | this.disabledTextColor, 51 | this.color, 52 | this.focusColor, 53 | this.hoverColor, 54 | this.highlightColor, 55 | this.splashColor, 56 | this.highlightElevation, 57 | this.borderSide, 58 | this.disabledBorderColor, 59 | this.highlightedBorderColor, 60 | this.padding, 61 | this.visualDensity, 62 | this.shape, 63 | this.focusNode, 64 | this.clipBehavior = Clip.none, 65 | this.autofocus = false, 66 | }) : icon = null, 67 | super( 68 | key: key, 69 | child: child, 70 | onPressed: onPressed, 71 | animationCurve: animationCurve, 72 | animationDuration: animationDuration, 73 | showResult: showResult, 74 | animateTransitions: animateTransitions, 75 | progressIndicatorBuilder: progressIndicatorBuilder, 76 | successIndicatorBuilder: successIndicatorBuilder, 77 | failureIndicatorBuilder: failureIndicatorBuilder, 78 | resultIndicatorDuration: resultIndicatorDuration, 79 | progressIndicatorLocation: progressIndicatorLocation, 80 | ); 81 | 82 | /// A [FutureOutlineButton] with an icon. 83 | /// See [OutlineButton.icon] for more info. 84 | FutureOutlineButton.icon({ 85 | Key key, 86 | @required FutureCallback onPressed, 87 | @required Widget label, 88 | @required this.icon, 89 | Curve animationCurve, 90 | Duration animationDuration, 91 | bool showResult = false, 92 | bool animateTransitions = true, 93 | WidgetBuilder progressIndicatorBuilder, 94 | WidgetBuilder successIndicatorBuilder, 95 | WidgetBuilder failureIndicatorBuilder, 96 | Duration resultIndicatorDuration, 97 | ProgressIndicatorLocation progressIndicatorLocation, 98 | this.onLongPress, 99 | this.mouseCursor, 100 | this.textTheme, 101 | this.textColor, 102 | this.disabledTextColor, 103 | this.color, 104 | this.focusColor, 105 | this.hoverColor, 106 | this.highlightColor, 107 | this.splashColor, 108 | this.highlightElevation, 109 | this.borderSide, 110 | this.disabledBorderColor, 111 | this.highlightedBorderColor, 112 | this.padding, 113 | this.visualDensity, 114 | this.shape, 115 | this.focusNode, 116 | this.clipBehavior = Clip.none, 117 | this.autofocus = false, 118 | }) : super( 119 | key: key, 120 | child: label, 121 | onPressed: onPressed, 122 | animationCurve: animationCurve, 123 | animationDuration: animationDuration, 124 | showResult: showResult, 125 | animateTransitions: animateTransitions, 126 | progressIndicatorBuilder: progressIndicatorBuilder, 127 | successIndicatorBuilder: successIndicatorBuilder, 128 | failureIndicatorBuilder: failureIndicatorBuilder, 129 | resultIndicatorDuration: resultIndicatorDuration, 130 | progressIndicatorLocation: progressIndicatorLocation, 131 | ); 132 | 133 | @override 134 | _FutureOutlineButtonState createState() => _FutureOutlineButtonState(); 135 | } 136 | 137 | class _FutureOutlineButtonState 138 | extends GenericFutureButtonState { 139 | @override 140 | Widget buildButton({ 141 | BuildContext context, 142 | Widget child, 143 | VoidCallback onPressed, 144 | }) { 145 | if (widget.icon != null) { 146 | return OutlineButton.icon( 147 | icon: widget.icon, 148 | label: child, 149 | onPressed: isEnabled ? onPressed : null, 150 | onLongPress: widget.onLongPress, 151 | mouseCursor: widget.mouseCursor, 152 | textTheme: widget.textTheme, 153 | textColor: widget.textColor, 154 | disabledTextColor: widget.disabledTextColor, 155 | color: widget.color, 156 | focusColor: widget.focusColor, 157 | hoverColor: widget.hoverColor, 158 | highlightColor: widget.highlightColor, 159 | splashColor: widget.splashColor, 160 | highlightElevation: widget.highlightElevation, 161 | padding: widget.padding, 162 | visualDensity: widget.visualDensity, 163 | shape: widget.shape, 164 | focusNode: widget.focusNode, 165 | autofocus: widget.autofocus, 166 | clipBehavior: widget.clipBehavior, 167 | borderSide: widget.borderSide, 168 | disabledBorderColor: widget.disabledBorderColor, 169 | highlightedBorderColor: widget.highlightedBorderColor, 170 | ); 171 | } 172 | 173 | return OutlineButton( 174 | child: child, 175 | onPressed: isEnabled ? onPressed : null, 176 | onLongPress: widget.onLongPress, 177 | mouseCursor: widget.mouseCursor, 178 | textTheme: widget.textTheme, 179 | textColor: widget.textColor, 180 | disabledTextColor: widget.disabledTextColor, 181 | color: widget.color, 182 | focusColor: widget.focusColor, 183 | hoverColor: widget.hoverColor, 184 | highlightColor: widget.highlightColor, 185 | splashColor: widget.splashColor, 186 | highlightElevation: widget.highlightElevation, 187 | padding: widget.padding, 188 | visualDensity: widget.visualDensity, 189 | shape: widget.shape, 190 | focusNode: widget.focusNode, 191 | autofocus: widget.autofocus, 192 | clipBehavior: widget.clipBehavior, 193 | borderSide: widget.borderSide, 194 | disabledBorderColor: widget.disabledBorderColor, 195 | highlightedBorderColor: widget.highlightedBorderColor, 196 | ); 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /lib/src/buttons/material/future_raised_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/rendering.dart'; 3 | import 'package:future_button/src/generic_future_button.dart'; 4 | 5 | /// A Future version of the material [RasiedButton]. 6 | /// See [RaisedButton] for parameter descriptions. 7 | class FutureRaisedButton extends GenericFutureButtonWidget { 8 | final VoidCallback onLongPress; 9 | final ValueChanged onHighlightChanged; 10 | final MouseCursor mouseCursor; 11 | final ButtonTextTheme textTheme; 12 | final Color textColor; 13 | final Color disabledTextColor; 14 | final Color color; 15 | final Color disabledColor; 16 | final Color focusColor; 17 | final Color hoverColor; 18 | final Color highlightColor; 19 | final Color splashColor; 20 | final Brightness colorBrightness; 21 | final double elevation; 22 | final double focusElevation; 23 | final double hoverElevation; 24 | final double highlightElevation; 25 | final double disabledElevation; 26 | final EdgeInsetsGeometry padding; 27 | final VisualDensity visualDensity; 28 | final ShapeBorder shape; 29 | final Clip clipBehavior; 30 | final FocusNode focusNode; 31 | final bool autofocus; 32 | final MaterialTapTargetSize materialTapTargetSize; 33 | 34 | final Widget icon; 35 | 36 | /// Default [FutureRaisedButton] constructor. 37 | /// If you want to add an icon, see [FutureRaisedButton.icon]. 38 | /// See [RaisedButton] for more info. 39 | FutureRaisedButton({ 40 | Key key, 41 | @required FutureCallback onPressed, 42 | @required Widget child, 43 | Curve animationCurve, 44 | Duration animationDuration, 45 | bool showResult = false, 46 | bool animateTransitions = true, 47 | WidgetBuilder progressIndicatorBuilder, 48 | WidgetBuilder successIndicatorBuilder, 49 | WidgetBuilder failureIndicatorBuilder, 50 | Duration resultIndicatorDuration, 51 | ProgressIndicatorLocation progressIndicatorLocation, 52 | this.onLongPress, 53 | this.onHighlightChanged, 54 | this.mouseCursor, 55 | this.textTheme, 56 | this.textColor, 57 | this.disabledTextColor, 58 | this.color, 59 | this.disabledColor, 60 | this.focusColor, 61 | this.hoverColor, 62 | this.highlightColor, 63 | this.splashColor, 64 | this.colorBrightness, 65 | this.elevation, 66 | this.focusElevation, 67 | this.hoverElevation, 68 | this.highlightElevation, 69 | this.disabledElevation, 70 | this.padding, 71 | this.visualDensity, 72 | this.shape, 73 | this.focusNode, 74 | this.materialTapTargetSize, 75 | this.clipBehavior = Clip.none, 76 | this.autofocus = false, 77 | }) : icon = null, 78 | super( 79 | key: key, 80 | child: child, 81 | onPressed: onPressed, 82 | animationCurve: animationCurve, 83 | animationDuration: animationDuration, 84 | showResult: showResult, 85 | animateTransitions: animateTransitions, 86 | progressIndicatorBuilder: progressIndicatorBuilder, 87 | successIndicatorBuilder: successIndicatorBuilder, 88 | failureIndicatorBuilder: failureIndicatorBuilder, 89 | resultIndicatorDuration: resultIndicatorDuration, 90 | progressIndicatorLocation: progressIndicatorLocation, 91 | ); 92 | 93 | /// A [FutureRaisedButton] with an icon. 94 | /// See [RaisedButton.icon] for more info. 95 | FutureRaisedButton.icon({ 96 | Key key, 97 | @required FutureCallback onPressed, 98 | @required Widget label, 99 | @required this.icon, 100 | Curve animationCurve, 101 | Duration animationDuration, 102 | bool showResult = false, 103 | bool animateTransitions = true, 104 | WidgetBuilder progressIndicatorBuilder, 105 | WidgetBuilder successIndicatorBuilder, 106 | WidgetBuilder failureIndicatorBuilder, 107 | Duration resultIndicatorDuration, 108 | ProgressIndicatorLocation progressIndicatorLocation, 109 | this.onLongPress, 110 | this.onHighlightChanged, 111 | this.mouseCursor, 112 | this.textTheme, 113 | this.textColor, 114 | this.disabledTextColor, 115 | this.color, 116 | this.disabledColor, 117 | this.focusColor, 118 | this.hoverColor, 119 | this.highlightColor, 120 | this.splashColor, 121 | this.colorBrightness, 122 | this.elevation, 123 | this.focusElevation, 124 | this.hoverElevation, 125 | this.highlightElevation, 126 | this.disabledElevation, 127 | this.padding, 128 | this.visualDensity, 129 | this.shape, 130 | this.focusNode, 131 | this.materialTapTargetSize, 132 | this.clipBehavior = Clip.none, 133 | this.autofocus = false, 134 | }) : super( 135 | key: key, 136 | child: label, 137 | onPressed: onPressed, 138 | animationCurve: animationCurve, 139 | animationDuration: animationDuration, 140 | showResult: showResult, 141 | animateTransitions: animateTransitions, 142 | progressIndicatorBuilder: progressIndicatorBuilder, 143 | successIndicatorBuilder: successIndicatorBuilder, 144 | failureIndicatorBuilder: failureIndicatorBuilder, 145 | resultIndicatorDuration: resultIndicatorDuration, 146 | progressIndicatorLocation: progressIndicatorLocation, 147 | ); 148 | 149 | @override 150 | _FutureRaisedButtonState createState() => _FutureRaisedButtonState(); 151 | } 152 | 153 | class _FutureRaisedButtonState 154 | extends GenericFutureButtonState { 155 | @override 156 | Widget buildButton({ 157 | BuildContext context, 158 | Widget child, 159 | VoidCallback onPressed, 160 | }) { 161 | if (widget.icon != null) { 162 | return RaisedButton.icon( 163 | icon: widget.icon, 164 | label: child, 165 | onPressed: isEnabled ? onPressed : null, 166 | onLongPress: widget.onLongPress, 167 | onHighlightChanged: widget.onHighlightChanged, 168 | mouseCursor: widget.mouseCursor, 169 | textTheme: widget.textTheme, 170 | textColor: widget.textColor, 171 | disabledTextColor: widget.disabledTextColor, 172 | color: widget.color, 173 | disabledColor: widget.disabledColor, 174 | focusColor: widget.focusColor, 175 | hoverColor: widget.hoverColor, 176 | highlightColor: widget.highlightColor, 177 | splashColor: widget.splashColor, 178 | colorBrightness: widget.colorBrightness, 179 | elevation: widget.elevation, 180 | highlightElevation: widget.highlightElevation, 181 | disabledElevation: widget.disabledElevation, 182 | padding: widget.padding, 183 | shape: widget.shape, 184 | focusNode: widget.focusNode, 185 | materialTapTargetSize: widget.materialTapTargetSize, 186 | autofocus: widget.autofocus, 187 | clipBehavior: widget.clipBehavior, 188 | animationDuration: widget.animationDuration, 189 | ); 190 | } 191 | 192 | return RaisedButton( 193 | child: child, 194 | onPressed: isEnabled ? onPressed : null, 195 | onLongPress: widget.onLongPress, 196 | onHighlightChanged: widget.onHighlightChanged, 197 | mouseCursor: widget.mouseCursor, 198 | textTheme: widget.textTheme, 199 | textColor: widget.textColor, 200 | disabledTextColor: widget.disabledTextColor, 201 | color: widget.color, 202 | disabledColor: widget.disabledColor, 203 | focusColor: widget.focusColor, 204 | hoverColor: widget.hoverColor, 205 | highlightColor: widget.highlightColor, 206 | splashColor: widget.splashColor, 207 | colorBrightness: widget.colorBrightness, 208 | elevation: widget.elevation, 209 | focusElevation: widget.focusElevation, 210 | hoverElevation: widget.hoverElevation, 211 | highlightElevation: widget.highlightElevation, 212 | disabledElevation: widget.disabledElevation, 213 | padding: widget.padding, 214 | visualDensity: widget.visualDensity, 215 | shape: widget.shape, 216 | focusNode: widget.focusNode, 217 | materialTapTargetSize: widget.materialTapTargetSize, 218 | autofocus: widget.autofocus, 219 | clipBehavior: widget.clipBehavior, 220 | animationDuration: widget.animationDuration, 221 | ); 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /lib/src/generic_future_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter/material.dart' as material; 3 | import 'package:flutter/cupertino.dart' as cupertino; 4 | 5 | /// An `onPressed` function type for [GenericFutureButtonWidget]. 6 | /// It's different from default [VoidCallback] in a sense that the action of the widget is asynchronous. 7 | typedef FutureCallback = Future Function(); 8 | 9 | /// A default Material progress indicator. It uses [Material.CircularProgressIndicator]. 10 | /// It's used by default in [FutureFlatButton], [FutureIconButton], [FutureOutlineButton] and [FutureRaisedButton]. 11 | final WidgetBuilder defaultMaterialProgressIndicatorBuilder = 12 | (context) => SizedBox( 13 | width: 20.0, 14 | height: 20.0, 15 | child: material.CircularProgressIndicator(strokeWidth: 2.0), 16 | ); 17 | 18 | /// A default Cupertino progress indicator. It uses [Cupertino.CupertinoActivityIndicator]. 19 | /// It's used by default in [FutureCupertinoButton]. 20 | final WidgetBuilder defaultCupertinoProgressIndicatorBuilder = 21 | (context) => SizedBox( 22 | width: 20.0, 23 | height: 20.0, 24 | child: cupertino.CupertinoActivityIndicator(radius: 8.0), 25 | ); 26 | 27 | /// A default widget for "success" result indicator. 28 | final WidgetBuilder defaultSuccessResultIndicatorBuilder = 29 | (context) => Container( 30 | width: 20.0, 31 | height: 20.0, 32 | decoration: BoxDecoration( 33 | color: material.Colors.green, 34 | shape: BoxShape.circle, 35 | ), 36 | alignment: Alignment.center, 37 | child: Icon( 38 | material.Icons.check, 39 | size: 16.0, 40 | color: material.Colors.white, 41 | ), 42 | ); 43 | 44 | /// A default widget for "failed" result indicator. 45 | final WidgetBuilder defaultFailureResultIndicatorBuilder = 46 | (context) => Container( 47 | width: 20.0, 48 | height: 20.0, 49 | decoration: BoxDecoration( 50 | color: material.Colors.red, 51 | shape: BoxShape.circle, 52 | ), 53 | alignment: Alignment.center, 54 | child: Icon( 55 | material.Icons.error_outline, 56 | size: 16.0, 57 | color: material.Colors.white, 58 | ), 59 | ); 60 | 61 | /// The location of the progress indicator. 62 | /// [left] and [right] means that the progress indicator will be on the left or on the right, respectively. 63 | /// [center] means that the progress indicator will be centered and will hide [child]. 64 | enum ProgressIndicatorLocation { 65 | left, 66 | center, 67 | right, 68 | } 69 | 70 | enum FutureButtonState { 71 | success, 72 | failed, 73 | progress, 74 | normal, 75 | } 76 | 77 | /// A generic class for all Future buttons. 78 | /// See [FutureRaisedButton] or any FutureButton for info on how to create your own Future button. 79 | abstract class GenericFutureButtonWidget extends StatefulWidget { 80 | /// A callback of type `Future Function()`. This will be ran when user presses on the button. 81 | /// If the future is in progress, the loading indicator will be displayed. 82 | /// When the future completes (regardless if successful or not), the loading indicator will dissapear. 83 | final FutureCallback onPressed; 84 | 85 | /// The widget that's used as the progress indicator. 86 | /// You can substitute it with your own progress indicator if necessary. 87 | /// See [defaultMaterialProgressIndicatorBuilder] and [defaultCupertinoProgressIndicatorBuilder] for more info. 88 | final WidgetBuilder progressIndicatorBuilder; 89 | 90 | /// The child of the widget. Usually a [Text] widget. 91 | /// It will be hidden if [progressIndicatorLocation] is [ProgressIndicatorLocation.center] and future is in progress. 92 | final Widget child; 93 | 94 | /// The location of progress indicator. 95 | /// See [ProgressIndicatorLocation] for more info. 96 | final ProgressIndicatorLocation progressIndicatorLocation; 97 | 98 | /// Whether to show the result of the Future. 99 | /// Will show [successIndicatorBuilder] if Future completes without errors. 100 | /// Otherwise, will show [failureIndicatorBuilder]. 101 | final bool showResult; 102 | 103 | /// Whether to animate the transitions using [AnimatedSwitcher]. 104 | /// Defaults to [true]. 105 | final bool animateTransitions; 106 | 107 | /// Indicator to show when the Future is completed successfully. 108 | /// Defaults to [defaultSuccessResultIndicatorBuilder]. 109 | final WidgetBuilder successIndicatorBuilder; 110 | 111 | /// Indicator to show when the Future fails. 112 | /// Defaults to [defaultFailureResultIndicatorBuilder]. 113 | final WidgetBuilder failureIndicatorBuilder; 114 | 115 | /// For how long should the result be shown for. 116 | /// Default to `Duration(seconds: 2)`. 117 | final Duration resultIndicatorDuration; 118 | 119 | /// Curve that's used to animate the button size. 120 | /// Defaults to [Curves.easeInOut]. 121 | final Curve animationCurve; 122 | 123 | /// Duration that's used to animate the button size. 124 | /// Defaults to `Duration(milliseconds: 150)`. 125 | final Duration animationDuration; 126 | 127 | const GenericFutureButtonWidget({ 128 | Key key, 129 | @required this.onPressed, 130 | @required this.child, 131 | this.progressIndicatorBuilder, 132 | this.successIndicatorBuilder, 133 | this.failureIndicatorBuilder, 134 | this.showResult = false, 135 | this.animateTransitions = true, 136 | ProgressIndicatorLocation progressIndicatorLocation, 137 | Curve animationCurve, 138 | Duration animationDuration, 139 | Duration resultIndicatorDuration, 140 | }) : progressIndicatorLocation = 141 | progressIndicatorLocation ?? ProgressIndicatorLocation.left, 142 | animationDuration = 143 | animationDuration ?? const Duration(milliseconds: 150), 144 | animationCurve = animationCurve ?? Curves.easeInOut, 145 | resultIndicatorDuration = 146 | resultIndicatorDuration ?? const Duration(seconds: 2), 147 | super(key: key); 148 | } 149 | 150 | /// This is the state of the [GenericFutureButtonWidget]. 151 | /// If you want to implement your own Future button, take a look at [FutureRaisedButton] or other buttons. 152 | abstract class GenericFutureButtonState 153 | extends State with SingleTickerProviderStateMixin { 154 | FutureButtonState _state = FutureButtonState.normal; 155 | 156 | /// Whether the future is in progress. 157 | bool get isLoading => _state != FutureButtonState.normal; 158 | 159 | /// Whether the button can be pressed. 160 | bool get isEnabled => !isLoading && widget.onPressed != null; 161 | 162 | /// The builder for the indicator. 163 | /// Returned widget is dependent on [_state] and can be one of 164 | /// [_successIndicatorBuilder], [_failureIndicatorBuilder] or [_progressIndicatorBuilder]. 165 | WidgetBuilder get _indicatorBuilder { 166 | switch (_state) { 167 | case FutureButtonState.success: 168 | return _successIndicatorBuilder; 169 | case FutureButtonState.failed: 170 | return _failureIndicatorBuilder; 171 | case FutureButtonState.progress: 172 | return _progressIndicatorBuilder; 173 | default: 174 | return null; 175 | } 176 | } 177 | 178 | /// The builder for the progress indicator. 179 | /// If none is passed, uses [defaultMaterialProgressIndicatorBuilder]. 180 | WidgetBuilder get _progressIndicatorBuilder => 181 | widget.progressIndicatorBuilder ?? 182 | defaultMaterialProgressIndicatorBuilder; 183 | 184 | /// The builder for the success indicator. 185 | /// If none is passed, uses [defaultSuccessIndicatorBuilder]. 186 | WidgetBuilder get _successIndicatorBuilder => 187 | widget.successIndicatorBuilder ?? defaultSuccessResultIndicatorBuilder; 188 | 189 | /// The builder for the failure indicator. 190 | /// If none is passed, uses [defaultFailureIndicatorBuilder]. 191 | WidgetBuilder get _failureIndicatorBuilder => 192 | widget.failureIndicatorBuilder ?? defaultFailureResultIndicatorBuilder; 193 | 194 | /// [TextDirection] is used to indicate the order of the widgets in the button. 195 | /// If [widget.progressIndicatorLocation] is [ProgressIndicatorLocation.left], the order is normal. 196 | /// Otherwise, the order is reversed. 197 | TextDirection get textDirection { 198 | switch (widget.progressIndicatorLocation) { 199 | case ProgressIndicatorLocation.left: 200 | return TextDirection.ltr; 201 | case ProgressIndicatorLocation.right: 202 | return TextDirection.rtl; 203 | default: 204 | return null; 205 | } 206 | } 207 | 208 | /// Aligning the animation correctly is important. 209 | /// Here the animation must be aligned to the opposite side of the progress indicator so that the text doesn't get cut off. 210 | Alignment get animationAlignment { 211 | switch (widget.progressIndicatorLocation) { 212 | case ProgressIndicatorLocation.left: 213 | return Alignment.centerRight; 214 | case ProgressIndicatorLocation.center: 215 | return Alignment.center; 216 | case ProgressIndicatorLocation.right: 217 | return Alignment.centerLeft; 218 | default: 219 | return null; 220 | } 221 | } 222 | 223 | /// The body of the button. 224 | /// If the future is completed or not running, the body is [widget.child]. 225 | /// If the future is running and [widget.progressIndicatorLocation] is [ProgressIndicatorLocation.center], it'll display the progress indicator only. 226 | /// If the future is running and [widget.progressIndicatorLocation] is not [ProgressIndicatorLocation.center], it'll display the progress indicator and the child. The order depends on [textDirection]. 227 | Widget get child { 228 | Widget child; 229 | 230 | if (!isLoading) { 231 | child = widget.child; 232 | } else if (widget.progressIndicatorLocation == 233 | ProgressIndicatorLocation.center) { 234 | child = _indicatorBuilder(context); 235 | } else { 236 | return Row( 237 | mainAxisSize: MainAxisSize.min, 238 | textDirection: textDirection, 239 | children: [ 240 | AnimatedSwitcher( 241 | duration: widget.animationDuration, 242 | switchInCurve: widget.animationCurve, 243 | switchOutCurve: widget.animationCurve, 244 | child: _indicatorBuilder(context), 245 | ), 246 | SizedBox(width: 8.0), 247 | widget.child, 248 | ], 249 | ); 250 | } 251 | 252 | if (!widget.animateTransitions) return child; 253 | 254 | return AnimatedSwitcher( 255 | duration: widget.animationDuration, 256 | switchInCurve: widget.animationCurve, 257 | switchOutCurve: widget.animationCurve, 258 | child: child, 259 | ); 260 | } 261 | 262 | /// The `onPressed` callback wrapper. 263 | /// It awaits for the future to be finished. 264 | Future onPressed() async { 265 | setState(() { 266 | _state = FutureButtonState.progress; 267 | }); 268 | 269 | Exception error; 270 | try { 271 | await widget.onPressed(); 272 | } catch (e) { 273 | error = e; 274 | } 275 | 276 | if (!widget.showResult) { 277 | setState(() { 278 | _state = FutureButtonState.normal; 279 | }); 280 | 281 | if (error != null) { 282 | throw error; 283 | } 284 | } else { 285 | setState(() { 286 | _state = error == null 287 | ? FutureButtonState.success 288 | : FutureButtonState.failed; 289 | }); 290 | 291 | await Future.delayed(widget.resultIndicatorDuration, () { 292 | setState(() { 293 | _state = FutureButtonState.normal; 294 | }); 295 | }); 296 | } 297 | } 298 | 299 | /// This is an abstract function that's dependent on the button type. 300 | /// See [FutureRaisedButton] or other buttons for implementation details. 301 | Widget buildButton({ 302 | BuildContext context, 303 | Widget child, 304 | VoidCallback onPressed, 305 | }); 306 | 307 | @override 308 | Widget build(BuildContext context) { 309 | return buildButton( 310 | context: context, 311 | child: AnimatedSize( 312 | vsync: this, 313 | duration: widget.animationDuration, 314 | curve: widget.animationCurve, 315 | alignment: animationAlignment, 316 | child: child, 317 | ), 318 | onPressed: isEnabled ? onPressed : null, 319 | ); 320 | } 321 | } 322 | -------------------------------------------------------------------------------- /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 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0-nullsafety.1" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0-nullsafety.3" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0-nullsafety.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0-nullsafety.1" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0-nullsafety.3" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0-nullsafety.1" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.12.10-nullsafety.1" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.3.0-nullsafety.3" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.8.0-nullsafety.1" 84 | pedantic: 85 | dependency: "direct dev" 86 | description: 87 | name: pedantic 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.9.2" 91 | sky_engine: 92 | dependency: transitive 93 | description: flutter 94 | source: sdk 95 | version: "0.0.99" 96 | source_span: 97 | dependency: transitive 98 | description: 99 | name: source_span 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "1.8.0-nullsafety.2" 103 | stack_trace: 104 | dependency: transitive 105 | description: 106 | name: stack_trace 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.10.0-nullsafety.1" 110 | stream_channel: 111 | dependency: transitive 112 | description: 113 | name: stream_channel 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "2.1.0-nullsafety.1" 117 | string_scanner: 118 | dependency: transitive 119 | description: 120 | name: string_scanner 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.1.0-nullsafety.1" 124 | term_glyph: 125 | dependency: transitive 126 | description: 127 | name: term_glyph 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.2.0-nullsafety.1" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "0.2.19-nullsafety.2" 138 | typed_data: 139 | dependency: transitive 140 | description: 141 | name: typed_data 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.3.0-nullsafety.3" 145 | vector_math: 146 | dependency: transitive 147 | description: 148 | name: vector_math 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "2.1.0-nullsafety.3" 152 | sdks: 153 | dart: ">=2.10.0-110 <2.11.0" 154 | flutter: ">=1.17.0 <2.0.0" 155 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: future_button 2 | description: Customizable Material and Cupertino buttons with progress bars. Useful if you want to show a loading indicator when user presses some action, and show the result afterwards. 3 | version: 0.1.2 4 | author: kekland 5 | homepage: https://github.com/kekland/future_button 6 | repository: https://github.com/kekland/future_button 7 | issue_tracker: https://github.com/kekland/future_button/issues 8 | 9 | environment: 10 | sdk: ">=2.7.0 <3.0.0" 11 | flutter: ">=1.17.0 <2.0.0" 12 | 13 | dependencies: 14 | flutter: 15 | sdk: flutter 16 | 17 | dev_dependencies: 18 | pedantic: ^1.9.0 19 | flutter_test: 20 | sdk: flutter 21 | 22 | # The following section is specific to Flutter. 23 | flutter: 24 | -------------------------------------------------------------------------------- /test/future_button_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | import 'package:future_button/future_button.dart'; 6 | 7 | class PlannedException implements Exception {} 8 | 9 | const waitDuration = Duration(milliseconds: 150); 10 | const animationDuration = Duration(milliseconds: 50); 11 | const resultIndicatorDuration = Duration(milliseconds: 150); 12 | 13 | final progressIndicatorBuilders = [ 14 | defaultMaterialProgressIndicatorBuilder, 15 | defaultCupertinoProgressIndicatorBuilder, 16 | ]; 17 | 18 | final successIndicatorBuilder = defaultSuccessResultIndicatorBuilder; 19 | final failureIndicatorBuilder = defaultFailureResultIndicatorBuilder; 20 | 21 | typedef FutureButtonBuilder = Widget Function({ 22 | FutureCallback onPressed, 23 | WidgetBuilder progressIndicatorBuilder, 24 | WidgetBuilder successIndicatorBuilder, 25 | WidgetBuilder failureIndicatorBuilder, 26 | bool showResult, 27 | Widget child, 28 | ProgressIndicatorLocation progressIndicatorLocation, 29 | }); 30 | 31 | Future waitForAndFail() async { 32 | await Future.delayed(waitDuration); 33 | throw PlannedException(); 34 | } 35 | 36 | Future waitFor() { 37 | return Future.delayed(waitDuration); 38 | } 39 | 40 | Future waitForAnimation() { 41 | return Future.delayed(animationDuration); 42 | } 43 | 44 | Future waitForResultIndicator() { 45 | return Future.delayed(resultIndicatorDuration); 46 | } 47 | 48 | Future testButtonWithArgs( 49 | WidgetTester tester, { 50 | List progressIndicatorLocations = 51 | ProgressIndicatorLocation.values, 52 | FutureButtonBuilder builder, 53 | FutureCallback onTap, 54 | bool shouldError = false, 55 | bool shouldShowResultIndicator = false, 56 | }) async { 57 | for (final progressIndicatorLocation in progressIndicatorLocations) { 58 | for (final progressIndicatorBuilder in progressIndicatorBuilders) { 59 | final child = Container(); 60 | final progressIndicator = progressIndicatorBuilder(null); 61 | final successIndicator = progressIndicatorBuilder(null); 62 | final failureIndicator = progressIndicatorBuilder(null); 63 | 64 | final widget = builder( 65 | onPressed: onTap, 66 | progressIndicatorBuilder: (_) => progressIndicator, 67 | successIndicatorBuilder: (_) => successIndicator, 68 | failureIndicatorBuilder: (_) => failureIndicator, 69 | progressIndicatorLocation: progressIndicatorLocation, 70 | showResult: shouldShowResultIndicator, 71 | child: child, 72 | ); 73 | 74 | await tester.pumpWidget( 75 | MaterialApp( 76 | home: Scaffold(body: Center(child: widget)), 77 | ), 78 | ); 79 | 80 | final state = tester.state( 81 | find.byWidget(widget), 82 | ); 83 | 84 | expect(find.byWidget(widget), findsOneWidget); 85 | expect(find.byWidget(child), findsOneWidget); 86 | expect(find.byWidget(progressIndicator), findsNothing); 87 | 88 | expect(state.isLoading, equals(false)); 89 | expect(state.isEnabled, equals(onTap != null)); 90 | 91 | if (onTap != null) { 92 | await tester.runAsync(() async { 93 | await tester.tap(find.byWidget(widget)); 94 | await tester.pump(); 95 | 96 | expect( 97 | find.byWidget(child), 98 | progressIndicatorLocation == ProgressIndicatorLocation.center 99 | ? findsNothing 100 | : findsOneWidget, 101 | ); 102 | 103 | expect(find.byWidget(progressIndicator), findsOneWidget); 104 | 105 | expect(state.isLoading, equals(true)); 106 | expect(state.isEnabled, equals(false)); 107 | 108 | await waitFor(); 109 | await tester.pump(); 110 | }); 111 | 112 | if (shouldShowResultIndicator) { 113 | expect(find.byWidget(widget), findsOneWidget); 114 | 115 | if (progressIndicatorLocation == ProgressIndicatorLocation.center) { 116 | expect(find.byWidget(child), findsNothing); 117 | } else { 118 | expect(find.byWidget(child), findsOneWidget); 119 | } 120 | 121 | expect(find.byWidget(progressIndicator), findsNothing); 122 | expect( 123 | find.byWidget(shouldError ? failureIndicator : successIndicator), 124 | findsOneWidget); 125 | 126 | expect(state.isLoading, equals(true)); 127 | expect(state.isEnabled, equals(false)); 128 | 129 | await tester.runAsync(() async { 130 | await waitForResultIndicator(); 131 | await tester.pump(); 132 | }); 133 | 134 | expect(find.byWidget(widget), findsOneWidget); 135 | expect(find.byWidget(child), findsOneWidget); 136 | expect(find.byWidget(successIndicator), findsNothing); 137 | expect(find.byWidget(failureIndicator), findsNothing); 138 | expect(find.byWidget(progressIndicator), findsNothing); 139 | 140 | expect(state.isLoading, equals(false)); 141 | expect(state.isEnabled, equals(true)); 142 | } else { 143 | expect(find.byWidget(widget), findsOneWidget); 144 | expect(find.byWidget(child), findsOneWidget); 145 | expect(find.byWidget(progressIndicator), findsNothing); 146 | 147 | expect(state.isLoading, equals(false)); 148 | expect(state.isEnabled, equals(true)); 149 | } 150 | } 151 | } 152 | } 153 | } 154 | 155 | void testButton({ 156 | String name, 157 | FutureButtonBuilder builder, 158 | List progressIndicatorLocations = 159 | ProgressIndicatorLocation.values, 160 | }) { 161 | testWidgets( 162 | 'Test normal $name', 163 | (tester) async { 164 | await testButtonWithArgs( 165 | tester, 166 | builder: builder, 167 | onTap: waitFor, 168 | progressIndicatorLocations: progressIndicatorLocations, 169 | ); 170 | }, 171 | ); 172 | 173 | testWidgets( 174 | 'Test disabled $name', 175 | (tester) async { 176 | await testButtonWithArgs( 177 | tester, 178 | builder: builder, 179 | onTap: null, 180 | progressIndicatorLocations: progressIndicatorLocations, 181 | ); 182 | }, 183 | ); 184 | 185 | testWidgets( 186 | 'Test success result $name', 187 | (tester) async { 188 | await testButtonWithArgs( 189 | tester, 190 | builder: builder, 191 | onTap: waitFor, 192 | progressIndicatorLocations: progressIndicatorLocations, 193 | shouldError: false, 194 | shouldShowResultIndicator: true, 195 | ); 196 | }, 197 | ); 198 | 199 | testWidgets( 200 | 'Test failure result $name', 201 | (tester) async { 202 | await testButtonWithArgs( 203 | tester, 204 | builder: builder, 205 | onTap: waitForAndFail, 206 | progressIndicatorLocations: progressIndicatorLocations, 207 | shouldError: true, 208 | shouldShowResultIndicator: true, 209 | ); 210 | }, 211 | ); 212 | } 213 | 214 | void main() { 215 | testButton( 216 | name: 'FutureCupertinoButton', 217 | builder: ({ 218 | FutureCallback onPressed, 219 | WidgetBuilder progressIndicatorBuilder, 220 | WidgetBuilder successIndicatorBuilder, 221 | WidgetBuilder failureIndicatorBuilder, 222 | bool showResult, 223 | Widget child, 224 | ProgressIndicatorLocation progressIndicatorLocation, 225 | }) { 226 | return FutureCupertinoButton( 227 | child: child, 228 | onPressed: onPressed, 229 | progressIndicatorLocation: progressIndicatorLocation, 230 | progressIndicatorBuilder: progressIndicatorBuilder, 231 | successIndicatorBuilder: successIndicatorBuilder, 232 | failureIndicatorBuilder: failureIndicatorBuilder, 233 | showResult: showResult, 234 | animationDuration: animationDuration, 235 | animateTransitions: false, 236 | resultIndicatorDuration: resultIndicatorDuration, 237 | ); 238 | }, 239 | ); 240 | 241 | testButton( 242 | name: 'FutureCupertinoButton.filled', 243 | builder: ({ 244 | FutureCallback onPressed, 245 | WidgetBuilder progressIndicatorBuilder, 246 | WidgetBuilder successIndicatorBuilder, 247 | WidgetBuilder failureIndicatorBuilder, 248 | bool showResult, 249 | Widget child, 250 | ProgressIndicatorLocation progressIndicatorLocation, 251 | }) { 252 | return FutureCupertinoButton.filled( 253 | child: child, 254 | onPressed: onPressed, 255 | progressIndicatorLocation: progressIndicatorLocation, 256 | progressIndicatorBuilder: progressIndicatorBuilder, 257 | successIndicatorBuilder: successIndicatorBuilder, 258 | failureIndicatorBuilder: failureIndicatorBuilder, 259 | showResult: showResult, 260 | animationDuration: animationDuration, 261 | animateTransitions: false, 262 | resultIndicatorDuration: resultIndicatorDuration, 263 | ); 264 | }, 265 | ); 266 | 267 | testButton( 268 | name: 'FutureFlatButton', 269 | builder: ({ 270 | FutureCallback onPressed, 271 | WidgetBuilder progressIndicatorBuilder, 272 | WidgetBuilder successIndicatorBuilder, 273 | WidgetBuilder failureIndicatorBuilder, 274 | bool showResult, 275 | Widget child, 276 | ProgressIndicatorLocation progressIndicatorLocation, 277 | }) { 278 | return FutureFlatButton( 279 | child: child, 280 | onPressed: onPressed, 281 | progressIndicatorLocation: progressIndicatorLocation, 282 | progressIndicatorBuilder: progressIndicatorBuilder, 283 | successIndicatorBuilder: successIndicatorBuilder, 284 | failureIndicatorBuilder: failureIndicatorBuilder, 285 | showResult: showResult, 286 | animationDuration: animationDuration, 287 | animateTransitions: false, 288 | resultIndicatorDuration: resultIndicatorDuration, 289 | ); 290 | }, 291 | ); 292 | 293 | testButton( 294 | name: 'FutureFlatButton.icon', 295 | builder: ({ 296 | FutureCallback onPressed, 297 | WidgetBuilder progressIndicatorBuilder, 298 | WidgetBuilder successIndicatorBuilder, 299 | WidgetBuilder failureIndicatorBuilder, 300 | bool showResult, 301 | Widget child, 302 | ProgressIndicatorLocation progressIndicatorLocation, 303 | }) { 304 | return FutureFlatButton.icon( 305 | icon: Icon(Icons.star), 306 | label: child, 307 | onPressed: onPressed, 308 | progressIndicatorLocation: progressIndicatorLocation, 309 | progressIndicatorBuilder: progressIndicatorBuilder, 310 | successIndicatorBuilder: successIndicatorBuilder, 311 | failureIndicatorBuilder: failureIndicatorBuilder, 312 | showResult: showResult, 313 | animationDuration: animationDuration, 314 | animateTransitions: false, 315 | resultIndicatorDuration: resultIndicatorDuration, 316 | ); 317 | }, 318 | ); 319 | testButton( 320 | name: 'FutureIconButton', 321 | progressIndicatorLocations: [ProgressIndicatorLocation.center], 322 | builder: ({ 323 | FutureCallback onPressed, 324 | WidgetBuilder progressIndicatorBuilder, 325 | WidgetBuilder successIndicatorBuilder, 326 | WidgetBuilder failureIndicatorBuilder, 327 | bool showResult, 328 | Widget child, 329 | ProgressIndicatorLocation progressIndicatorLocation, 330 | }) { 331 | return FutureIconButton( 332 | icon: child, 333 | onPressed: onPressed, 334 | progressIndicatorBuilder: progressIndicatorBuilder, 335 | successIndicatorBuilder: successIndicatorBuilder, 336 | failureIndicatorBuilder: failureIndicatorBuilder, 337 | showResult: showResult, 338 | animationDuration: animationDuration, 339 | animateTransitions: false, 340 | resultIndicatorDuration: resultIndicatorDuration, 341 | ); 342 | }, 343 | ); 344 | 345 | testButton( 346 | name: 'FutureOutlineButton', 347 | builder: ({ 348 | FutureCallback onPressed, 349 | WidgetBuilder progressIndicatorBuilder, 350 | WidgetBuilder successIndicatorBuilder, 351 | WidgetBuilder failureIndicatorBuilder, 352 | bool showResult, 353 | Widget child, 354 | ProgressIndicatorLocation progressIndicatorLocation, 355 | }) { 356 | return FutureOutlineButton( 357 | child: child, 358 | onPressed: onPressed, 359 | progressIndicatorLocation: progressIndicatorLocation, 360 | progressIndicatorBuilder: progressIndicatorBuilder, 361 | successIndicatorBuilder: successIndicatorBuilder, 362 | failureIndicatorBuilder: failureIndicatorBuilder, 363 | showResult: showResult, 364 | animationDuration: animationDuration, 365 | animateTransitions: false, 366 | resultIndicatorDuration: resultIndicatorDuration, 367 | ); 368 | }, 369 | ); 370 | 371 | testButton( 372 | name: 'FutureOutlineButton.icon', 373 | builder: ({ 374 | FutureCallback onPressed, 375 | WidgetBuilder progressIndicatorBuilder, 376 | WidgetBuilder successIndicatorBuilder, 377 | WidgetBuilder failureIndicatorBuilder, 378 | bool showResult, 379 | Widget child, 380 | ProgressIndicatorLocation progressIndicatorLocation, 381 | }) { 382 | return FutureOutlineButton.icon( 383 | icon: Icon(Icons.star), 384 | label: child, 385 | onPressed: onPressed, 386 | progressIndicatorLocation: progressIndicatorLocation, 387 | progressIndicatorBuilder: progressIndicatorBuilder, 388 | successIndicatorBuilder: successIndicatorBuilder, 389 | failureIndicatorBuilder: failureIndicatorBuilder, 390 | showResult: showResult, 391 | animationDuration: animationDuration, 392 | animateTransitions: false, 393 | resultIndicatorDuration: resultIndicatorDuration, 394 | ); 395 | }, 396 | ); 397 | 398 | testButton( 399 | name: 'FutureRaisedButton', 400 | builder: ({ 401 | FutureCallback onPressed, 402 | WidgetBuilder progressIndicatorBuilder, 403 | WidgetBuilder successIndicatorBuilder, 404 | WidgetBuilder failureIndicatorBuilder, 405 | bool showResult, 406 | Widget child, 407 | ProgressIndicatorLocation progressIndicatorLocation, 408 | }) { 409 | return FutureRaisedButton( 410 | child: child, 411 | onPressed: onPressed, 412 | progressIndicatorLocation: progressIndicatorLocation, 413 | progressIndicatorBuilder: progressIndicatorBuilder, 414 | successIndicatorBuilder: successIndicatorBuilder, 415 | failureIndicatorBuilder: failureIndicatorBuilder, 416 | showResult: showResult, 417 | animationDuration: animationDuration, 418 | animateTransitions: false, 419 | resultIndicatorDuration: resultIndicatorDuration, 420 | ); 421 | }, 422 | ); 423 | 424 | testButton( 425 | name: 'FutureRaisedButton.icon', 426 | builder: ({ 427 | FutureCallback onPressed, 428 | WidgetBuilder progressIndicatorBuilder, 429 | WidgetBuilder successIndicatorBuilder, 430 | WidgetBuilder failureIndicatorBuilder, 431 | bool showResult, 432 | Widget child, 433 | ProgressIndicatorLocation progressIndicatorLocation, 434 | }) { 435 | return FutureRaisedButton.icon( 436 | icon: Icon(Icons.star), 437 | label: child, 438 | onPressed: onPressed, 439 | progressIndicatorLocation: progressIndicatorLocation, 440 | progressIndicatorBuilder: progressIndicatorBuilder, 441 | successIndicatorBuilder: successIndicatorBuilder, 442 | failureIndicatorBuilder: failureIndicatorBuilder, 443 | showResult: showResult, 444 | animationDuration: animationDuration, 445 | animateTransitions: false, 446 | resultIndicatorDuration: resultIndicatorDuration, 447 | ); 448 | }, 449 | ); 450 | } 451 | --------------------------------------------------------------------------------