├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── 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 │ ├── dropdownBelowTest.dart │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── lib └── dropdown_below.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── dropdown_below_test.dart └── test1.gif /.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: b041144f833e05cf463b8887fa12efdec9493488 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.3] - 2021-12-30 2 | 3 | * Fix nullable error which selected no value or cannot select value in IOS. 4 | 5 | ## [1.0.2] - 2021-12-07 6 | 7 | * Pull request https://github.com/whatamelon/flutter_dropdown_below/pull/10 this commit solving https://github.com/whatamelon/flutter_dropdown_below/issues/9 by @bhumitbelani 8 | 9 | ## [1.0.1] - 2021-11-08 10 | 11 | * Fix issue https://github.com/whatamelon/flutter_dropdown_below/issues/5 12 | * Pull request https://github.com/whatamelon/flutter_dropdown_below/pull/8 this commit solving https://github.com/whatamelon/flutter_dropdown_below/issues/7 this issue by @darker-dubai 13 | 14 | ## [1.0.0] - 2021-07-28 15 | 16 | * Fix issue https://github.com/whatamelon/flutter_dropdown_below/issues/4#issue-953987467 17 | * Reformat with dartfmt -w . 18 | 19 | ## [0.0.9] - 2021-07-06 20 | 21 | * Fix issue https://github.com/whatamelon/flutter_dropdown_below/issues/3#issue-935545330 22 | * Reformat with dartfmt -w . 23 | 24 | 25 | ## [0.0.8] - 2021-06-11 26 | 27 | * Support change boxDecoration, right side icon 28 | * now right side Icon is not required widget. You can customize it whatever. 29 | 30 | 31 | ## [0.0.7] - 2021-03-12 32 | 33 | * Flutter2 Null Safety migrate 34 | * Reformat with dartfmt -w . 35 | 36 | 37 | ## [0.0.6] - 2021-02-18 38 | 39 | * fixed issue : shadowThemeOnly not founded #1 40 | 41 | 42 | ## [0.0.5] - 2020-11-23 43 | 44 | * Redeem explanation for pub score. 45 | 46 | 47 | ## [0.0.4] - 2020-10-12 48 | 49 | * Update Readme.md's image file 50 | 51 | ## [0.0.3] - 2020-10-12 52 | 53 | * Update to add boxwidth 54 | * Update Readme.md 55 | 56 | 57 | ## [0.0.2] - 2020-09-18 58 | 59 | * Update Readme.md 60 | 61 | 62 | ## [0.0.1] - 2020-07-30 63 | 64 | * First release. 65 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Denny Hong 2 | Permission is hereby granted, free of charge, to any person obtaining a copy 3 | of this software and associated documentation files (the "Software"), to deal 4 | in the Software without restriction, including without limitation the rights 5 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 | copies of the Software, and to permit persons to whom the Software is 7 | furnished to do so, subject to the following conditions: 8 | The above copyright notice and this permission notice shall be included in all 9 | copies or substantial portions of the Software. 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 16 | SOFTWARE. 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Dropdown_Below 2 | 3 | 4 | #### A Flutter Dropdown library which is customize flutter dropdownbutton widget. 5 | 6 | ![license](https://img.shields.io/github/license/whatamelon/flutter_dropdown_below?color=red&style=flat-square) 7 | ![license](https://img.shields.io/github/languages/top/whatamelon/flutter_dropdown_below?color=blue&style=flat-square) 8 | ![license](https://img.shields.io/pub/v/dropdown_below?color=green&include_prereleases&style=flat-square) 9 | 10 | 11 | 12 | 13 | 14 | ## Options 15 | 16 | | options | description |type|required| 17 | |---|---|---|--- 18 | itemWidth |dropdown item's box width|double|X 19 | itemTextstyle |dropdown item's text style|double|X 20 | boxTextstyle |seletced box text style|TextStyle|X 21 | boxPadding |seletced box inner padding|EdgeInsetsGeometry|X 22 | boxHeight | seletced box height|double|X 23 | boxWidth | seletced box width|double|X 24 | hint |text before you choose item|Widget|X 25 | value |selected item|T|X 26 | boxDecoration |box's border, borderRadius, color|BoxDecoration|X 27 | icon |widget which is right beside|Widget|X 28 | items | itemsList |List>|O 29 | onChange |change item function|ValueChanged|O 30 | 31 | 32 | 33 | ## How to make it Work? 34 | ### Description for example. 35 | 36 | ### 1. datas 37 | 38 | 39 | _testList's type is always be a list. 40 | 41 | If you want to use map or other type, you can customize this package. 42 | 43 | List _testList = [{'no': 1, 'keyword': 'blue'},{'no': 2, 'keyword': 'black'},{'no': 3, 'keyword': 'red'}]; 44 | List _dropdownTestItems; 45 | var _selectedTest; 46 | 47 | 48 | ### 2. initState & build items to correct type 49 | 50 | If you want to customize item's child widget ex) Text -> Container, You can change any widget you want. 51 | 52 | @override 53 | void initState() { 54 | _dropdownTestItems = buildDropdownTestItems(_testList); 55 | super.initState(); 56 | } 57 | 58 | List buildDropdownTestItems(List _testList) { 59 | List items = List(); 60 | for (var i in _testList) { 61 | items.add( 62 | DropdownMenuItem( 63 | value: i, 64 | child: Text(i['keyword']), 65 | ), 66 | ); 67 | } 68 | return items; 69 | } 70 | 71 | ### 3. change function 72 | 73 | 74 | onChangeDropdownTests(selectedTest) { 75 | print(selectedTest); 76 | setState(() { 77 | _selectedTest = selectedTest; 78 | }); 79 | } 80 | 81 | ### 4. UI 82 | 83 | Dropdown Widget. 84 | 85 | DropdownBelow( 86 | itemWidth: 200, 87 | itemTextstyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black), 88 | boxTextstyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0XFFbbbbbb)), 89 | boxPadding: EdgeInsets.fromLTRB(13, 12, 0, 12), 90 | boxHeight: 45, 91 | boxWidth: 200, 92 | hint: Text('choose item'), 93 | value: _selectedTest, 94 | items: _dropdownTestItems, 95 | onChanged: onChangeDropdownTests, 96 | ), 97 | 98 | 99 | 100 | 101 | ### 5. Question 102 | 103 | 104 | IF you want to make itemBox dropdown when you enter the page? 105 | 106 | Put this code to initState like this. 107 | 108 | 109 | Timer(Duration(milliseconds: 200), () { 110 | CustomDropdownButtonState state = dropdownKey1.currentState; 111 | state.callTap(); 112 | }); 113 | 114 | 115 | And put key to Widget like this. 116 | 117 | DropdownBelow( 118 | key: dropdownKey1, 119 | itemWidth: 200, 120 | itemTextstyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black), 121 | boxTextstyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0XFFbbbbbb)), 122 | boxPadding: EdgeInsets.fromLTRB(13, 12, 0, 12), 123 | boxHeight: 45, 124 | boxWidth: 200, 125 | hint: Text('choose item'), 126 | value: _selectedTest, 127 | items: _dropdownTestItems, 128 | onChanged: onChangeDropdownTests, 129 | ) 130 | 131 | 132 | Actually, dropdown widget is made by Navigation. So, it can work. 133 | 134 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /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: b041144f833e05cf463b8887fa12efdec9493488 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | include ':app' 6 | 7 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 8 | def properties = new Properties() 9 | 10 | assert localPropertiesFile.exists() 11 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 12 | 13 | def flutterSdkPath = properties.getProperty("flutter.sdk") 14 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 15 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 16 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 97C146F11CF9000F007C117D /* Supporting Files */, 94 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 95 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 96 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 97 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 98 | ); 99 | path = Runner; 100 | sourceTree = ""; 101 | }; 102 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 97C146ED1CF9000F007C117D /* Runner */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 115 | buildPhases = ( 116 | 9740EEB61CF901F6004384FC /* Run Script */, 117 | 97C146EA1CF9000F007C117D /* Sources */, 118 | 97C146EB1CF9000F007C117D /* Frameworks */, 119 | 97C146EC1CF9000F007C117D /* Resources */, 120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = Runner; 128 | productName = Runner; 129 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 97C146E61CF9000F007C117D /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = ""; 140 | TargetAttributes = { 141 | 97C146ED1CF9000F007C117D = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | LastSwiftMigration = 1100; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 148 | compatibilityVersion = "Xcode 9.3"; 149 | developmentRegion = en; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 97C146E51CF9000F007C117D; 156 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 97C146ED1CF9000F007C117D /* Runner */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 97C146EC1CF9000F007C117D /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 171 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 172 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 173 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Thin Binary"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 193 | }; 194 | 9740EEB61CF901F6004384FC /* Run Script */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Run Script"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 97C146EA1CF9000F007C117D /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 216 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C146FB1CF9000F007C117D /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C147001CF9000F007C117D /* Base */, 235 | ); 236 | name = LaunchScreen.storyboard; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | CLANG_ANALYZER_NONNULL = YES; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 252 | CLANG_WARN_BOOL_CONVERSION = YES; 253 | CLANG_WARN_COMMA = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_EMPTY_BODY = YES; 258 | CLANG_WARN_ENUM_CONVERSION = YES; 259 | CLANG_WARN_INFINITE_RECURSION = YES; 260 | CLANG_WARN_INT_CONVERSION = YES; 261 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 263 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 266 | CLANG_WARN_STRICT_PROTOTYPES = YES; 267 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_NS_ASSERTIONS = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_UNDECLARED_SELECTOR = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 281 | GCC_WARN_UNUSED_FUNCTION = YES; 282 | GCC_WARN_UNUSED_VARIABLE = YES; 283 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 284 | MTL_ENABLE_DEBUG_INFO = NO; 285 | SDKROOT = iphoneos; 286 | SUPPORTED_PLATFORMS = iphoneos; 287 | TARGETED_DEVICE_FAMILY = "1,2"; 288 | VALIDATE_PRODUCT = YES; 289 | }; 290 | name = Profile; 291 | }; 292 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 293 | isa = XCBuildConfiguration; 294 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | CLANG_ENABLE_MODULES = YES; 298 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 299 | ENABLE_BITCODE = NO; 300 | FRAMEWORK_SEARCH_PATHS = ( 301 | "$(inherited)", 302 | "$(PROJECT_DIR)/Flutter", 303 | ); 304 | INFOPLIST_FILE = Runner/Info.plist; 305 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 306 | LIBRARY_SEARCH_PATHS = ( 307 | "$(inherited)", 308 | "$(PROJECT_DIR)/Flutter", 309 | ); 310 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 313 | SWIFT_VERSION = 5.0; 314 | VERSIONING_SYSTEM = "apple-generic"; 315 | }; 316 | name = Profile; 317 | }; 318 | 97C147031CF9000F007C117D /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ALWAYS_SEARCH_USER_PATHS = NO; 322 | CLANG_ANALYZER_NONNULL = YES; 323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 324 | CLANG_CXX_LIBRARY = "libc++"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 328 | CLANG_WARN_BOOL_CONVERSION = YES; 329 | CLANG_WARN_COMMA = YES; 330 | CLANG_WARN_CONSTANT_CONVERSION = YES; 331 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INFINITE_RECURSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 339 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 342 | CLANG_WARN_STRICT_PROTOTYPES = YES; 343 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 344 | CLANG_WARN_UNREACHABLE_CODE = YES; 345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 347 | COPY_PHASE_STRIP = NO; 348 | DEBUG_INFORMATION_FORMAT = dwarf; 349 | ENABLE_STRICT_OBJC_MSGSEND = YES; 350 | ENABLE_TESTABILITY = YES; 351 | GCC_C_LANGUAGE_STANDARD = gnu99; 352 | GCC_DYNAMIC_NO_PIC = NO; 353 | GCC_NO_COMMON_BLOCKS = YES; 354 | GCC_OPTIMIZATION_LEVEL = 0; 355 | GCC_PREPROCESSOR_DEFINITIONS = ( 356 | "DEBUG=1", 357 | "$(inherited)", 358 | ); 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 366 | MTL_ENABLE_DEBUG_INFO = YES; 367 | ONLY_ACTIVE_ARCH = YES; 368 | SDKROOT = iphoneos; 369 | TARGETED_DEVICE_FAMILY = "1,2"; 370 | }; 371 | name = Debug; 372 | }; 373 | 97C147041CF9000F007C117D /* Release */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ALWAYS_SEARCH_USER_PATHS = NO; 377 | CLANG_ANALYZER_NONNULL = YES; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 383 | CLANG_WARN_BOOL_CONVERSION = YES; 384 | CLANG_WARN_COMMA = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 387 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 388 | CLANG_WARN_EMPTY_BODY = YES; 389 | CLANG_WARN_ENUM_CONVERSION = YES; 390 | CLANG_WARN_INFINITE_RECURSION = YES; 391 | CLANG_WARN_INT_CONVERSION = YES; 392 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 393 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 394 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 395 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 396 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 397 | CLANG_WARN_STRICT_PROTOTYPES = YES; 398 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | SDKROOT = iphoneos; 417 | SUPPORTED_PLATFORMS = iphoneos; 418 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 419 | TARGETED_DEVICE_FAMILY = "1,2"; 420 | VALIDATE_PRODUCT = YES; 421 | }; 422 | name = Release; 423 | }; 424 | 97C147061CF9000F007C117D /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 427 | buildSettings = { 428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 429 | CLANG_ENABLE_MODULES = YES; 430 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 431 | ENABLE_BITCODE = NO; 432 | FRAMEWORK_SEARCH_PATHS = ( 433 | "$(inherited)", 434 | "$(PROJECT_DIR)/Flutter", 435 | ); 436 | INFOPLIST_FILE = Runner/Info.plist; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 438 | LIBRARY_SEARCH_PATHS = ( 439 | "$(inherited)", 440 | "$(PROJECT_DIR)/Flutter", 441 | ); 442 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 445 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 446 | SWIFT_VERSION = 5.0; 447 | VERSIONING_SYSTEM = "apple-generic"; 448 | }; 449 | name = Debug; 450 | }; 451 | 97C147071CF9000F007C117D /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 454 | buildSettings = { 455 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 456 | CLANG_ENABLE_MODULES = YES; 457 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 458 | ENABLE_BITCODE = NO; 459 | FRAMEWORK_SEARCH_PATHS = ( 460 | "$(inherited)", 461 | "$(PROJECT_DIR)/Flutter", 462 | ); 463 | INFOPLIST_FILE = Runner/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 465 | LIBRARY_SEARCH_PATHS = ( 466 | "$(inherited)", 467 | "$(PROJECT_DIR)/Flutter", 468 | ); 469 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 472 | SWIFT_VERSION = 5.0; 473 | VERSIONING_SYSTEM = "apple-generic"; 474 | }; 475 | name = Release; 476 | }; 477 | /* End XCBuildConfiguration section */ 478 | 479 | /* Begin XCConfigurationList section */ 480 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 97C147031CF9000F007C117D /* Debug */, 484 | 97C147041CF9000F007C117D /* Release */, 485 | 249021D3217E4FDB00AE95B9 /* Profile */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 97C147061CF9000F007C117D /* Debug */, 494 | 97C147071CF9000F007C117D /* Release */, 495 | 249021D4217E4FDB00AE95B9 /* Profile */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | /* End XCConfigurationList section */ 501 | }; 502 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 503 | } 504 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/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/dropdownBelowTest.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | const Duration _kDropdownMenuDuration = Duration(milliseconds: 300); 6 | 7 | /// *[_kDropdownMenuDuration] which is dropdown button's drop down duration. 8 | 9 | const double _kMenuItemHeight = 48.0; 10 | 11 | /// *[_kMenuItemHeight] which is dropdown item's default height 12 | 13 | const EdgeInsets _kMenuItemPadding = EdgeInsets.symmetric(horizontal: 16.0); 14 | 15 | /// *[_kMenuItemPadding] which is dropdown item's default padding. 16 | 17 | const EdgeInsets _kAlignedMenuMargin = EdgeInsets.zero; 18 | 19 | /// *[_kAlignedMenuMargin] which is dropdown item's default margin 20 | 21 | const EdgeInsetsGeometry _kUnalignedMenuMargin = EdgeInsetsDirectional.only(start: 16.0, end: 24.0); 22 | 23 | /// *[_kAlignedMenuMargin] which is dropdown item's default margin for align rule. 24 | 25 | class _DropdownMenuPainter extends CustomPainter { 26 | _DropdownMenuPainter({ 27 | this.color, 28 | this.elevation, 29 | this.selectedIndex, 30 | this.resize, 31 | }) : _painter = BoxDecoration(color: color, borderRadius: BorderRadius.circular(5), boxShadow: kElevationToShadow[elevation!]).createBoxPainter(), 32 | super(repaint: resize); 33 | 34 | final Color? color; 35 | 36 | /// *[color] which is dropdown item's background color 37 | 38 | final int? elevation; 39 | 40 | /// *[elevation] which is dropdown whole item list's elevation 41 | 42 | final int? selectedIndex; 43 | 44 | /// *[selectedIndex] which is selected item's index 45 | 46 | final Animation? resize; 47 | 48 | /// *[resize] which is resized animation value 49 | 50 | final BoxPainter _painter; 51 | 52 | /// *[_painter] which is panting value 53 | 54 | @override 55 | void paint(Canvas canvas, Size size) { 56 | final double selectedItemOffset = selectedIndex! * _kMenuItemHeight + kMaterialListPadding.top; 57 | final Tween top = Tween( 58 | begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight), 59 | end: 0.0, 60 | ); 61 | 62 | final Tween bottom = Tween( 63 | begin: (top.begin! + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height), 64 | end: size.height, 65 | ); 66 | 67 | final Rect rect = Rect.fromLTRB(0.0, top.evaluate(resize!), size.width, bottom.evaluate(resize!)); 68 | 69 | _painter.paint(canvas, rect.topLeft, ImageConfiguration(size: rect.size)); 70 | } 71 | 72 | @override 73 | bool shouldRepaint(_DropdownMenuPainter oldPainter) { 74 | return oldPainter.color != color || oldPainter.elevation != elevation || oldPainter.selectedIndex != selectedIndex || oldPainter.resize != resize; 75 | } 76 | } 77 | 78 | class _DropdownScrollBehavior extends ScrollBehavior { 79 | const _DropdownScrollBehavior(); 80 | 81 | @override 82 | TargetPlatform getPlatform(BuildContext context) => Theme.of(context).platform; 83 | 84 | @override 85 | Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) => child; 86 | 87 | @override 88 | ScrollPhysics getScrollPhysics(BuildContext context) => const ClampingScrollPhysics(); 89 | } 90 | 91 | class _DropdownMenu extends StatefulWidget { 92 | const _DropdownMenu({ 93 | Key? key, 94 | this.padding, 95 | this.dropdownColor, 96 | this.route, 97 | }) : super(key: key); 98 | 99 | final _DropdownRoute? route; 100 | 101 | final EdgeInsets? padding; 102 | final Color? dropdownColor; 103 | 104 | @override 105 | _DropdownMenuState createState() => _DropdownMenuState(); 106 | } 107 | 108 | class _DropdownMenuState extends State<_DropdownMenu> { 109 | late CurvedAnimation _fadeOpacity; 110 | CurvedAnimation? _resize; 111 | 112 | @override 113 | void initState() { 114 | super.initState(); 115 | _fadeOpacity = CurvedAnimation( 116 | parent: widget.route!.animation!, 117 | curve: Interval(0.0, 0.25), 118 | reverseCurve: Interval(0.75, 1.0), 119 | ); 120 | _resize = CurvedAnimation( 121 | parent: widget.route!.animation!, 122 | curve: Interval(0.25, 0.5), 123 | reverseCurve: Threshold(0.0), 124 | ); 125 | } 126 | 127 | @override 128 | Widget build(BuildContext context) { 129 | final MaterialLocalizations localizations = MaterialLocalizations.of(context); 130 | final _DropdownRoute route = widget.route!; 131 | final double unit = 0.5 / (route.items!.length + 1.5); 132 | final List children = []; 133 | for (int itemIndex = 0; itemIndex < route.items!.length; ++itemIndex) { 134 | CurvedAnimation opacity; 135 | if (itemIndex == route.selectedIndex) { 136 | opacity = CurvedAnimation(parent: route.animation!, curve: Threshold(0.0)); 137 | } else { 138 | final double start = (0.5 + (itemIndex + 1) * unit).clamp(0.0, 1.0); 139 | final double end = (start + 1.5 * unit).clamp(0.0, 1.0); 140 | opacity = CurvedAnimation(parent: route.animation!, curve: Interval(start, end)); 141 | } 142 | children.add(FadeTransition( 143 | opacity: opacity, 144 | child: InkWell( 145 | child: Container( 146 | padding: widget.padding, 147 | child: route.items![itemIndex], 148 | ), 149 | onTap: () => Navigator.pop( 150 | context, 151 | _DropdownRouteResult(route.items![itemIndex].value), 152 | ), 153 | ), 154 | )); 155 | } 156 | 157 | return FadeTransition( 158 | opacity: _fadeOpacity, 159 | child: CustomPaint( 160 | painter: _DropdownMenuPainter( 161 | color: widget.dropdownColor ?? Colors.white, 162 | elevation: 2, 163 | selectedIndex: route.selectedIndex, 164 | resize: _resize, 165 | ), 166 | child: Semantics( 167 | scopesRoute: true, 168 | namesRoute: true, 169 | explicitChildNodes: true, 170 | label: localizations.popupMenuLabel, 171 | child: Material( 172 | type: MaterialType.transparency, 173 | textStyle: route.style, 174 | child: ScrollConfiguration( 175 | behavior: _DropdownScrollBehavior(), 176 | child: Scrollbar( 177 | child: ListView( 178 | controller: widget.route!.scrollController, 179 | padding: kMaterialListPadding, 180 | itemExtent: _kMenuItemHeight, 181 | shrinkWrap: true, 182 | children: children, 183 | ), 184 | ), 185 | ), 186 | ), 187 | ), 188 | ), 189 | ); 190 | } 191 | } 192 | 193 | class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { 194 | _DropdownMenuRouteLayout({ 195 | required this.buttonRect, 196 | required this.menuTop, 197 | required this.menuHeight, 198 | required this.textDirection, 199 | required this.itemWidth, 200 | }); 201 | 202 | final double? itemWidth; 203 | 204 | /// dropdown button's each item's width 205 | 206 | final Rect? buttonRect; 207 | 208 | /// dropdown button's whole list rect. 209 | 210 | final double menuTop; 211 | final double menuHeight; 212 | final TextDirection textDirection; 213 | 214 | @override 215 | BoxConstraints getConstraintsForChild(BoxConstraints constraints) { 216 | final double maxHeight = math.max(0.0, constraints.maxHeight - 2 * _kMenuItemHeight); 217 | return BoxConstraints( 218 | minWidth: itemWidth!, 219 | maxWidth: itemWidth!, 220 | minHeight: 0.0, 221 | maxHeight: maxHeight, 222 | ); 223 | } 224 | 225 | @override 226 | Offset getPositionForChild(Size size, Size childSize) { 227 | assert(() { 228 | final Rect container = Offset.zero & size; 229 | if (container.intersect(buttonRect!) == buttonRect) { 230 | assert(menuTop >= 0.0); 231 | assert(menuTop + menuHeight <= size.height); 232 | } 233 | return true; 234 | }()); 235 | late double left; 236 | switch (textDirection) { 237 | case TextDirection.rtl: 238 | left = buttonRect!.right.clamp(0.0, size.width) - childSize.width; 239 | break; 240 | case TextDirection.ltr: 241 | left = buttonRect!.left.clamp(0.0, size.width - childSize.width); 242 | break; 243 | } 244 | return Offset(left + 15, menuTop + 13); 245 | } 246 | 247 | @override 248 | bool shouldRelayout(_DropdownMenuRouteLayout oldDelegate) { 249 | return buttonRect != oldDelegate.buttonRect || 250 | menuTop != oldDelegate.menuTop || 251 | menuHeight != oldDelegate.menuHeight || 252 | textDirection != oldDelegate.textDirection; 253 | } 254 | } 255 | 256 | class _DropdownRouteResult { 257 | const _DropdownRouteResult(this.result); 258 | 259 | final T result; 260 | 261 | @override 262 | bool operator ==(dynamic other) { 263 | if (other is! _DropdownRouteResult) return false; 264 | final _DropdownRouteResult typedOther = other; 265 | return result == typedOther.result; 266 | } 267 | 268 | @override 269 | int get hashCode => result.hashCode; 270 | } 271 | 272 | class _DropdownRoute extends PopupRoute<_DropdownRouteResult> { 273 | _DropdownRoute({ 274 | this.items, 275 | this.itemWidth, 276 | this.padding, 277 | this.buttonRect, 278 | this.selectedIndex, 279 | this.dropdownColor, 280 | this.elevation = 8, 281 | required this.style, 282 | this.barrierLabel, 283 | }); 284 | 285 | final List>? items; 286 | 287 | /// item's list 288 | 289 | final EdgeInsetsGeometry? padding; 290 | 291 | final Rect? buttonRect; 292 | 293 | /// buttons rectangle 294 | 295 | final int? selectedIndex; 296 | 297 | /// selected Index 298 | 299 | final int elevation; 300 | 301 | final TextStyle style; 302 | final Color? dropdownColor; 303 | 304 | ScrollController? scrollController; 305 | 306 | @override 307 | Duration get transitionDuration => _kDropdownMenuDuration; 308 | 309 | @override 310 | bool get barrierDismissible => true; 311 | 312 | @override 313 | Color? get barrierColor => null; 314 | 315 | @override 316 | final String? barrierLabel; 317 | 318 | final double? itemWidth; 319 | 320 | @override 321 | Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) { 322 | assert(debugCheckHasDirectionality(context)); 323 | final double screenHeight = MediaQuery.of(context).size.height; 324 | final double maxMenuHeight = screenHeight - 2.0 * _kMenuItemHeight; 325 | final double preferredMenuHeight = (items!.length * _kMenuItemHeight) + kMaterialListPadding.vertical; 326 | final double menuHeight = math.min(maxMenuHeight, preferredMenuHeight); 327 | 328 | final double buttonTop = buttonRect!.top; 329 | final double selectedItemOffset = selectedIndex! * _kMenuItemHeight + kMaterialListPadding.top; 330 | double menuTop = (buttonTop - selectedItemOffset) - (_kMenuItemHeight - buttonRect!.height) / 2.0; 331 | const double topPreferredLimit = _kMenuItemHeight; 332 | if (menuTop < topPreferredLimit) { 333 | menuTop = math.min(buttonTop, topPreferredLimit); 334 | } 335 | double bottom = menuTop + menuHeight; 336 | final double bottomPreferredLimit = screenHeight - _kMenuItemHeight; 337 | if (bottom > bottomPreferredLimit) { 338 | bottom = math.max(buttonTop + _kMenuItemHeight, bottomPreferredLimit); 339 | menuTop = bottom - menuHeight; 340 | } 341 | 342 | if (scrollController == null) { 343 | double scrollOffset = 0.0; 344 | if (preferredMenuHeight > maxMenuHeight) { 345 | scrollOffset = selectedItemOffset - (buttonTop - menuTop); 346 | } 347 | scrollController = ScrollController(initialScrollOffset: scrollOffset); 348 | } 349 | 350 | final TextDirection textDirection = Directionality.of(context); 351 | Widget menu = _DropdownMenu( 352 | route: this, 353 | padding: padding!.resolve(textDirection), 354 | dropdownColor: dropdownColor, 355 | ); 356 | 357 | return MediaQuery.removePadding( 358 | context: context, 359 | removeTop: true, 360 | removeBottom: true, 361 | removeLeft: true, 362 | removeRight: true, 363 | child: Builder( 364 | builder: (BuildContext context) { 365 | return CustomSingleChildLayout( 366 | delegate: _DropdownMenuRouteLayout( 367 | itemWidth: itemWidth, 368 | buttonRect: buttonRect, 369 | menuTop: menuTop, 370 | menuHeight: menuHeight, 371 | textDirection: textDirection, 372 | ), 373 | child: menu, 374 | ); 375 | }, 376 | ), 377 | ); 378 | } 379 | 380 | void _dismiss() { 381 | navigator?.removeRoute(this); 382 | } 383 | } 384 | 385 | class DropdownBelow extends StatefulWidget { 386 | DropdownBelow( 387 | {Key? key, 388 | required this.items, 389 | this.value, 390 | this.hint, 391 | this.itemTextstyle, 392 | this.itemWidth, 393 | this.boxHeight, 394 | this.boxWidth, 395 | this.boxPadding, 396 | this.boxTextstyle, 397 | required this.onChanged, 398 | this.onBoxStateChanged, 399 | this.boxDecoration, 400 | this.dropdownColor, 401 | this.elevation = 8, 402 | this.isDense = false, 403 | this.icon}) 404 | : assert(value == null || items.where((DropdownMenuItem item) => item.value == value).length == 1), 405 | super(key: key); 406 | 407 | final List> items; 408 | 409 | /// item list 410 | 411 | final T? value; 412 | 413 | /// printed value 414 | 415 | final double? itemWidth; 416 | 417 | /// each item width 418 | 419 | final double? boxHeight; 420 | 421 | /// whole box height 422 | 423 | final double? boxWidth; 424 | 425 | /// whole box width 426 | 427 | final EdgeInsetsGeometry? boxPadding; 428 | 429 | /// default box padding 430 | 431 | final TextStyle? boxTextstyle; 432 | 433 | /// default box text style 434 | 435 | final TextStyle? itemTextstyle; 436 | 437 | /// default each item's text style 438 | 439 | final Widget? hint; 440 | 441 | /// default value that printed which has no touch to dropdown widget. 442 | 443 | final ValueChanged onChanged; 444 | final Function(bool)? onBoxStateChanged; 445 | 446 | /// click item then, function triggered 447 | 448 | final BoxDecoration? boxDecoration; 449 | 450 | /// box decoration like border, borderRadius, color 451 | 452 | final int elevation; 453 | 454 | final Widget? icon; 455 | 456 | final bool isDense; 457 | 458 | /// The background color of the dropdown. 459 | /// 460 | /// If it is not provided, the theme's [Colors.white] will be used 461 | /// instead. 462 | final Color? dropdownColor; 463 | 464 | @override 465 | _DropdownBelowState createState() => _DropdownBelowState(); 466 | } 467 | 468 | class _DropdownBelowState extends State> with WidgetsBindingObserver { 469 | int? _selectedIndex; 470 | _DropdownRoute? _dropdownRoute; 471 | 472 | @override 473 | void initState() { 474 | super.initState(); 475 | WidgetsBinding.instance!.addObserver(this); 476 | } 477 | 478 | @override 479 | void dispose() { 480 | WidgetsBinding.instance!.removeObserver(this); 481 | _removeDropdownRoute(); 482 | super.dispose(); 483 | } 484 | 485 | @override 486 | void didChangeMetrics() { 487 | // _removeDropdownRoute(); 488 | } 489 | 490 | void _removeDropdownRoute() { 491 | _dropdownRoute?._dismiss(); 492 | _dropdownRoute = null; 493 | } 494 | 495 | @override 496 | void didUpdateWidget(DropdownBelow oldWidget) { 497 | super.didUpdateWidget(oldWidget); 498 | _updateSelectedIndex(); 499 | } 500 | 501 | void _updateSelectedIndex() { 502 | assert(widget.value == null || widget.items.where((DropdownMenuItem item) => item.value == widget.value).length == 1); 503 | _selectedIndex = null; 504 | for (int itemIndex = 0; itemIndex < widget.items.length; itemIndex++) { 505 | if (widget.items[itemIndex].value == widget.value) { 506 | _selectedIndex = itemIndex; 507 | return; 508 | } 509 | } 510 | } 511 | 512 | void _handleTap() { 513 | final RenderBox itemBox = context.findRenderObject() as RenderBox; 514 | final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size; 515 | final TextDirection textDirection = Directionality.of(context); 516 | final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown ? _kAlignedMenuMargin : _kUnalignedMenuMargin; 517 | 518 | _dropdownRoute = _DropdownRoute( 519 | itemWidth: widget.itemWidth, 520 | items: widget.items, 521 | buttonRect: menuMargin.resolve(textDirection).inflateRect(itemRect), 522 | padding: _kMenuItemPadding.resolve(textDirection), 523 | selectedIndex: -1, 524 | elevation: widget.elevation, 525 | dropdownColor: widget.dropdownColor, 526 | style: widget.itemTextstyle ?? TextStyle(), 527 | barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, 528 | ); 529 | 530 | Navigator.push(context, _dropdownRoute!).then((_DropdownRouteResult? newValue) { 531 | if (!mounted || newValue == null) { 532 | return; 533 | } 534 | widget.onChanged(newValue.result); 535 | }); 536 | } 537 | 538 | @override 539 | Widget build(BuildContext context) { 540 | assert(debugCheckHasMaterial(context)); 541 | 542 | final List items = List.from(widget.items); 543 | int? hintIndex; 544 | if (widget.hint != null) { 545 | hintIndex = items.length; 546 | items.add(DefaultTextStyle( 547 | style: widget.boxTextstyle!, 548 | child: IgnorePointer( 549 | child: widget.hint, 550 | ignoringSemantics: false, 551 | ), 552 | )); 553 | } 554 | 555 | Widget result = DefaultTextStyle( 556 | style: widget.boxTextstyle!, 557 | child: Container( 558 | decoration: widget.boxDecoration, 559 | width: widget.boxWidth, 560 | padding: widget.boxPadding, 561 | height: widget.boxHeight, 562 | child: widget.icon == null 563 | ? IndexedStack( 564 | index: _selectedIndex ?? hintIndex, 565 | alignment: AlignmentDirectional.centerStart, 566 | children: items, 567 | ) 568 | : Row( 569 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 570 | mainAxisSize: MainAxisSize.min, 571 | children: [ 572 | Expanded( 573 | child: IndexedStack( 574 | index: _selectedIndex ?? hintIndex, 575 | alignment: AlignmentDirectional.centerStart, 576 | children: items, 577 | ), 578 | ), 579 | widget.icon ?? Container() 580 | ], 581 | ), 582 | ), 583 | ); 584 | 585 | if (!DropdownButtonHideUnderline.at(context)) { 586 | result = Stack( 587 | children: [ 588 | result, 589 | Positioned( 590 | left: 0.0, 591 | right: 0.0, 592 | bottom: 0, 593 | child: Container( 594 | height: 0.0, 595 | ), 596 | ), 597 | ], 598 | ); 599 | } 600 | 601 | return Semantics( 602 | button: true, 603 | child: GestureDetector(onTap: _handleTap, behavior: HitTestBehavior.opaque, child: result), 604 | ); 605 | } 606 | } -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/dropdownBelowTest.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void main() { 5 | runApp(MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | return MaterialApp( 12 | title: 'Flutter Demo', 13 | theme: ThemeData( 14 | primarySwatch: Colors.blue, 15 | visualDensity: VisualDensity.adaptivePlatformDensity, 16 | ), 17 | home: MyHomePage(), 18 | ); 19 | } 20 | } 21 | 22 | class MyHomePage extends StatefulWidget { 23 | @override 24 | _MyHomePageState createState() => _MyHomePageState(); 25 | } 26 | 27 | class _MyHomePageState extends State { 28 | List _testList = [ 29 | {'no': 1, 'keyword': 'blue'}, 30 | {'no': 2, 'keyword': 'black'}, 31 | {'no': 3, 'keyword': 'red'} 32 | ]; 33 | List> _dropdownTestItems = []; 34 | var _selectedTest; 35 | 36 | @override 37 | void initState() { 38 | _dropdownTestItems = buildDropdownTestItems(_testList); 39 | super.initState(); 40 | } 41 | 42 | @override 43 | void dispose() { 44 | super.dispose(); 45 | } 46 | 47 | List> buildDropdownTestItems(List _testList) { 48 | List> items = []; 49 | for (var i in _testList) { 50 | items.add( 51 | DropdownMenuItem( 52 | value: i, 53 | child: Text(i['keyword']), 54 | ), 55 | ); 56 | } 57 | return items; 58 | } 59 | 60 | onChangeDropdownTests(selectedTest) { 61 | print(selectedTest); 62 | setState(() { 63 | _selectedTest = selectedTest; 64 | }); 65 | } 66 | 67 | @override 68 | Widget build(BuildContext context) { 69 | return Scaffold( 70 | backgroundColor: Colors.black12, 71 | appBar: AppBar( 72 | title: Text('dropdown below example'), 73 | ), 74 | body: Center( 75 | child: Column( 76 | children: [ 77 | DropdownBelow( 78 | itemWidth: 100, 79 | itemTextstyle: TextStyle( 80 | fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black), 81 | boxTextstyle: TextStyle( 82 | fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white54), 83 | boxPadding: EdgeInsets.fromLTRB(13, 12, 13, 12), 84 | boxWidth: 100, 85 | boxHeight: 45, 86 | boxDecoration: BoxDecoration( 87 | color: Colors.transparent, 88 | border: Border.all(width: 1, color: Colors.white54)), 89 | icon: Icon( 90 | Icons.settings, 91 | color: Colors.white54, 92 | ), 93 | hint: Text('Filter'), 94 | value: _selectedTest, 95 | items: _dropdownTestItems, 96 | onChanged: onChangeDropdownTests, 97 | ), 98 | TextField(), 99 | ElevatedButton( 100 | onPressed: () { 101 | 102 | FocusScopeNode currentFocus = FocusScope.of(context); 103 | 104 | if (!currentFocus.hasPrimaryFocus) { 105 | currentFocus.unfocus(); 106 | } 107 | }, 108 | child: Text('focus out button')) 109 | ], 110 | ) 111 | ) 112 | ); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /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.8.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" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.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" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 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" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.10" 77 | meta: 78 | dependency: transitive 79 | description: 80 | name: meta 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.7.0" 84 | path: 85 | dependency: transitive 86 | description: 87 | name: path 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.8.0" 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.1" 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" 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" 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" 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" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "0.4.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" 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" 152 | sdks: 153 | dart: ">=2.12.0 <3.0.0" 154 | -------------------------------------------------------------------------------- /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 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | version: 1.0.0+1 18 | 19 | environment: 20 | sdk: '>=2.12.0 <3.0.0' 21 | 22 | dependencies: 23 | flutter: 24 | sdk: flutter 25 | 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 | 32 | dev_dependencies: 33 | flutter_test: 34 | sdk: flutter 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://dart.dev/tools/pub/pubspec 38 | 39 | # The following section is specific to Flutter. 40 | flutter: 41 | 42 | # The following line ensures that the Material Icons font is 43 | # included with your application, so that you can use the icons in 44 | # the material Icons class. 45 | uses-material-design: true 46 | 47 | # To add assets to your application, add an assets section, like this: 48 | # assets: 49 | # - images/a_dot_burr.jpeg 50 | # - images/a_dot_ham.jpeg 51 | 52 | # An image asset can refer to one or more resolution-specific "variants", see 53 | # https://flutter.dev/assets-and-images/#resolution-aware. 54 | 55 | # For details regarding adding assets from package dependencies, see 56 | # https://flutter.dev/assets-and-images/#from-packages 57 | 58 | # To add custom fonts to your application, add a fonts section here, 59 | # in this "flutter" section. Each entry in this list should have a 60 | # "family" key with the font family name, and a "fonts" key with a 61 | # list giving the asset and other descriptors for the font. For 62 | # example: 63 | # fonts: 64 | # - family: Schyler 65 | # fonts: 66 | # - asset: fonts/Schyler-Regular.ttf 67 | # - asset: fonts/Schyler-Italic.ttf 68 | # style: italic 69 | # - family: Trajan Pro 70 | # fonts: 71 | # - asset: fonts/TrajanPro.ttf 72 | # - asset: fonts/TrajanPro_Bold.ttf 73 | # weight: 700 74 | # 75 | # For details regarding fonts from package dependencies, 76 | # see https://flutter.dev/custom-fonts/#from-packages 77 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/dropdown_below.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer_const_constructors 2 | 3 | library dropdown_below; 4 | 5 | import 'dart:math' as math; 6 | 7 | import 'package:flutter/material.dart'; 8 | 9 | const Duration _kDropdownMenuDuration = Duration(milliseconds: 300); 10 | 11 | /// *[_kDropdownMenuDuration] which is dropdown button's drop down duration. 12 | 13 | const double _kMenuItemHeight = 48.0; 14 | 15 | /// *[_kMenuItemHeight] which is dropdown item's default height 16 | 17 | const EdgeInsets _kMenuItemPadding = EdgeInsets.symmetric(horizontal: 16.0); 18 | 19 | /// *[_kMenuItemPadding] which is dropdown item's default padding. 20 | 21 | const EdgeInsets _kAlignedMenuMargin = EdgeInsets.zero; 22 | 23 | /// *[_kAlignedMenuMargin] which is dropdown item's default margin 24 | 25 | const EdgeInsetsGeometry _kUnalignedMenuMargin = EdgeInsetsDirectional.only(start: 16.0, end: 24.0); 26 | 27 | /// *[_kAlignedMenuMargin] which is dropdown item's default margin for align rule. 28 | 29 | class _DropdownMenuPainter extends CustomPainter { 30 | _DropdownMenuPainter({ 31 | this.color, 32 | this.elevation, 33 | this.selectedIndex, 34 | this.resize, 35 | }) : _painter = BoxDecoration(color: color, borderRadius: BorderRadius.circular(5), boxShadow: kElevationToShadow[elevation!]).createBoxPainter(), 36 | super(repaint: resize); 37 | 38 | final Color? color; 39 | 40 | /// *[color] which is dropdown item's background color 41 | 42 | final int? elevation; 43 | 44 | /// *[elevation] which is dropdown whole item list's elevation 45 | 46 | final int? selectedIndex; 47 | 48 | /// *[selectedIndex] which is selected item's index 49 | 50 | final Animation? resize; 51 | 52 | /// *[resize] which is resized animation value 53 | 54 | final BoxPainter _painter; 55 | 56 | /// *[_painter] which is panting value 57 | 58 | @override 59 | void paint(Canvas canvas, Size size) { 60 | final double selectedItemOffset = selectedIndex! * _kMenuItemHeight + kMaterialListPadding.top; 61 | final Tween top = Tween( 62 | begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight), 63 | end: 0.0, 64 | ); 65 | 66 | final Tween bottom = Tween( 67 | begin: (top.begin! + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height), 68 | end: size.height, 69 | ); 70 | 71 | final Rect rect = Rect.fromLTRB(0.0, top.evaluate(resize!), size.width, bottom.evaluate(resize!)); 72 | 73 | _painter.paint(canvas, rect.topLeft, ImageConfiguration(size: rect.size)); 74 | } 75 | 76 | @override 77 | bool shouldRepaint(_DropdownMenuPainter oldPainter) { 78 | return oldPainter.color != color || oldPainter.elevation != elevation || oldPainter.selectedIndex != selectedIndex || oldPainter.resize != resize; 79 | } 80 | } 81 | 82 | class _DropdownScrollBehavior extends ScrollBehavior { 83 | const _DropdownScrollBehavior(); 84 | 85 | @override 86 | TargetPlatform getPlatform(BuildContext context) => Theme.of(context).platform; 87 | 88 | @override 89 | Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) => child; 90 | 91 | @override 92 | ScrollPhysics getScrollPhysics(BuildContext context) => const ClampingScrollPhysics(); 93 | } 94 | 95 | class _DropdownMenu extends StatefulWidget { 96 | const _DropdownMenu({ 97 | Key? key, 98 | this.padding, 99 | this.dropdownColor, 100 | this.route, 101 | }) : super(key: key); 102 | 103 | final _DropdownRoute? route; 104 | 105 | final EdgeInsets? padding; 106 | final Color? dropdownColor; 107 | 108 | @override 109 | _DropdownMenuState createState() => _DropdownMenuState(); 110 | } 111 | 112 | class _DropdownMenuState extends State<_DropdownMenu> { 113 | late CurvedAnimation _fadeOpacity; 114 | CurvedAnimation? _resize; 115 | 116 | @override 117 | void initState() { 118 | super.initState(); 119 | _fadeOpacity = CurvedAnimation( 120 | parent: widget.route!.animation!, 121 | curve: Interval(0.0, 0.25), 122 | reverseCurve: Interval(0.75, 1.0), 123 | ); 124 | _resize = CurvedAnimation( 125 | parent: widget.route!.animation!, 126 | curve: Interval(0.25, 0.5), 127 | reverseCurve: Threshold(0.0), 128 | ); 129 | } 130 | 131 | @override 132 | Widget build(BuildContext context) { 133 | final MaterialLocalizations localizations = MaterialLocalizations.of(context); 134 | final _DropdownRoute route = widget.route!; 135 | final double unit = 0.5 / (route.items!.length + 1.5); 136 | final List children = []; 137 | for (int itemIndex = 0; itemIndex < route.items!.length; ++itemIndex) { 138 | CurvedAnimation opacity; 139 | if (itemIndex == route.selectedIndex) { 140 | opacity = CurvedAnimation(parent: route.animation!, curve: Threshold(0.0)); 141 | } else { 142 | final double start = (0.5 + (itemIndex + 1) * unit).clamp(0.0, 1.0); 143 | final double end = (start + 1.5 * unit).clamp(0.0, 1.0); 144 | opacity = CurvedAnimation(parent: route.animation!, curve: Interval(start, end)); 145 | } 146 | children.add(FadeTransition( 147 | opacity: opacity, 148 | child: InkWell( 149 | child: Container( 150 | padding: widget.padding, 151 | child: route.items![itemIndex], 152 | ), 153 | onTap: () => Navigator.pop( 154 | context, 155 | _DropdownRouteResult(route.items![itemIndex].value), 156 | ), 157 | ), 158 | )); 159 | } 160 | 161 | return FadeTransition( 162 | opacity: _fadeOpacity, 163 | child: CustomPaint( 164 | painter: _DropdownMenuPainter( 165 | color: widget.dropdownColor ?? Colors.white, 166 | elevation: 2, 167 | selectedIndex: route.selectedIndex, 168 | resize: _resize, 169 | ), 170 | child: Semantics( 171 | scopesRoute: true, 172 | namesRoute: true, 173 | explicitChildNodes: true, 174 | label: localizations.popupMenuLabel, 175 | child: Material( 176 | type: MaterialType.transparency, 177 | textStyle: route.style, 178 | child: ScrollConfiguration( 179 | behavior: _DropdownScrollBehavior(), 180 | child: Scrollbar( 181 | child: ListView( 182 | controller: widget.route!.scrollController, 183 | padding: kMaterialListPadding, 184 | itemExtent: _kMenuItemHeight, 185 | shrinkWrap: true, 186 | children: children, 187 | ), 188 | ), 189 | ), 190 | ), 191 | ), 192 | ), 193 | ); 194 | } 195 | } 196 | 197 | class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { 198 | _DropdownMenuRouteLayout({ 199 | required this.buttonRect, 200 | required this.menuTop, 201 | required this.menuHeight, 202 | required this.textDirection, 203 | required this.itemWidth, 204 | }); 205 | 206 | final double? itemWidth; 207 | 208 | /// dropdown button's each item's width 209 | 210 | final Rect? buttonRect; 211 | 212 | /// dropdown button's whole list rect. 213 | 214 | final double menuTop; 215 | final double menuHeight; 216 | final TextDirection textDirection; 217 | 218 | @override 219 | BoxConstraints getConstraintsForChild(BoxConstraints constraints) { 220 | final double maxHeight = math.max(0.0, constraints.maxHeight - 2 * _kMenuItemHeight); 221 | return BoxConstraints( 222 | minWidth: itemWidth!, 223 | maxWidth: itemWidth!, 224 | minHeight: 0.0, 225 | maxHeight: maxHeight, 226 | ); 227 | } 228 | 229 | @override 230 | Offset getPositionForChild(Size size, Size childSize) { 231 | assert(() { 232 | final Rect container = Offset.zero & size; 233 | if (container.intersect(buttonRect!) == buttonRect) { 234 | assert(menuTop >= 0.0); 235 | assert(menuTop + menuHeight <= size.height); 236 | } 237 | return true; 238 | }()); 239 | late double left; 240 | switch (textDirection) { 241 | case TextDirection.rtl: 242 | left = buttonRect!.right.clamp(0.0, size.width) - childSize.width; 243 | break; 244 | case TextDirection.ltr: 245 | left = buttonRect!.left.clamp(0.0, size.width - childSize.width); 246 | break; 247 | } 248 | return Offset(left + 15, menuTop + 13); 249 | } 250 | 251 | @override 252 | bool shouldRelayout(_DropdownMenuRouteLayout oldDelegate) { 253 | return buttonRect != oldDelegate.buttonRect || 254 | menuTop != oldDelegate.menuTop || 255 | menuHeight != oldDelegate.menuHeight || 256 | textDirection != oldDelegate.textDirection; 257 | } 258 | } 259 | 260 | class _DropdownRouteResult { 261 | const _DropdownRouteResult(this.result); 262 | 263 | final T result; 264 | 265 | @override 266 | bool operator ==(dynamic other) { 267 | if (other is! _DropdownRouteResult) return false; 268 | final _DropdownRouteResult typedOther = other; 269 | return result == typedOther.result; 270 | } 271 | 272 | @override 273 | int get hashCode => result.hashCode; 274 | } 275 | 276 | class _DropdownRoute extends PopupRoute<_DropdownRouteResult> { 277 | _DropdownRoute({ 278 | this.items, 279 | this.itemWidth, 280 | this.padding, 281 | this.buttonRect, 282 | this.selectedIndex, 283 | this.dropdownColor, 284 | this.elevation = 8, 285 | required this.style, 286 | this.barrierLabel, 287 | }); 288 | 289 | final List>? items; 290 | 291 | /// item's list 292 | 293 | final EdgeInsetsGeometry? padding; 294 | 295 | final Rect? buttonRect; 296 | 297 | /// buttons rectangle 298 | 299 | final int? selectedIndex; 300 | 301 | /// selected Index 302 | 303 | final int elevation; 304 | 305 | final TextStyle style; 306 | final Color? dropdownColor; 307 | 308 | ScrollController? scrollController; 309 | 310 | @override 311 | Duration get transitionDuration => _kDropdownMenuDuration; 312 | 313 | @override 314 | bool get barrierDismissible => true; 315 | 316 | @override 317 | Color? get barrierColor => null; 318 | 319 | @override 320 | final String? barrierLabel; 321 | 322 | final double? itemWidth; 323 | 324 | @override 325 | Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) { 326 | assert(debugCheckHasDirectionality(context)); 327 | final double screenHeight = MediaQuery.of(context).size.height; 328 | final double maxMenuHeight = screenHeight - 2.0 * _kMenuItemHeight; 329 | final double preferredMenuHeight = (items!.length * _kMenuItemHeight) + kMaterialListPadding.vertical; 330 | final double menuHeight = math.min(maxMenuHeight, preferredMenuHeight); 331 | 332 | final double buttonTop = buttonRect!.top; 333 | final double selectedItemOffset = selectedIndex! * _kMenuItemHeight + kMaterialListPadding.top; 334 | double menuTop = (buttonTop - selectedItemOffset) - (_kMenuItemHeight - buttonRect!.height) / 2.0; 335 | const double topPreferredLimit = _kMenuItemHeight; 336 | if (menuTop < topPreferredLimit) { 337 | menuTop = math.min(buttonTop, topPreferredLimit); 338 | } 339 | double bottom = menuTop + menuHeight; 340 | final double bottomPreferredLimit = screenHeight - _kMenuItemHeight; 341 | if (bottom > bottomPreferredLimit) { 342 | bottom = math.max(buttonTop + _kMenuItemHeight, bottomPreferredLimit); 343 | menuTop = bottom - menuHeight; 344 | } 345 | 346 | if (scrollController == null) { 347 | double scrollOffset = 0.0; 348 | if (preferredMenuHeight > maxMenuHeight) { 349 | scrollOffset = selectedItemOffset - (buttonTop - menuTop); 350 | } 351 | scrollController = ScrollController(initialScrollOffset: scrollOffset); 352 | } 353 | 354 | final TextDirection textDirection = Directionality.of(context); 355 | Widget menu = _DropdownMenu( 356 | route: this, 357 | padding: padding!.resolve(textDirection), 358 | dropdownColor: dropdownColor, 359 | ); 360 | 361 | return MediaQuery.removePadding( 362 | context: context, 363 | removeTop: true, 364 | removeBottom: true, 365 | removeLeft: true, 366 | removeRight: true, 367 | child: Builder( 368 | builder: (BuildContext context) { 369 | return CustomSingleChildLayout( 370 | delegate: _DropdownMenuRouteLayout( 371 | itemWidth: itemWidth, 372 | buttonRect: buttonRect, 373 | menuTop: menuTop, 374 | menuHeight: menuHeight, 375 | textDirection: textDirection, 376 | ), 377 | child: menu, 378 | ); 379 | }, 380 | ), 381 | ); 382 | } 383 | 384 | void _dismiss() { 385 | navigator?.removeRoute(this); 386 | } 387 | } 388 | 389 | class DropdownBelow extends StatefulWidget { 390 | DropdownBelow( 391 | {Key? key, 392 | required this.items, 393 | this.value, 394 | this.hint, 395 | this.itemTextstyle, 396 | this.itemWidth, 397 | this.boxHeight, 398 | this.boxWidth, 399 | this.boxPadding, 400 | this.boxTextstyle, 401 | required this.onChanged, 402 | this.onBoxStateChanged, 403 | this.boxDecoration, 404 | this.dropdownColor, 405 | this.elevation = 8, 406 | this.isDense = false, 407 | this.icon}) 408 | : assert(value == null || items.where((DropdownMenuItem item) => item.value == value).length == 1), 409 | super(key: key); 410 | 411 | final List> items; 412 | 413 | /// item list 414 | 415 | final T? value; 416 | 417 | /// printed value 418 | 419 | final double? itemWidth; 420 | 421 | /// each item width 422 | 423 | final double? boxHeight; 424 | 425 | /// whole box height 426 | 427 | final double? boxWidth; 428 | 429 | /// whole box width 430 | 431 | final EdgeInsetsGeometry? boxPadding; 432 | 433 | /// default box padding 434 | 435 | final TextStyle? boxTextstyle; 436 | 437 | /// default box text style 438 | 439 | final TextStyle? itemTextstyle; 440 | 441 | /// default each item's text style 442 | 443 | final Widget? hint; 444 | 445 | /// default value that printed which has no touch to dropdown widget. 446 | 447 | final ValueChanged onChanged; 448 | final Function(bool)? onBoxStateChanged; 449 | 450 | /// click item then, function triggered 451 | 452 | final BoxDecoration? boxDecoration; 453 | 454 | /// box decoration like border, borderRadius, color 455 | 456 | final int elevation; 457 | 458 | final Widget? icon; 459 | 460 | final bool isDense; 461 | 462 | /// The background color of the dropdown. 463 | /// 464 | /// If it is not provided, the theme's [Colors.white] will be used 465 | /// instead. 466 | final Color? dropdownColor; 467 | 468 | @override 469 | _DropdownBelowState createState() => _DropdownBelowState(); 470 | } 471 | 472 | class _DropdownBelowState extends State> with WidgetsBindingObserver { 473 | int? _selectedIndex; 474 | _DropdownRoute? _dropdownRoute; 475 | 476 | @override 477 | void initState() { 478 | super.initState(); 479 | WidgetsBinding.instance!.addObserver(this); 480 | } 481 | 482 | @override 483 | void dispose() { 484 | WidgetsBinding.instance!.removeObserver(this); 485 | _removeDropdownRoute(); 486 | super.dispose(); 487 | } 488 | 489 | @override 490 | void didChangeMetrics() { 491 | // _removeDropdownRoute(); 492 | } 493 | 494 | void _removeDropdownRoute() { 495 | _dropdownRoute?._dismiss(); 496 | _dropdownRoute = null; 497 | } 498 | 499 | @override 500 | void didUpdateWidget(DropdownBelow oldWidget) { 501 | super.didUpdateWidget(oldWidget); 502 | _updateSelectedIndex(); 503 | } 504 | 505 | void _updateSelectedIndex() { 506 | assert(widget.value == null || widget.items.where((DropdownMenuItem item) => item.value == widget.value).length == 1); 507 | _selectedIndex = null; 508 | for (int itemIndex = 0; itemIndex < widget.items.length; itemIndex++) { 509 | if (widget.items[itemIndex].value == widget.value) { 510 | _selectedIndex = itemIndex; 511 | return; 512 | } 513 | } 514 | } 515 | 516 | void _handleTap() { 517 | final RenderBox itemBox = context.findRenderObject() as RenderBox; 518 | final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size; 519 | final TextDirection textDirection = Directionality.of(context); 520 | final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown ? _kAlignedMenuMargin : _kUnalignedMenuMargin; 521 | 522 | _dropdownRoute = _DropdownRoute( 523 | itemWidth: widget.itemWidth, 524 | items: widget.items, 525 | buttonRect: menuMargin.resolve(textDirection).inflateRect(itemRect), 526 | padding: _kMenuItemPadding.resolve(textDirection), 527 | selectedIndex: -1, 528 | elevation: widget.elevation, 529 | dropdownColor: widget.dropdownColor, 530 | style: widget.itemTextstyle ?? TextStyle(), 531 | barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, 532 | ); 533 | 534 | Navigator.push(context, _dropdownRoute!).then((_DropdownRouteResult? newValue) { 535 | if (!mounted || newValue == null) { 536 | return; 537 | } 538 | widget.onChanged(newValue.result); 539 | }); 540 | } 541 | 542 | @override 543 | Widget build(BuildContext context) { 544 | assert(debugCheckHasMaterial(context)); 545 | 546 | final List items = List.from(widget.items); 547 | int? hintIndex; 548 | if (widget.hint != null) { 549 | hintIndex = items.length; 550 | items.add(DefaultTextStyle( 551 | style: widget.boxTextstyle!, 552 | child: IgnorePointer( 553 | child: widget.hint, 554 | ignoringSemantics: false, 555 | ), 556 | )); 557 | } 558 | 559 | Widget result = DefaultTextStyle( 560 | style: widget.boxTextstyle!, 561 | child: Container( 562 | decoration: widget.boxDecoration, 563 | width: widget.boxWidth, 564 | padding: widget.boxPadding, 565 | height: widget.boxHeight, 566 | child: widget.icon == null 567 | ? IndexedStack( 568 | index: _selectedIndex ?? hintIndex, 569 | alignment: AlignmentDirectional.centerStart, 570 | children: items, 571 | ) 572 | : Row( 573 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 574 | mainAxisSize: MainAxisSize.min, 575 | children: [ 576 | Expanded( 577 | child: IndexedStack( 578 | index: _selectedIndex ?? hintIndex, 579 | alignment: AlignmentDirectional.centerStart, 580 | children: items, 581 | ), 582 | ), 583 | widget.icon ?? Container() 584 | ], 585 | ), 586 | ), 587 | ); 588 | 589 | if (!DropdownButtonHideUnderline.at(context)) { 590 | result = Stack( 591 | children: [ 592 | result, 593 | Positioned( 594 | left: 0.0, 595 | right: 0.0, 596 | bottom: 0, 597 | child: Container( 598 | height: 0.0, 599 | ), 600 | ), 601 | ], 602 | ); 603 | } 604 | 605 | return Semantics( 606 | button: true, 607 | child: GestureDetector(onTap: _handleTap, behavior: HitTestBehavior.opaque, child: result), 608 | ); 609 | } 610 | } 611 | -------------------------------------------------------------------------------- /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.8.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" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.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" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 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" 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" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.7.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.8.0" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "1.8.1" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "1.10.0" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "2.1.0" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.1.0" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.2.0" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "0.4.2" 131 | typed_data: 132 | dependency: transitive 133 | description: 134 | name: typed_data 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.3.0" 138 | vector_math: 139 | dependency: transitive 140 | description: 141 | name: vector_math 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.1.0" 145 | sdks: 146 | dart: ">=2.12.0 <3.0.0" 147 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dropdown_below 2 | description: flutter custom dropdown box. Develeoper can customize many options for there taste. It can be huge advantage for dropdown ux 3 | version: 1.0.3 4 | homepage: https://github.com/whatamelon/flutter_dropdown_below 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | flutter_test: 15 | sdk: flutter 16 | 17 | 18 | flutter: 19 | uses-material-design: true 20 | -------------------------------------------------------------------------------- /test/dropdown_below_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | import 'package:dropdown_below/dropdown_below.dart'; 4 | 5 | void main() { 6 | test('adds one to input values', () {}); 7 | } 8 | -------------------------------------------------------------------------------- /test1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whatamelon/flutter_dropdown_below/bdded750eeccbe419b87d67c3b6d191428d61c51/test1.gif --------------------------------------------------------------------------------