├── example ├── android │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── app │ │ ├── src │ │ │ └── main │ │ │ │ ├── res │ │ │ │ ├── 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 │ │ │ │ └── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.java │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── .gitignore │ ├── settings.gradle │ ├── build.gradle │ ├── gradlew.bat │ └── gradlew ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── AppDelegate.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── 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-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── WorkspaceSettings.xcsettings │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ └── .gitignore ├── images │ ├── body.jpg │ └── header.jpg ├── .gitignore ├── README.md ├── .metadata ├── .idea │ ├── runConfigurations │ │ └── main_dart.xml │ ├── libraries │ │ ├── Flutter_for_Android.xml │ │ └── Dart_SDK.xml │ ├── modules.xml │ └── workspace.xml ├── lib │ ├── basic_menu.dart │ ├── header_menu.dart │ ├── config.dart │ ├── fix_menu.dart │ └── main.dart ├── example.iml ├── test │ └── widget_test.dart ├── example_android.iml ├── pubspec.yaml └── pubspec.lock ├── test └── dropdown_menu_test.dart ├── .gitignore ├── ROADMAP.md ├── .idea ├── vcs.xml ├── libraries │ ├── Flutter_Plugins.xml │ ├── Dart_SDK.xml │ └── Dart_Packages.xml ├── modules.xml ├── misc.xml ├── codeStyles │ └── Project.xml └── workspace.xml ├── lib ├── dropdown_menu.dart └── _src │ ├── dropdown_sliver.dart │ ├── dropdown_templates.dart │ ├── dropdown_header.dart │ ├── drapdown_common.dart │ ├── dropdown_list_menu.dart │ └── dropdown_menu.dart ├── CHANGELOG.md ├── README.md ├── LICENSE ├── flutter_dropdown_menu.iml ├── pubspec.yaml └── pubspec.lock /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /test/dropdown_menu_test.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | void main() { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/images/body.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/images/body.jpg -------------------------------------------------------------------------------- /example/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/images/header.jpg -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .flutter-plugins 10 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | ios/.generated/ 9 | ios/Flutter/Generated.xcconfig 10 | ios/Runner/GeneratedPluginRegistrant.* 11 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | V1 2 | - [x] Animation menu show and hide 3 | - [x] Animation switch style 4 | - [x] Controller 5 | - [ ] More animation switch style 6 | - [ ] Fix bugs 7 | - [ ] Unit tests 8 | 9 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our online 8 | [documentation](https://flutter.io/). 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.class 3 | .gradle 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | GeneratedPluginRegistrant.java 11 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/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/best-flutter/flutter_dropdown_menu/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/best-flutter/flutter_dropdown_menu/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /.idea/libraries/Flutter_Plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/dropdown_menu.dart: -------------------------------------------------------------------------------- 1 | library flutter_dropdown_menu; 2 | 3 | export '_src/dropdown_menu.dart'; 4 | export '_src/dropdown_list_menu.dart'; 5 | export '_src/drapdown_common.dart'; 6 | export '_src/dropdown_header.dart'; 7 | export '_src/dropdown_sliver.dart'; 8 | export '_src/dropdown_templates.dart'; 9 | -------------------------------------------------------------------------------- /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-4.1-all.zip 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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: 44b7e7d3f42f050a79712daab253af06e9daf530 8 | channel: beta 9 | -------------------------------------------------------------------------------- /example/.idea/runConfigurations/main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/.idea/libraries/Flutter_for_Android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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/lib/basic_menu.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | class BasicMenu extends StatefulWidget{ 5 | @override 6 | State createState() { 7 | return new _BasicMenuState(); 8 | } 9 | 10 | } 11 | 12 | class _BasicMenuState extends State{ 13 | @override 14 | Widget build(BuildContext context) { 15 | return new Container( 16 | 17 | ); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /example/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/lib/header_menu.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | class HeaderMenu extends StatefulWidget{ 5 | @override 6 | State createState() { 7 | return new _HeaderMenuState(); 8 | } 9 | 10 | } 11 | 12 | class _HeaderMenuState extends State{ 13 | @override 14 | Widget build(BuildContext context) { 15 | return new Container( 16 | 17 | ); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.0] - [2018/05/25] 2 | * Basic Usage 3 | 4 | ## [1.0.1] - [2018/05/25] 5 | * Fix index change bug when switchStyle=DropdownMenuShowHideSwitchStyle.directHideAnimationShow 6 | * Add index change swith animation style : DropdownMenuShowHideSwitchStyle.directHideDirectShow 7 | 8 | ## [1.1.0] - [2018/05/27] 9 | * Add fix-head DorpdownMenu 10 | * Add scrollview DropdownMenu 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.example; 2 | 3 | import android.os.Bundle; 4 | 5 | import io.flutter.app.FlutterActivity; 6 | import io.flutter.plugins.GeneratedPluginRegistrant; 7 | 8 | public class MainActivity extends FlutterActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | GeneratedPluginRegistrant.registerWith(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 7 | [GeneratedPluginRegistrant registerWithRegistry:self]; 8 | // Override point for customization after application launch. 9 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.0.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/app.flx 37 | /Flutter/app.zip 38 | /Flutter/flutter_assets/ 39 | /Flutter/App.framework 40 | /Flutter/Flutter.framework 41 | /Flutter/Generated.xcconfig 42 | /ServiceDefinitions.json 43 | 44 | Pods/ 45 | -------------------------------------------------------------------------------- /lib/_src/dropdown_sliver.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DropdownSliverChildBuilderDelegate 4 | extends SliverPersistentHeaderDelegate { 5 | WidgetBuilder builder; 6 | 7 | DropdownSliverChildBuilderDelegate({this.builder}) : assert(builder != null); 8 | 9 | @override 10 | Widget build( 11 | BuildContext context, double shrinkOffset, bool overlapsContent) { 12 | return builder(context); 13 | } 14 | 15 | // TODO: implement maxExtent 16 | @override 17 | double get maxExtent => 46.0; 18 | 19 | // TODO: implement minExtent 20 | @override 21 | double get minExtent => 46.0; 22 | 23 | @override 24 | bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) { 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_dropdown_menu 2 | 3 | A dropdown menu for Flutter. 4 | 5 | ## Showcase 6 | 7 | ![showcase](https://github.com/jzoom/images/raw/master/dropdown_menu.gif) 8 | **** 9 | ![showcase](https://github.com/jzoom/images/raw/master/dropdown_menu1.gif) 10 | 11 | ![showcase](https://github.com/jzoom/images/raw/master/dropdown_menu2.gif) 12 | 13 | 14 | ## Table of contents 15 | 16 | 17 | ## Installion 18 | 19 | ``` 20 | dropdown_menu: ^1.1.0 21 | ``` 22 | 23 | ## Build simple list menu 24 | ## Build tree menu 25 | ## Build custom menu 26 | 27 | 28 | 29 | # How to use 30 | 31 | ``` 32 | 33 | 34 | ``` 35 | 36 | 37 | ## Examples 38 | 39 | >see[main.dart](https://github.com/jzoom/flutter_dropdown_menu/blob/master/example/lib/main.dart) 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | UIRequiredDeviceCapabilities 24 | 25 | arm64 26 | 27 | MinimumOSVersion 28 | 8.0 29 | 30 | 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Xueliang Ren 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/_src/dropdown_templates.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'package:dropdown_menu/_src/dropdown_header.dart'; 6 | 7 | Widget buildCheckItem(BuildContext context, dynamic data, bool selected) { 8 | return new Padding( 9 | padding: new EdgeInsets.all(10.0), 10 | child: new Row( 11 | children: [ 12 | new Text( 13 | defaultGetItemLabel(data), 14 | style: selected 15 | ? new TextStyle( 16 | fontSize: 14.0, 17 | color: Theme.of(context).primaryColor, 18 | fontWeight: FontWeight.w400) 19 | : new TextStyle(fontSize: 14.0), 20 | ), 21 | new Expanded( 22 | child: new Align( 23 | alignment: Alignment.centerRight, 24 | child: selected 25 | ? new Icon( 26 | Icons.check, 27 | color: Theme.of(context).primaryColor, 28 | ) 29 | : null, 30 | )), 31 | ], 32 | )); 33 | } 34 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter 3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to 4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties 5 | // are correct. 6 | 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | import 'package:example/main.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(new MyApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /example/.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /flutter_dropdown_menu.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | -------------------------------------------------------------------------------- /example/example_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/.idea/workspace.xml: -------------------------------------------------------------------------------- 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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /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/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 | apply plugin: 'com.android.application' 15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 16 | 17 | android { 18 | compileSdkVersion 27 19 | 20 | lintOptions { 21 | disable 'InvalidPackage' 22 | } 23 | 24 | defaultConfig { 25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 26 | applicationId "com.example.example" 27 | minSdkVersion 16 28 | targetSdkVersion 27 29 | versionCode 1 30 | versionName "1.0" 31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 32 | } 33 | 34 | buildTypes { 35 | release { 36 | // TODO: Add your own signing config for the release build. 37 | // Signing with the debug keys for now, so `flutter run --release` works. 38 | signingConfig signingConfigs.debug 39 | } 40 | } 41 | } 42 | 43 | flutter { 44 | source '../..' 45 | } 46 | 47 | dependencies { 48 | testImplementation 'junit:junit:4.12' 49 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 51 | } 52 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | arm64 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dropdown_menu 2 | description: A dropdown menu for flutter. 3 | version: 1.1.1 4 | author: JZoom 5 | homepage: https://github.com/jzoom/flutter_dropdown_menu 6 | 7 | 8 | 9 | 10 | environment: 11 | sdk: ">=2.0.0-dev.48.0 <3.0.0" 12 | flutter: ">=0.1.4 <3.0.0" 13 | 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://www.dartlang.org/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # To add assets to your package, add an assets section, like this: 30 | # assets: 31 | # - images/a_dot_burr.jpeg 32 | # - images/a_dot_ham.jpeg 33 | # 34 | # For details regarding assets in packages, see 35 | # https://flutter.io/assets-and-images/#from-packages 36 | # 37 | # An image asset can refer to one or more resolution-specific "variants", see 38 | # https://flutter.io/assets-and-images/#resolution-aware. 39 | 40 | # To add custom fonts to your package, add a fonts section here, 41 | # in this "flutter" section. Each entry in this list should have a 42 | # "family" key with the font family name, and a "fonts" key with a 43 | # list giving the asset and other descriptors for the font. For 44 | # example: 45 | # fonts: 46 | # - family: Schyler 47 | # fonts: 48 | # - asset: fonts/Schyler-Regular.ttf 49 | # - asset: fonts/Schyler-Italic.ttf 50 | # style: italic 51 | # - family: Trajan Pro 52 | # fonts: 53 | # - asset: fonts/TrajanPro.ttf 54 | # - asset: fonts/TrajanPro_Bold.ttf 55 | # weight: 700 56 | # 57 | # For details regarding fonts in packages, see 58 | # https://flutter.io/custom-fonts/#from-packages 59 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | dependencies: 5 | flutter: 6 | sdk: flutter 7 | 8 | # The following adds the Cupertino Icons font to your application. 9 | # Use with the CupertinoIcons class for iOS style icons. 10 | cupertino_icons: ^0.1.0 11 | 12 | async_loader: ^0.1.0 13 | 14 | dropdown_menu : 15 | path : ../ 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | 21 | 22 | # For information on the generic Dart part of this file, see the 23 | # following page: https://www.dartlang.org/tools/pub/pubspec 24 | 25 | # The following section is specific to Flutter. 26 | flutter: 27 | 28 | # The following line ensures that the Material Icons font is 29 | # included with your application, so that you can use the icons in 30 | # the material Icons class. 31 | uses-material-design: true 32 | 33 | assets: 34 | - images/header.jpg 35 | - images/body.jpg 36 | # To add assets to your application, add an assets section, like this: 37 | # assets: 38 | # - images/a_dot_burr.jpeg 39 | # - images/a_dot_ham.jpeg 40 | 41 | # An image asset can refer to one or more resolution-specific "variants", see 42 | # https://flutter.io/assets-and-images/#resolution-aware. 43 | 44 | # For details regarding adding assets from package dependencies, see 45 | # https://flutter.io/assets-and-images/#from-packages 46 | 47 | # To add custom fonts to your application, add a fonts section here, 48 | # in this "flutter" section. Each entry in this list should have a 49 | # "family" key with the font family name, and a "fonts" key with a 50 | # list giving the asset and other descriptors for the font. For 51 | # example: 52 | # fonts: 53 | # - family: Schyler 54 | # fonts: 55 | # - asset: fonts/Schyler-Regular.ttf 56 | # - asset: fonts/Schyler-Italic.ttf 57 | # style: italic 58 | # - family: Trajan Pro 59 | # fonts: 60 | # - asset: fonts/TrajanPro.ttf 61 | # - asset: fonts/TrajanPro_Bold.ttf 62 | # weight: 700 63 | # 64 | # For details regarding fonts from package dependencies, 65 | # see https://flutter.io/custom-fonts/#from-packages 66 | -------------------------------------------------------------------------------- /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/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.0.8" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.0.4" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.14.11" 32 | flutter: 33 | dependency: "direct main" 34 | description: flutter 35 | source: sdk 36 | version: "0.0.0" 37 | flutter_test: 38 | dependency: "direct dev" 39 | description: flutter 40 | source: sdk 41 | version: "0.0.0" 42 | matcher: 43 | dependency: transitive 44 | description: 45 | name: matcher 46 | url: "https://pub.flutter-io.cn" 47 | source: hosted 48 | version: "0.12.3+1" 49 | meta: 50 | dependency: transitive 51 | description: 52 | name: meta 53 | url: "https://pub.flutter-io.cn" 54 | source: hosted 55 | version: "1.1.6" 56 | path: 57 | dependency: transitive 58 | description: 59 | name: path 60 | url: "https://pub.flutter-io.cn" 61 | source: hosted 62 | version: "1.6.2" 63 | quiver: 64 | dependency: transitive 65 | description: 66 | name: quiver 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "2.0.1" 70 | sky_engine: 71 | dependency: transitive 72 | description: flutter 73 | source: sdk 74 | version: "0.0.99" 75 | source_span: 76 | dependency: transitive 77 | description: 78 | name: source_span 79 | url: "https://pub.flutter-io.cn" 80 | source: hosted 81 | version: "1.4.1" 82 | stack_trace: 83 | dependency: transitive 84 | description: 85 | name: stack_trace 86 | url: "https://pub.flutter-io.cn" 87 | source: hosted 88 | version: "1.9.3" 89 | stream_channel: 90 | dependency: transitive 91 | description: 92 | name: stream_channel 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "1.6.8" 96 | string_scanner: 97 | dependency: transitive 98 | description: 99 | name: string_scanner 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.0.4" 103 | term_glyph: 104 | dependency: transitive 105 | description: 106 | name: term_glyph 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "1.0.1" 110 | test_api: 111 | dependency: transitive 112 | description: 113 | name: test_api 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "0.2.1" 117 | typed_data: 118 | dependency: transitive 119 | description: 120 | name: typed_data 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.1.6" 124 | vector_math: 125 | dependency: transitive 126 | description: 127 | name: vector_math 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "2.0.8" 131 | sdks: 132 | dart: ">=2.0.0 <3.0.0" 133 | flutter: ">=0.1.4 <3.0.0" 134 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.0.8" 11 | async_loader: 12 | dependency: "direct main" 13 | description: 14 | name: async_loader 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "0.1.2" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.0.4" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.1.2" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.14.11" 39 | cupertino_icons: 40 | dependency: "direct main" 41 | description: 42 | name: cupertino_icons 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "0.1.2" 46 | dropdown_menu: 47 | dependency: "direct main" 48 | description: 49 | path: ".." 50 | relative: true 51 | source: path 52 | version: "1.1.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.flutter-io.cn" 68 | source: hosted 69 | version: "0.12.3+1" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "1.1.6" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "1.6.2" 84 | quiver: 85 | dependency: transitive 86 | description: 87 | name: quiver 88 | url: "https://pub.flutter-io.cn" 89 | source: hosted 90 | version: "2.0.1" 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.flutter-io.cn" 101 | source: hosted 102 | version: "1.4.1" 103 | stack_trace: 104 | dependency: transitive 105 | description: 106 | name: stack_trace 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "1.9.3" 110 | stream_channel: 111 | dependency: transitive 112 | description: 113 | name: stream_channel 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.6.8" 117 | string_scanner: 118 | dependency: transitive 119 | description: 120 | name: string_scanner 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.0.4" 124 | term_glyph: 125 | dependency: transitive 126 | description: 127 | name: term_glyph 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "1.0.1" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "0.2.1" 138 | typed_data: 139 | dependency: transitive 140 | description: 141 | name: typed_data 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "1.1.6" 145 | vector_math: 146 | dependency: transitive 147 | description: 148 | name: vector_math 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "2.0.8" 152 | sdks: 153 | dart: ">=2.0.0 <3.0.0" 154 | flutter: ">=0.1.4 <3.0.0" 155 | -------------------------------------------------------------------------------- /lib/_src/dropdown_header.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | 4 | import 'package:flutter/material.dart'; 5 | 6 | import 'package:dropdown_menu/_src/drapdown_common.dart'; 7 | 8 | typedef void DropdownMenuHeadTapCallback(int index); 9 | 10 | typedef String GetItemLabel(dynamic data); 11 | 12 | String defaultGetItemLabel(dynamic data) { 13 | if (data is String) return data; 14 | return data["title"]; 15 | } 16 | 17 | class DropdownHeader extends DropdownWidget { 18 | final List titles; 19 | final int activeIndex; 20 | final DropdownMenuHeadTapCallback onTap; 21 | 22 | /// height of menu 23 | final double height; 24 | 25 | /// get label callback 26 | final GetItemLabel getItemLabel; 27 | 28 | DropdownHeader( 29 | {@required this.titles, 30 | this.activeIndex, 31 | DropdownMenuController controller, 32 | this.onTap, 33 | Key key, 34 | this.height: 46.0, 35 | GetItemLabel getItemLabel}) 36 | : getItemLabel = getItemLabel ?? defaultGetItemLabel, 37 | assert(titles != null && titles.length > 0), 38 | super(key: key, controller: controller); 39 | 40 | @override 41 | DropdownState createState() { 42 | return new _DropdownHeaderState(); 43 | } 44 | } 45 | 46 | class _DropdownHeaderState extends DropdownState { 47 | Widget buildItem( 48 | BuildContext context, dynamic title, bool selected, int index) { 49 | final Color primaryColor = Theme.of(context).primaryColor; 50 | final Color unselectedColor = Theme.of(context).unselectedWidgetColor; 51 | final GetItemLabel getItemLabel = widget.getItemLabel; 52 | 53 | return new GestureDetector( 54 | behavior: HitTestBehavior.opaque, 55 | child: new Padding( 56 | padding: new EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), 57 | child: new DecoratedBox( 58 | decoration: new BoxDecoration( 59 | border: new Border(left: Divider.createBorderSide(context))), 60 | child: new Center( 61 | child: new Row( 62 | mainAxisSize: MainAxisSize.min, 63 | children: [ 64 | new Text( 65 | getItemLabel(title), 66 | style: new TextStyle( 67 | color: selected ? primaryColor : unselectedColor, 68 | ), 69 | ), 70 | new Icon( 71 | selected ? Icons.arrow_drop_up : Icons.arrow_drop_down, 72 | color: selected ? primaryColor : unselectedColor, 73 | ) 74 | ])))), 75 | onTap: () { 76 | if (widget.onTap != null) { 77 | widget.onTap(index); 78 | 79 | return; 80 | } 81 | if (controller != null) { 82 | if (_activeIndex == index) { 83 | controller.hide(); 84 | setState(() { 85 | _activeIndex = null; 86 | }); 87 | } else { 88 | controller.show(index); 89 | } 90 | } 91 | //widget.onTap(index); 92 | }, 93 | ); 94 | } 95 | 96 | int _activeIndex; 97 | List _titles; 98 | 99 | @override 100 | Widget build(BuildContext context) { 101 | List list = []; 102 | 103 | final int activeIndex = _activeIndex; 104 | final List titles = _titles; 105 | final double height = widget.height; 106 | 107 | for (int i = 0, c = widget.titles.length; i < c; ++i) { 108 | list.add(buildItem(context, titles[i], i == activeIndex, i)); 109 | } 110 | 111 | list = list.map((Widget widget) { 112 | return new Expanded( 113 | child: widget, 114 | ); 115 | }).toList(); 116 | 117 | final Decoration decoration = new BoxDecoration( 118 | border: new Border( 119 | bottom: Divider.createBorderSide(context), 120 | ), 121 | ); 122 | 123 | return new DecoratedBox( 124 | decoration: decoration, 125 | child: new SizedBox( 126 | child: new Row( 127 | children: list, 128 | ), 129 | height: height), 130 | ); 131 | } 132 | 133 | @override 134 | void initState() { 135 | _titles = widget.titles; 136 | super.initState(); 137 | } 138 | 139 | @override 140 | void onEvent(DropdownEvent event) { 141 | switch (event) { 142 | case DropdownEvent.SELECT: 143 | { 144 | if (_activeIndex == null) return; 145 | 146 | setState(() { 147 | _activeIndex = null; 148 | String label = widget.getItemLabel(controller.data); 149 | _titles[controller.menuIndex] = label; 150 | }); 151 | } 152 | break; 153 | case DropdownEvent.HIDE: 154 | { 155 | if (_activeIndex == null) return; 156 | setState(() { 157 | _activeIndex = null; 158 | }); 159 | } 160 | break; 161 | case DropdownEvent.ACTIVE: 162 | { 163 | if (_activeIndex == controller.menuIndex) return; 164 | setState(() { 165 | _activeIndex = controller.menuIndex; 166 | }); 167 | } 168 | break; 169 | } 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/_src/drapdown_common.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | enum DropdownEvent { 5 | // the menu will hide 6 | HIDE, 7 | 8 | // the menu will active 9 | ACTIVE, 10 | 11 | // user has click menu item 12 | SELECT 13 | } 14 | 15 | class DropdownMenuController extends ChangeNotifier { 16 | //user interaction event name 17 | DropdownEvent event; 18 | 19 | // whitch menu index 20 | int menuIndex; 21 | 22 | /// selected data 23 | dynamic data; 24 | 25 | /// item index in list [TreeMenuList] or [MenuList] or your custom menu 26 | int index; 27 | 28 | /// item index in sublist of [TreeMenuList] 29 | int subIndex; 30 | 31 | void hide() { 32 | event = DropdownEvent.HIDE; 33 | notifyListeners(); 34 | } 35 | 36 | void show(int index) { 37 | event = DropdownEvent.ACTIVE; 38 | menuIndex = index; 39 | notifyListeners(); 40 | } 41 | 42 | void select(dynamic data, {int index, int subIndex}) { 43 | event = DropdownEvent.SELECT; 44 | this.data = data; 45 | this.index = index; 46 | this.subIndex = subIndex; 47 | notifyListeners(); 48 | } 49 | } 50 | 51 | typedef DropdownMenuOnSelected( 52 | {int menuIndex, int index, int subIndex, dynamic data}); 53 | 54 | class DefaultDropdownMenuController extends StatefulWidget { 55 | const DefaultDropdownMenuController({ 56 | Key key, 57 | @required this.child, 58 | this.onSelected, 59 | }) : super(key: key); 60 | 61 | final Widget child; 62 | 63 | final DropdownMenuOnSelected onSelected; 64 | 65 | static DropdownMenuController of(BuildContext context) { 66 | final _DropdownMenuControllerScope scope = 67 | context.inheritFromWidgetOfExactType(_DropdownMenuControllerScope); 68 | return scope?.controller; 69 | } 70 | 71 | @override 72 | _DefaultDropdownMenuControllerState createState() => 73 | new _DefaultDropdownMenuControllerState(); 74 | } 75 | 76 | class _DefaultDropdownMenuControllerState 77 | extends State 78 | with SingleTickerProviderStateMixin { 79 | DropdownMenuController _controller; 80 | 81 | @override 82 | void initState() { 83 | super.initState(); 84 | _controller = new DropdownMenuController(); 85 | _controller.addListener(_onController); 86 | } 87 | 88 | void _onController() { 89 | switch (_controller.event) { 90 | case DropdownEvent.SELECT: 91 | { 92 | //通知widget 93 | if (widget.onSelected == null) return; 94 | widget.onSelected( 95 | data: _controller.data, 96 | menuIndex: _controller.menuIndex, 97 | index: _controller.index, 98 | subIndex: _controller.subIndex); 99 | } 100 | break; 101 | case DropdownEvent.ACTIVE: 102 | break; 103 | case DropdownEvent.HIDE: 104 | break; 105 | } 106 | } 107 | 108 | @override 109 | void dispose() { 110 | _controller.removeListener(_onController); 111 | _controller.dispose(); 112 | super.dispose(); 113 | } 114 | 115 | @override 116 | Widget build(BuildContext context) { 117 | return new _DropdownMenuControllerScope( 118 | controller: _controller, 119 | enabled: TickerMode.of(context), 120 | child: widget.child, 121 | ); 122 | } 123 | } 124 | 125 | class _DropdownMenuControllerScope extends InheritedWidget { 126 | const _DropdownMenuControllerScope( 127 | {Key key, this.controller, this.enabled, Widget child}) 128 | : super(key: key, child: child); 129 | 130 | final DropdownMenuController controller; 131 | final bool enabled; 132 | 133 | @override 134 | bool updateShouldNotify(_DropdownMenuControllerScope old) { 135 | return enabled != old.enabled || controller != old.controller; 136 | } 137 | } 138 | 139 | abstract class DropdownWidget extends StatefulWidget { 140 | final DropdownMenuController controller; 141 | 142 | DropdownWidget({Key key, this.controller}) : super(key: key); 143 | 144 | @override 145 | DropdownState createState(); 146 | } 147 | 148 | abstract class DropdownState extends State { 149 | DropdownMenuController controller; 150 | 151 | @override 152 | void dispose() { 153 | if (controller != null) { 154 | controller.removeListener(_onController); 155 | } 156 | super.dispose(); 157 | } 158 | 159 | @override 160 | void didChangeDependencies() { 161 | if (controller == null) { 162 | if (widget.controller == null) { 163 | controller = DefaultDropdownMenuController.of(context); 164 | } else { 165 | controller = widget.controller; 166 | } 167 | 168 | if (controller != null) { 169 | controller.addListener(_onController); 170 | } 171 | } 172 | super.didChangeDependencies(); 173 | } 174 | 175 | @override 176 | void didUpdateWidget(T oldWidget) { 177 | if (widget.controller != null) { 178 | if (controller != null) { 179 | controller.removeListener(_onController); 180 | } 181 | controller = widget.controller; 182 | controller.addListener(_onController); 183 | } 184 | 185 | super.didUpdateWidget(oldWidget); 186 | } 187 | 188 | void _onController() { 189 | onEvent(controller.event); 190 | } 191 | 192 | void onEvent(DropdownEvent event); 193 | } 194 | 195 | class DropdownMenuBuilder { 196 | final WidgetBuilder builder; 197 | final double height; 198 | 199 | //if height == null , use [DropdownMenu.maxMenuHeight] 200 | DropdownMenuBuilder({@required this.builder, this.height}) 201 | : assert(builder != null); 202 | } 203 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /example/lib/config.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'dart:convert'; 3 | 4 | const List> ORDERS = [ 5 | {"title": "综合排序"}, 6 | {"title": "好评优先"}, 7 | {"title": "离我最近"}, 8 | {"title": "人气最高"}, 9 | ]; 10 | 11 | const int ORDER_INDEX = 0; 12 | 13 | const List> TYPES = [ 14 | {"title": "全部", "id": 0}, 15 | {"title": "甜点饮品", "id": 1}, 16 | {"title": "生日蛋糕", "id": 2}, 17 | {"title": "火锅", "id": 3}, 18 | {"title": "自助餐", "id": 4}, 19 | {"title": "小吃", "id": 5}, 20 | {"title": "快餐", "id": 6}, 21 | {"title": "日韩料理", "id": 7}, 22 | {"title": "西餐", "id": 8}, 23 | {"title": "聚餐", "id": 9}, 24 | {"title": "烧烤", "id": 10}, 25 | {"title": "川菜", "id": 11}, 26 | {"title": "江浙菜", "id": 12}, 27 | {"title": "东北菜", "id": 13}, 28 | {"title": "蒙餐", "id": 14}, 29 | {"title": "新疆菜", "id": 15}, 30 | ]; 31 | 32 | const int TYPE_INDEX = 2; 33 | 34 | const List> BUSINESS_CYCLE = [ 35 | { 36 | "title": "附近", 37 | "children": [ 38 | {"title": "附近", "distance": 500}, 39 | {"title": "1km", "distance": 1000}, 40 | {"title": "2km", "distance": 2000} 41 | ] 42 | }, 43 | { 44 | "title": "推荐商圈", 45 | "children": [ 46 | {"title": "中山路", "count": 326}, 47 | {"title": "万达广场", "count": 100}, 48 | {"title": "瑞景", "count": 50} 49 | ] 50 | }, 51 | { 52 | "title": "附近", 53 | "children": [ 54 | {"title": "附近", "distance": 500}, 55 | {"title": "1km", "distance": 1000}, 56 | {"title": "2km", "distance": 2000} 57 | ] 58 | }, 59 | { 60 | "title": "附近", 61 | "children": [ 62 | {"title": "附近", "distance": 500}, 63 | {"title": "1km", "distance": 1000}, 64 | {"title": "2km", "distance": 2000} 65 | ] 66 | }, 67 | ]; 68 | 69 | String FOOD_JSON = 70 | '[{"title":"力体","children":[{"title":"传声织","count":810},{"title":"分队什","count":463},{"title":"且工","count":325},{"title":"清局","count":899},{"title":"代老克","count":325},{"title":"持连回","count":14},{"title":"改层听","count":470},{"title":"存比","count":908},{"title":"热土米","count":333},{"title":"水发","count":58},{"title":"制见","count":28},{"title":"取化无","count":469},{"title":"记有何","count":503},{"title":"亲公何","count":930},{"title":"步业要","count":885}]},{"title":"建易外","children":[{"title":"生观真","count":207},{"title":"音代","count":425},{"title":"族王资","count":205},{"title":"圆传统","count":791},{"title":"些任","count":141},{"title":"程即走","count":163},{"title":"各七","count":65},{"title":"院此格","count":314},{"title":"支及","count":726},{"title":"别题","count":524},{"title":"低去到","count":706},{"title":"般将","count":13},{"title":"西南","count":189},{"title":"状南制","count":335},{"title":"调油","count":90},{"title":"听从没","count":33},{"title":"电求什","count":88}]},{"title":"非先算","children":[{"title":"严状","count":108},{"title":"查增","count":634},{"title":"号备","count":304},{"title":"法口群","count":304},{"title":"半电报","count":324},{"title":"线红","count":153},{"title":"信证作","count":546},{"title":"器电","count":651},{"title":"示南称","count":128},{"title":"全战","count":412},{"title":"走打","count":592},{"title":"眼基般","count":134},{"title":"来究计","count":322},{"title":"性们","count":511},{"title":"儿数金","count":427},{"title":"已计","count":593},{"title":"导养","count":973}]},{"title":"头走认","children":[{"title":"导时","count":229},{"title":"达积且","count":277},{"title":"样队儿","count":592},{"title":"电历","count":568},{"title":"车一","count":618},{"title":"求生研","count":886},{"title":"正将","count":300},{"title":"并米论","count":945},{"title":"压进到","count":320},{"title":"具候素","count":607},{"title":"它长","count":411},{"title":"写非","count":716},{"title":"实员产","count":452},{"title":"资参管","count":561},{"title":"八主","count":748},{"title":"事厂要","count":672},{"title":"命面","count":83},{"title":"任天","count":106}]},{"title":"机列二","children":[{"title":"展花","count":426},{"title":"经报导","count":363},{"title":"分带完","count":767},{"title":"于却安","count":687},{"title":"她回别","count":520},{"title":"根层性","count":853},{"title":"历感","count":532},{"title":"大响三","count":573},{"title":"本住","count":893},{"title":"际志","count":466},{"title":"温金起","count":231},{"title":"山温","count":910},{"title":"把程","count":463},{"title":"出交认","count":232}]},{"title":"其造据","children":[{"title":"满成风","count":49},{"title":"正世龙","count":385},{"title":"命出","count":142},{"title":"真区","count":736},{"title":"压平马","count":780},{"title":"交飞省","count":876},{"title":"集处就","count":694},{"title":"车便","count":410},{"title":"样装性","count":713},{"title":"斯更","count":425},{"title":"响许","count":975},{"title":"能目设","count":778},{"title":"近准","count":974},{"title":"参音","count":252},{"title":"教见","count":611},{"title":"问素","count":883},{"title":"连也","count":265},{"title":"飞采","count":448},{"title":"法那且","count":748},{"title":"区决门","count":173}]},{"title":"东么","children":[{"title":"近华","count":875},{"title":"极何现","count":576},{"title":"叫条等","count":501},{"title":"办市","count":344},{"title":"无组便","count":177},{"title":"义料","count":728},{"title":"声米","count":743},{"title":"进论书","count":670},{"title":"土九","count":339},{"title":"山矿","count":560},{"title":"一参","count":303}]},{"title":"老农","children":[{"title":"总计工","count":667},{"title":"验义风","count":456},{"title":"业导低","count":802},{"title":"音速是","count":26},{"title":"器众","count":869},{"title":"争才","count":775},{"title":"面听三","count":635},{"title":"拉后","count":293},{"title":"也按","count":339},{"title":"没式其","count":673},{"title":"酸细","count":405},{"title":"平后","count":302},{"title":"给气","count":269},{"title":"持后","count":864},{"title":"月次","count":561},{"title":"一者","count":36},{"title":"名问当","count":600},{"title":"马该","count":785},{"title":"为列","count":915}]},{"title":"局点自","children":[{"title":"什深求","count":399},{"title":"时么","count":514},{"title":"果放北","count":638},{"title":"导片","count":622},{"title":"第该打","count":353},{"title":"队深决","count":526},{"title":"器低县","count":626},{"title":"花正不","count":98},{"title":"难要江","count":111},{"title":"质市","count":241},{"title":"快强又","count":429},{"title":"细与","count":624},{"title":"证厂","count":922},{"title":"新调业","count":302},{"title":"开圆","count":35}]},{"title":"近从","children":[{"title":"改然","count":396},{"title":"受为","count":17},{"title":"受口","count":262},{"title":"与全大","count":25},{"title":"拉总","count":149},{"title":"代打题","count":171},{"title":"主造出","count":163},{"title":"最交能","count":922},{"title":"高五","count":786},{"title":"开革","count":12},{"title":"名情","count":990},{"title":"级油","count":818},{"title":"温办始","count":431},{"title":"济地节","count":330},{"title":"象龙","count":233}]}]'; 71 | 72 | List FOODS = json.decode(FOOD_JSON); 73 | 74 | 75 | const int FOOD_INDEX = 1; -------------------------------------------------------------------------------- /lib/_src/dropdown_list_menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | import 'package:dropdown_menu/_src/drapdown_common.dart'; 5 | 6 | typedef Widget MenuItemBuilder(BuildContext context, T data, bool selected); 7 | typedef void MenuItemOnTap(T data, int index); 8 | typedef List GetSubData(T data); 9 | 10 | const double kDropdownMenuItemHeight = 45.0; 11 | 12 | class DropdownListMenu extends DropdownWidget { 13 | final List data; 14 | final int selectedIndex; 15 | final MenuItemBuilder itemBuilder; 16 | final double itemExtent; 17 | 18 | DropdownListMenu( 19 | {this.data, 20 | this.selectedIndex, 21 | this.itemBuilder, 22 | this.itemExtent: kDropdownMenuItemHeight}); 23 | 24 | @override 25 | DropdownState createState() { 26 | return new _MenuListState(); 27 | } 28 | } 29 | 30 | class _MenuListState extends DropdownState> { 31 | int _selectedIndex; 32 | 33 | @override 34 | void initState() { 35 | _selectedIndex = widget.selectedIndex; 36 | super.initState(); 37 | } 38 | 39 | Widget buildItem(BuildContext context, int index) { 40 | final List list = widget.data; 41 | 42 | final T data = list[index]; 43 | return new GestureDetector( 44 | behavior: HitTestBehavior.opaque, 45 | child: widget.itemBuilder(context, data, index == _selectedIndex), 46 | onTap: () { 47 | setState(() { 48 | _selectedIndex = index; 49 | }); 50 | assert(controller != null); 51 | controller.select(data, index: index); 52 | }, 53 | ); 54 | } 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return new ListView.builder( 59 | itemExtent: widget.itemExtent, 60 | itemBuilder: buildItem, 61 | itemCount: widget.data.length, 62 | ); 63 | } 64 | 65 | @override 66 | void onEvent(DropdownEvent event) { 67 | switch (event) { 68 | case DropdownEvent.SELECT: 69 | case DropdownEvent.HIDE: 70 | {} 71 | break; 72 | case DropdownEvent.ACTIVE: 73 | {} 74 | break; 75 | } 76 | } 77 | } 78 | 79 | /// This widget is just like this: 80 | /// ----------------|--------------------- 81 | /// MainItem1 |SubItem1 82 | /// MainItem2 |SubItem2 83 | /// MainItem3 |SubItem3 84 | /// ----------------|--------------------- 85 | /// When you tap "MainItem1", the sub list of this widget will 86 | /// 1. call `getSubData(widget.data[0])`, this will return a list of data for sub list 87 | /// 2. Refresh the sub list of the widget by using the list above. 88 | /// 89 | /// 90 | class DropdownTreeMenu extends DropdownWidget { 91 | /// data from this widget 92 | final List data; 93 | 94 | /// selected index of main list 95 | final int selectedIndex; 96 | 97 | /// item builder for main list 98 | final MenuItemBuilder itemBuilder; 99 | 100 | //selected index of sub list 101 | final int subSelectedIndex; 102 | 103 | /// A function to build right item of the tree 104 | final MenuItemBuilder subItemBuilder; 105 | 106 | /// A callback to get sub list from left list data, eg. 107 | /// When you set List to left, 108 | /// a callback (MyData data)=>data.children; must be provided 109 | final GetSubData getSubData; 110 | 111 | /// `itemExtent` of main list 112 | final double itemExtent; 113 | 114 | /// `itemExtent` of sub list 115 | final double subItemExtent; 116 | 117 | /// background for main list 118 | final Color background; 119 | 120 | /// background for sub list 121 | final Color subBackground; 122 | 123 | /// flex for main list 124 | final int flex; 125 | 126 | /// flex for sub list, 127 | /// if `subFlex`==2 and `flex`==1,then sub list will be 2 times larger than main list 128 | final int subFlex; 129 | 130 | DropdownTreeMenu({ 131 | this.data, 132 | double itemExtent, 133 | this.selectedIndex, 134 | this.itemBuilder, 135 | this.subItemExtent, 136 | this.subItemBuilder, 137 | this.getSubData, 138 | this.background: const Color(0xfffafafa), 139 | this.subBackground, 140 | this.flex: 1, 141 | this.subFlex: 2, 142 | this.subSelectedIndex, 143 | }) : assert(getSubData != null), 144 | itemExtent = itemExtent ?? kDropdownMenuItemHeight; 145 | 146 | @override 147 | DropdownState createState() { 148 | return new _TreeMenuList(); 149 | } 150 | } 151 | 152 | class _TreeMenuList extends DropdownState { 153 | int _subSelectedIndex; 154 | int _selectedIndex; 155 | 156 | // 157 | int _activeIndex; 158 | 159 | List _subData; 160 | 161 | List _data; 162 | 163 | @override 164 | void initState() { 165 | _selectedIndex = widget.selectedIndex; 166 | _subSelectedIndex = widget.subSelectedIndex; 167 | _activeIndex = _selectedIndex; 168 | 169 | _data = widget.data; 170 | 171 | if (_activeIndex != null) { 172 | _subData = widget.getSubData(_data[_activeIndex]); 173 | } 174 | 175 | super.initState(); 176 | } 177 | 178 | @override 179 | void didUpdateWidget(DropdownTreeMenu oldWidget) { 180 | // _selectedIndex = widget.selectedIndex; 181 | // _subSelectedIndex = widget.subSelectedIndex; 182 | // _activeIndex = _selectedIndex; 183 | 184 | super.didUpdateWidget(oldWidget); 185 | } 186 | 187 | Widget buildSubItem(BuildContext context, int index) { 188 | return new GestureDetector( 189 | behavior: HitTestBehavior.opaque, 190 | child: widget.subItemBuilder(context, _subData[index], 191 | _activeIndex == _selectedIndex && index == _subSelectedIndex), 192 | onTap: () { 193 | assert(controller != null); 194 | controller.select(_subData[index], 195 | index: _activeIndex, subIndex: index); 196 | setState(() { 197 | _selectedIndex = _activeIndex; 198 | _subSelectedIndex = index; 199 | }); 200 | }, 201 | ); 202 | } 203 | 204 | Widget buildItem(BuildContext context, int index) { 205 | final List list = widget.data; 206 | final T data = list[index]; 207 | return new GestureDetector( 208 | behavior: HitTestBehavior.opaque, 209 | child: widget.itemBuilder(context, data, index == _activeIndex), 210 | onTap: () { 211 | //切换 212 | //拿到数据 213 | setState(() { 214 | _subData = widget.getSubData(data); 215 | _activeIndex = index; 216 | }); 217 | }, 218 | ); 219 | } 220 | 221 | @override 222 | Widget build(BuildContext context) { 223 | return new Row( 224 | crossAxisAlignment: CrossAxisAlignment.start, 225 | children: [ 226 | new Expanded( 227 | flex: widget.flex, 228 | child: new Container( 229 | child: new ListView.builder( 230 | itemExtent: widget.itemExtent, 231 | itemBuilder: buildItem, 232 | itemCount: this._data == null ? 0 : this._data.length, 233 | ), 234 | color: widget.background, 235 | )), 236 | new Expanded( 237 | flex: widget.subFlex, 238 | child: new Container( 239 | color: widget.subBackground, 240 | child: new CustomScrollView( 241 | slivers: [ 242 | new SliverList( 243 | delegate: new SliverChildBuilderDelegate( 244 | buildSubItem, 245 | childCount: 246 | this._subData == null ? 0 : this._subData.length, 247 | )) 248 | ], 249 | ), 250 | )) 251 | ], 252 | ); 253 | } 254 | 255 | @override 256 | void onEvent(DropdownEvent event) { 257 | // TODO: implement onEvent 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_Packages.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /example/lib/fix_menu.dart: -------------------------------------------------------------------------------- 1 | // 2 | //DropdownMenu buildDropdownMenu() { 3 | // return new DropdownMenu(maxMenuHeight: kDropdownMenuItemHeight * 10, 4 | // // activeIndex: activeIndex, 5 | // menus: [ 6 | // new DropdownMenuBuilder( 7 | // builder: (BuildContext context) { 8 | // return new DropdownListMenu( 9 | // selectedIndex: TYPE_INDEX, 10 | // data: TYPES, 11 | // itemBuilder: buildCheckItem, 12 | // ); 13 | // }, 14 | // height: kDropdownMenuItemHeight * TYPES.length), 15 | // new DropdownMenuBuilder( 16 | // builder: (BuildContext context) { 17 | // return new DropdownListMenu( 18 | // selectedIndex: ORDER_INDEX, 19 | // data: ORDERS, 20 | // itemBuilder: buildCheckItem, 21 | // ); 22 | // }, 23 | // height: kDropdownMenuItemHeight * ORDERS.length), 24 | // new DropdownMenuBuilder(builder: (BuildContext context) { 25 | // return new DropdownTreeMenu( 26 | // selectedIndex: 0, 27 | // subSelectedIndex: 0, 28 | // itemExtent: 45.0, 29 | // background: Colors.red, 30 | // subBackground: Colors.blueAccent, 31 | // itemBuilder: (BuildContext context, dynamic data, bool selected) { 32 | // if (!selected) { 33 | // return new DecoratedBox( 34 | // decoration: new BoxDecoration( 35 | // border: new Border( 36 | // right: Divider.createBorderSide(context))), 37 | // child: new Padding( 38 | // padding: const EdgeInsets.only(left: 15.0), 39 | // child: new Row( 40 | // children: [ 41 | // new Text(data['title']), 42 | // ], 43 | // ))); 44 | // } else { 45 | // return new DecoratedBox( 46 | // decoration: new BoxDecoration( 47 | // border: new Border( 48 | // top: Divider.createBorderSide(context), 49 | // bottom: Divider.createBorderSide(context))), 50 | // child: new Container( 51 | // color: Theme.of(context).scaffoldBackgroundColor, 52 | // child: new Row( 53 | // children: [ 54 | // new Container( 55 | // color: Theme.of(context).primaryColor, 56 | // width: 3.0, 57 | // height: 20.0), 58 | // new Padding( 59 | // padding: new EdgeInsets.only(left: 12.0), 60 | // child: new Text(data['title'])), 61 | // ], 62 | // ))); 63 | // } 64 | // }, 65 | // subItemBuilder: 66 | // (BuildContext context, dynamic data, bool selected) { 67 | // Color color = selected 68 | // ? Theme.of(context).primaryColor 69 | // : Theme.of(context).textTheme.body1.color; 70 | // 71 | // return new SizedBox( 72 | // height: 45.0, 73 | // child: new Row( 74 | // children: [ 75 | // new Text( 76 | // data['title'], 77 | // style: new TextStyle(color: color), 78 | // ), 79 | // new Expanded( 80 | // child: new Align( 81 | // alignment: Alignment.centerRight, 82 | // child: new Text(data['count'].toString()))) 83 | // ], 84 | // ), 85 | // ); 86 | // }, 87 | // getSubData: (dynamic data) { 88 | // return data['children']; 89 | // }, 90 | // data: FOODS, 91 | // 92 | // ); 93 | // },height: 450.0) 94 | // ]); 95 | //} 96 | // 97 | //DropdownHeader buildDropdownHeader({DropdownMenuHeadTapCallback onTap}) { 98 | // return new DropdownHeader( 99 | // onTap: onTap, 100 | // titles: [TYPES[TYPE_INDEX], ORDERS[ORDER_INDEX], FOODS[0]['children'][0]], 101 | // ); 102 | //} 103 | // 104 | //Widget buildFixHeaderDropdownMenu() { 105 | // return new DefaultDropdownMenuController( 106 | // child: new Column( 107 | // children: [ 108 | // buildDropdownHeader(), 109 | // new Expanded( 110 | // child: new Stack( 111 | // children: [ 112 | // new ListView( 113 | // children: [new Text("123123")], 114 | // ), 115 | // buildDropdownMenu() 116 | // ], 117 | // )) 118 | // ], 119 | // )); 120 | //} 121 | // 122 | //Widget buildInnerListHeaderDropdownMenu() { 123 | // return new DefaultDropdownMenuController( 124 | // onSelected: ({int menuIndex, int index, int subIndex, dynamic data}) { 125 | // print( 126 | // "menuIndex:$menuIndex index:$index subIndex:$subIndex data:$data"); 127 | // }, 128 | // child: new Stack( 129 | // children: [ 130 | // new CustomScrollView( 131 | // controller: scrollController, 132 | // slivers: [ 133 | // new SliverList( 134 | // key: globalKey, 135 | // delegate: new SliverChildBuilderDelegate( 136 | // (BuildContext context, int index) { 137 | // return new Container( 138 | // color: Colors.black26, 139 | // child: new Image.asset( 140 | // "images/header.jpg", 141 | // fit: BoxFit.fill, 142 | // ), 143 | // ); 144 | // }, childCount: 1)), 145 | // new SliverPersistentHeader( 146 | // delegate: new DropdownSliverChildBuilderDelegate( 147 | // builder: (BuildContext context) { 148 | // return new Container( 149 | // color: Theme.of(context).scaffoldBackgroundColor, 150 | // child: buildDropdownHeader(onTap: this._onTapHead)); 151 | // }), 152 | // pinned: true, 153 | // floating: true, 154 | // ), 155 | // new SliverList( 156 | // delegate: new SliverChildBuilderDelegate( 157 | // (BuildContext context, int index) { 158 | // return new Container( 159 | // color: Theme.of(context).scaffoldBackgroundColor, 160 | // child: new Image.asset( 161 | // "images/body.jpg", 162 | // fit: BoxFit.fill, 163 | // ), 164 | // ); 165 | // }, childCount: 10)), 166 | // ]), 167 | // new Padding( 168 | // padding: new EdgeInsets.only(top: 46.0), 169 | // child: buildDropdownMenu()) 170 | // ], 171 | // )); 172 | //} 173 | // 174 | //GlobalKey globalKey; 175 | // 176 | //void _onTapHead(int index) { 177 | // RenderObject renderObject = globalKey.currentContext.findRenderObject(); 178 | // DropdownMenuController controller = 179 | // DefaultDropdownMenuController.of(globalKey.currentContext); 180 | // // 181 | // scrollController 182 | // .animateTo(scrollController.offset + renderObject.semanticBounds.height, 183 | // duration: new Duration(milliseconds: 150), curve: Curves.ease) 184 | // .whenComplete(() { 185 | // controller.show(index); 186 | // }); 187 | //} 188 | 189 | 190 | import 'package:flutter/material.dart'; 191 | 192 | class FixMenu extends StatefulWidget{ 193 | @override 194 | State createState() { 195 | return new _FixMenuState(); 196 | } 197 | 198 | } 199 | 200 | class _FixMenuState extends State{ 201 | @override 202 | Widget build(BuildContext context) { 203 | return new Container( 204 | 205 | ); 206 | } 207 | 208 | } -------------------------------------------------------------------------------- /lib/_src/dropdown_menu.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:ui' as ui show Image, ImageFilter; 3 | import 'package:dropdown_menu/_src/drapdown_common.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | enum DropdownMenuShowHideSwitchStyle { 7 | /// the showing menu will direct hide without animation 8 | directHideAnimationShow, 9 | 10 | /// the showing menu will direct hide without animation, and another menu shows without animation 11 | directHideDirectShow, 12 | 13 | /// the showing menu will hide with animation,and the same time another menu shows with animation 14 | animationHideAnimationShow, 15 | 16 | /// the showing menu will hide with animation,until the animation complete, another menu shows with animation 17 | animationShowUntilAnimationHideComplete, 18 | } 19 | 20 | class DropdownMenu extends DropdownWidget { 21 | /// menus whant to show 22 | final List menus; 23 | 24 | final Duration hideDuration; 25 | final Duration showDuration; 26 | final Curve showCurve; 27 | final Curve hideCurve; 28 | 29 | /// if set , background is rendered with ImageFilter.blur 30 | final double blur; 31 | 32 | final VoidCallback onHide; 33 | 34 | /// The style when one menu hide and another menu show , 35 | /// see [DropdownMenuShowHideSwitchStyle] 36 | final DropdownMenuShowHideSwitchStyle switchStyle; 37 | 38 | final double maxMenuHeight; 39 | 40 | DropdownMenu( 41 | {@required this.menus, 42 | DropdownMenuController controller, 43 | Duration hideDuration, 44 | Duration showDuration, 45 | this.onHide, 46 | this.blur, 47 | Key key, 48 | this.maxMenuHeight, 49 | Curve hideCurve, 50 | this.switchStyle: DropdownMenuShowHideSwitchStyle 51 | .animationShowUntilAnimationHideComplete, 52 | Curve showCurve}) 53 | : hideDuration = hideDuration ?? new Duration(milliseconds: 150), 54 | showDuration = showDuration ?? new Duration(milliseconds: 300), 55 | showCurve = showCurve ?? Curves.fastOutSlowIn, 56 | hideCurve = hideCurve ?? Curves.fastOutSlowIn, 57 | super(key: key, controller: controller) { 58 | assert(menus != null); 59 | } 60 | 61 | @override 62 | DropdownState createState() { 63 | return new _DropdownMenuState(); 64 | } 65 | } 66 | 67 | class _DropdownAnimation { 68 | Animation rect; 69 | AnimationController animationController; 70 | RectTween position; 71 | 72 | _DropdownAnimation(TickerProvider provider) { 73 | animationController = new AnimationController(vsync: provider); 74 | } 75 | 76 | set height(double value) { 77 | position = new RectTween( 78 | begin: new Rect.fromLTRB(0.0, -value, 0.0, 0.0), 79 | end: new Rect.fromLTRB(0.0, 0.0, 0.0, 0.0), 80 | ); 81 | 82 | rect = position.animate(animationController); 83 | } 84 | 85 | set value(double value) { 86 | animationController.value = value; 87 | } 88 | 89 | void dispose() { 90 | animationController.dispose(); 91 | } 92 | 93 | TickerFuture animateTo(double value, {Duration duration, Curve curve}) { 94 | return animationController.animateTo(value, 95 | duration: duration, curve: curve); 96 | } 97 | } 98 | 99 | class SizeClipper extends CustomClipper { 100 | @override 101 | Rect getClip(Size size) { 102 | return new Rect.fromLTWH(0.0, 0.0, size.width, size.height); 103 | } 104 | 105 | @override 106 | bool shouldReclip(CustomClipper oldClipper) { 107 | return false; 108 | } 109 | } 110 | 111 | class _DropdownMenuState extends DropdownState 112 | with TickerProviderStateMixin { 113 | List<_DropdownAnimation> _dropdownAnimations; 114 | bool _show; 115 | List _showing; 116 | 117 | AnimationController _fadeController; 118 | Animation _fadeAnimation; 119 | 120 | @override 121 | void initState() { 122 | _showing = []; 123 | _dropdownAnimations = []; 124 | for (int i = 0, c = widget.menus.length; i < c; ++i) { 125 | _dropdownAnimations.add(new _DropdownAnimation(this)); 126 | } 127 | 128 | _updateHeights(); 129 | 130 | _show = false; 131 | 132 | _fadeController = new AnimationController(vsync: this); 133 | _fadeAnimation = new Tween( 134 | begin: 0.0, 135 | end: 1.0, 136 | ).animate(_fadeController); 137 | 138 | super.initState(); 139 | } 140 | 141 | @override 142 | void dispose() { 143 | for (int i = 0, c = _dropdownAnimations.length; i < c; ++i) { 144 | _dropdownAnimations[i].dispose(); 145 | } 146 | 147 | super.dispose(); 148 | } 149 | 150 | void _updateHeights() { 151 | for (int i = 0, c = widget.menus.length; i < c; ++i) { 152 | _dropdownAnimations[i].height = 153 | _ensureHeight(_getHeight(widget.menus[i])); 154 | } 155 | } 156 | 157 | @override 158 | void didUpdateWidget(DropdownMenu oldWidget) { 159 | //update state 160 | _updateHeights(); 161 | super.didUpdateWidget(oldWidget); 162 | } 163 | 164 | Widget createMenu(BuildContext context, DropdownMenuBuilder menu, int i) { 165 | DropdownMenuBuilder builder = menu; 166 | 167 | return new ClipRect( 168 | clipper: new SizeClipper(), 169 | child: new SizedBox( 170 | height: _ensureHeight(builder.height), 171 | child: _showing.contains(i) ? builder.builder(context) : null), 172 | ); 173 | } 174 | 175 | Widget _buildBackground(BuildContext context) { 176 | Widget container = new Container( 177 | color: Colors.black26, 178 | ); 179 | 180 | container = new BackdropFilter( 181 | filter: new ui.ImageFilter.blur( 182 | sigmaY: widget.blur, 183 | sigmaX: widget.blur, 184 | ), 185 | child: container); 186 | 187 | return container; 188 | } 189 | 190 | @override 191 | Widget build(BuildContext context) { 192 | List list = []; 193 | 194 | print("build ${new DateTime.now()}"); 195 | 196 | if (_show) { 197 | list.add( 198 | new FadeTransition( 199 | opacity: _fadeAnimation, 200 | child: new GestureDetector( 201 | onTap: onHide, child: _buildBackground(context)), 202 | ), 203 | ); 204 | } 205 | 206 | for (int i = 0, c = widget.menus.length; i < c; ++i) { 207 | list.add(new RelativePositionedTransition( 208 | rect: _dropdownAnimations[i].rect, 209 | size: new Size(0.0, 0.0), 210 | child: new Align( 211 | alignment: Alignment.topCenter, 212 | child: new Container( 213 | color: Theme.of(context).scaffoldBackgroundColor, 214 | child: createMenu(context, widget.menus[i], i), 215 | )))); 216 | } 217 | 218 | //WidgetsBinding; 219 | //context.findRenderObject(); 220 | return new Stack( 221 | fit: StackFit.expand, 222 | children: list, 223 | ); 224 | } 225 | 226 | TickerFuture onHide({bool dispatch: true}) { 227 | if (_activeIndex != null) { 228 | int index = _activeIndex; 229 | _activeIndex = null; 230 | TickerFuture future = _hide(index); 231 | if (dispatch) { 232 | if (controller != null) { 233 | controller.hide(); 234 | } 235 | 236 | //if (widget.onHide != null) widget.onHide(); 237 | } 238 | 239 | _fadeController.animateTo(0.0, 240 | duration: widget.hideDuration, curve: widget.hideCurve); 241 | 242 | future.whenComplete(() { 243 | setState(() { 244 | _show = false; 245 | }); 246 | }); 247 | return future; 248 | } 249 | 250 | return new TickerFuture.complete(); 251 | } 252 | 253 | TickerFuture _hide(int index) { 254 | TickerFuture future = _dropdownAnimations[index] 255 | .animateTo(0.0, duration: widget.hideDuration, curve: widget.hideCurve); 256 | return future; 257 | } 258 | 259 | int _activeIndex; 260 | 261 | Future onShow(int index) { 262 | //哪一个是要展示的 263 | 264 | assert(index >= 0 && index < _dropdownAnimations.length); 265 | if (!_showing.contains(index)) { 266 | _showing.add(index); 267 | } 268 | 269 | if (_activeIndex != null) { 270 | if (_activeIndex == index) { 271 | return onHide(); 272 | } 273 | 274 | switch (widget.switchStyle) { 275 | case DropdownMenuShowHideSwitchStyle.directHideAnimationShow: 276 | { 277 | _dropdownAnimations[_activeIndex].value = 0.0; 278 | _dropdownAnimations[index].value = 1.0; 279 | _activeIndex = index; 280 | 281 | setState(() { 282 | _show = true; 283 | }); 284 | 285 | return new Future.value(null); 286 | } 287 | 288 | break; 289 | case DropdownMenuShowHideSwitchStyle.animationHideAnimationShow: 290 | { 291 | _hide(_activeIndex); 292 | } 293 | break; 294 | case DropdownMenuShowHideSwitchStyle.directHideDirectShow: 295 | { 296 | _dropdownAnimations[_activeIndex].value = 0.0; 297 | } 298 | break; 299 | case DropdownMenuShowHideSwitchStyle 300 | .animationShowUntilAnimationHideComplete: 301 | { 302 | return _hide(_activeIndex).whenComplete(() { 303 | return _handleShow(index, true); 304 | }); 305 | } 306 | break; 307 | } 308 | } 309 | 310 | return _handleShow(index, true); 311 | } 312 | 313 | TickerFuture _handleShow(int index, bool animation) { 314 | _activeIndex = index; 315 | 316 | setState(() { 317 | _show = true; 318 | }); 319 | 320 | _fadeController.animateTo(1.0, 321 | duration: widget.showDuration, curve: widget.showCurve); 322 | 323 | return _dropdownAnimations[index] 324 | .animateTo(1.0, duration: widget.showDuration, curve: widget.showCurve); 325 | } 326 | 327 | double _getHeight(dynamic menu) { 328 | DropdownMenuBuilder builder = menu as DropdownMenuBuilder; 329 | 330 | return builder.height; 331 | } 332 | 333 | double _ensureHeight(double height) { 334 | final double maxMenuHeight = widget.maxMenuHeight; 335 | assert(height != null || maxMenuHeight != null, 336 | "DropdownMenu.maxMenuHeight and DropdownMenuBuilder.height must not both null"); 337 | if (maxMenuHeight != null) { 338 | if (height == null) return maxMenuHeight; 339 | return height > maxMenuHeight ? maxMenuHeight : height; 340 | } 341 | return height; 342 | } 343 | 344 | @override 345 | void onEvent(DropdownEvent event) { 346 | switch (event) { 347 | case DropdownEvent.SELECT: 348 | case DropdownEvent.HIDE: 349 | { 350 | onHide(dispatch: false); 351 | } 352 | break; 353 | case DropdownEvent.ACTIVE: 354 | { 355 | onShow(controller.menuIndex); 356 | } 357 | break; 358 | } 359 | } 360 | } 361 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:dropdown_menu/dropdown_menu.dart'; 5 | import 'dart:math' as math; 6 | import 'dart:io'; 7 | import 'dart:convert'; 8 | 9 | void main() => runApp(new MyApp()); 10 | 11 | class MyApp extends StatelessWidget { 12 | // This widget is the root of your application. 13 | @override 14 | Widget build(BuildContext context) { 15 | return new MaterialApp( 16 | title: 'Flutter Demo', 17 | theme: new ThemeData( 18 | primarySwatch: Colors.blue, scaffoldBackgroundColor: Colors.white), 19 | home: new MyHomePage(title: 'Flutter Demo Home Page'), 20 | ); 21 | } 22 | } 23 | 24 | class MyHomePage extends StatefulWidget { 25 | MyHomePage({Key key, this.title}) : super(key: key); 26 | 27 | final String title; 28 | 29 | @override 30 | _MyHomePageState createState() => new _MyHomePageState(); 31 | } 32 | 33 | const List> ORDERS = [ 34 | {"title": "综合排序"}, 35 | {"title": "好评优先"}, 36 | {"title": "离我最近"}, 37 | {"title": "人气最高"}, 38 | ]; 39 | 40 | const int ORDER_INDEX = 0; 41 | 42 | const List> TYPES = [ 43 | {"title": "全部", "id": 0}, 44 | {"title": "甜点饮品", "id": 1}, 45 | {"title": "生日蛋糕", "id": 2}, 46 | {"title": "火锅", "id": 3}, 47 | {"title": "自助餐", "id": 4}, 48 | {"title": "小吃", "id": 5}, 49 | {"title": "快餐", "id": 6}, 50 | {"title": "日韩料理", "id": 7}, 51 | {"title": "西餐", "id": 8}, 52 | {"title": "聚餐", "id": 9}, 53 | {"title": "烧烤", "id": 10}, 54 | {"title": "川菜", "id": 11}, 55 | {"title": "江浙菜", "id": 12}, 56 | {"title": "东北菜", "id": 13}, 57 | {"title": "蒙餐", "id": 14}, 58 | {"title": "新疆菜", "id": 15}, 59 | ]; 60 | 61 | const int TYPE_INDEX = 2; 62 | 63 | const List> BUSINESS_CYCLE = [ 64 | { 65 | "title": "附近", 66 | "children": [ 67 | {"title": "附近", "distance": 500}, 68 | {"title": "1km", "distance": 1000}, 69 | {"title": "2km", "distance": 2000} 70 | ] 71 | }, 72 | { 73 | "title": "推荐商圈", 74 | "children": [ 75 | {"title": "中山路", "count": 326}, 76 | {"title": "万达广场", "count": 100}, 77 | {"title": "瑞景", "count": 50} 78 | ] 79 | }, 80 | { 81 | "title": "附近", 82 | "children": [ 83 | {"title": "附近", "distance": 500}, 84 | {"title": "1km", "distance": 1000}, 85 | {"title": "2km", "distance": 2000} 86 | ] 87 | }, 88 | { 89 | "title": "附近", 90 | "children": [ 91 | {"title": "附近", "distance": 500}, 92 | {"title": "1km", "distance": 1000}, 93 | {"title": "2km", "distance": 2000} 94 | ] 95 | }, 96 | ]; 97 | 98 | String FOOD_JSON = 99 | '[{"title":"力体","children":[{"title":"传声织","count":810},{"title":"分队什","count":463},{"title":"且工","count":325},{"title":"清局","count":899},{"title":"代老克","count":325},{"title":"持连回","count":14},{"title":"改层听","count":470},{"title":"存比","count":908},{"title":"热土米","count":333},{"title":"水发","count":58},{"title":"制见","count":28},{"title":"取化无","count":469},{"title":"记有何","count":503},{"title":"亲公何","count":930},{"title":"步业要","count":885}]},{"title":"建易外","children":[{"title":"生观真","count":207},{"title":"音代","count":425},{"title":"族王资","count":205},{"title":"圆传统","count":791},{"title":"些任","count":141},{"title":"程即走","count":163},{"title":"各七","count":65},{"title":"院此格","count":314},{"title":"支及","count":726},{"title":"别题","count":524},{"title":"低去到","count":706},{"title":"般将","count":13},{"title":"西南","count":189},{"title":"状南制","count":335},{"title":"调油","count":90},{"title":"听从没","count":33},{"title":"电求什","count":88}]},{"title":"非先算","children":[{"title":"严状","count":108},{"title":"查增","count":634},{"title":"号备","count":304},{"title":"法口群","count":304},{"title":"半电报","count":324},{"title":"线红","count":153},{"title":"信证作","count":546},{"title":"器电","count":651},{"title":"示南称","count":128},{"title":"全战","count":412},{"title":"走打","count":592},{"title":"眼基般","count":134},{"title":"来究计","count":322},{"title":"性们","count":511},{"title":"儿数金","count":427},{"title":"已计","count":593},{"title":"导养","count":973}]},{"title":"头走认","children":[{"title":"导时","count":229},{"title":"达积且","count":277},{"title":"样队儿","count":592},{"title":"电历","count":568},{"title":"车一","count":618},{"title":"求生研","count":886},{"title":"正将","count":300},{"title":"并米论","count":945},{"title":"压进到","count":320},{"title":"具候素","count":607},{"title":"它长","count":411},{"title":"写非","count":716},{"title":"实员产","count":452},{"title":"资参管","count":561},{"title":"八主","count":748},{"title":"事厂要","count":672},{"title":"命面","count":83},{"title":"任天","count":106}]},{"title":"机列二","children":[{"title":"展花","count":426},{"title":"经报导","count":363},{"title":"分带完","count":767},{"title":"于却安","count":687},{"title":"她回别","count":520},{"title":"根层性","count":853},{"title":"历感","count":532},{"title":"大响三","count":573},{"title":"本住","count":893},{"title":"际志","count":466},{"title":"温金起","count":231},{"title":"山温","count":910},{"title":"把程","count":463},{"title":"出交认","count":232}]},{"title":"其造据","children":[{"title":"满成风","count":49},{"title":"正世龙","count":385},{"title":"命出","count":142},{"title":"真区","count":736},{"title":"压平马","count":780},{"title":"交飞省","count":876},{"title":"集处就","count":694},{"title":"车便","count":410},{"title":"样装性","count":713},{"title":"斯更","count":425},{"title":"响许","count":975},{"title":"能目设","count":778},{"title":"近准","count":974},{"title":"参音","count":252},{"title":"教见","count":611},{"title":"问素","count":883},{"title":"连也","count":265},{"title":"飞采","count":448},{"title":"法那且","count":748},{"title":"区决门","count":173}]},{"title":"东么","children":[{"title":"近华","count":875},{"title":"极何现","count":576},{"title":"叫条等","count":501},{"title":"办市","count":344},{"title":"无组便","count":177},{"title":"义料","count":728},{"title":"声米","count":743},{"title":"进论书","count":670},{"title":"土九","count":339},{"title":"山矿","count":560},{"title":"一参","count":303}]},{"title":"老农","children":[{"title":"总计工","count":667},{"title":"验义风","count":456},{"title":"业导低","count":802},{"title":"音速是","count":26},{"title":"器众","count":869},{"title":"争才","count":775},{"title":"面听三","count":635},{"title":"拉后","count":293},{"title":"也按","count":339},{"title":"没式其","count":673},{"title":"酸细","count":405},{"title":"平后","count":302},{"title":"给气","count":269},{"title":"持后","count":864},{"title":"月次","count":561},{"title":"一者","count":36},{"title":"名问当","count":600},{"title":"马该","count":785},{"title":"为列","count":915}]},{"title":"局点自","children":[{"title":"什深求","count":399},{"title":"时么","count":514},{"title":"果放北","count":638},{"title":"导片","count":622},{"title":"第该打","count":353},{"title":"队深决","count":526},{"title":"器低县","count":626},{"title":"花正不","count":98},{"title":"难要江","count":111},{"title":"质市","count":241},{"title":"快强又","count":429},{"title":"细与","count":624},{"title":"证厂","count":922},{"title":"新调业","count":302},{"title":"开圆","count":35}]},{"title":"近从","children":[{"title":"改然","count":396},{"title":"受为","count":17},{"title":"受口","count":262},{"title":"与全大","count":25},{"title":"拉总","count":149},{"title":"代打题","count":171},{"title":"主造出","count":163},{"title":"最交能","count":922},{"title":"高五","count":786},{"title":"开革","count":12},{"title":"名情","count":990},{"title":"级油","count":818},{"title":"温办始","count":431},{"title":"济地节","count":330},{"title":"象龙","count":233}]}]'; 100 | 101 | List FOODS = json.decode(FOOD_JSON); 102 | 103 | const int FOOD_INDEX = 1; 104 | 105 | class _MyHomePageState extends State { 106 | ScrollController scrollController; 107 | @override 108 | void initState() { 109 | scrollController = new ScrollController(); 110 | globalKey = new GlobalKey(); 111 | super.initState(); 112 | } 113 | 114 | DropdownMenu buildDropdownMenu() { 115 | return new DropdownMenu(maxMenuHeight: kDropdownMenuItemHeight * 10, 116 | // activeIndex: activeIndex, 117 | menus: [ 118 | new DropdownMenuBuilder( 119 | builder: (BuildContext context) { 120 | return new DropdownListMenu( 121 | selectedIndex: TYPE_INDEX, 122 | data: TYPES, 123 | itemBuilder: buildCheckItem, 124 | ); 125 | }, 126 | height: kDropdownMenuItemHeight * TYPES.length), 127 | new DropdownMenuBuilder( 128 | builder: (BuildContext context) { 129 | return new DropdownListMenu( 130 | selectedIndex: ORDER_INDEX, 131 | data: ORDERS, 132 | itemBuilder: buildCheckItem, 133 | ); 134 | }, 135 | height: kDropdownMenuItemHeight * ORDERS.length), 136 | new DropdownMenuBuilder( 137 | builder: (BuildContext context) { 138 | return new DropdownTreeMenu( 139 | selectedIndex: 0, 140 | subSelectedIndex: 0, 141 | itemExtent: 45.0, 142 | background: Colors.red, 143 | subBackground: Colors.blueAccent, 144 | itemBuilder: 145 | (BuildContext context, dynamic data, bool selected) { 146 | if (!selected) { 147 | return new DecoratedBox( 148 | decoration: new BoxDecoration( 149 | border: new Border( 150 | right: Divider.createBorderSide(context))), 151 | child: new Padding( 152 | padding: const EdgeInsets.only(left: 15.0), 153 | child: new Row( 154 | children: [ 155 | new Text(data['title']), 156 | ], 157 | ))); 158 | } else { 159 | return new DecoratedBox( 160 | decoration: new BoxDecoration( 161 | border: new Border( 162 | top: Divider.createBorderSide(context), 163 | bottom: Divider.createBorderSide(context))), 164 | child: new Container( 165 | color: Theme.of(context).scaffoldBackgroundColor, 166 | child: new Row( 167 | children: [ 168 | new Container( 169 | color: Theme.of(context).primaryColor, 170 | width: 3.0, 171 | height: 20.0), 172 | new Padding( 173 | padding: new EdgeInsets.only(left: 12.0), 174 | child: new Text(data['title'])), 175 | ], 176 | ))); 177 | } 178 | }, 179 | subItemBuilder: 180 | (BuildContext context, dynamic data, bool selected) { 181 | Color color = selected 182 | ? Theme.of(context).primaryColor 183 | : Theme.of(context).textTheme.body1.color; 184 | 185 | return new SizedBox( 186 | height: 45.0, 187 | child: new Row( 188 | children: [ 189 | new Text( 190 | data['title'], 191 | style: new TextStyle(color: color), 192 | ), 193 | new Expanded( 194 | child: new Align( 195 | alignment: Alignment.centerRight, 196 | child: new Text(data['count'].toString()))) 197 | ], 198 | ), 199 | ); 200 | }, 201 | getSubData: (dynamic data) { 202 | return data['children']; 203 | }, 204 | data: FOODS, 205 | ); 206 | }, 207 | height: 450.0) 208 | ]); 209 | } 210 | 211 | DropdownHeader buildDropdownHeader({DropdownMenuHeadTapCallback onTap}) { 212 | return new DropdownHeader( 213 | onTap: onTap, 214 | titles: [TYPES[TYPE_INDEX], ORDERS[ORDER_INDEX], FOODS[0]['children'][0]], 215 | ); 216 | } 217 | 218 | Widget buildFixHeaderDropdownMenu() { 219 | return new DefaultDropdownMenuController( 220 | child: new Column( 221 | children: [ 222 | buildDropdownHeader(), 223 | new Expanded( 224 | child: new Stack( 225 | children: [ 226 | new ListView( 227 | children: [new Text("123123")], 228 | ), 229 | buildDropdownMenu() 230 | ], 231 | )) 232 | ], 233 | )); 234 | } 235 | 236 | Widget buildInnerListHeaderDropdownMenu() { 237 | return new DefaultDropdownMenuController( 238 | onSelected: ({int menuIndex, int index, int subIndex, dynamic data}) { 239 | print( 240 | "menuIndex:$menuIndex index:$index subIndex:$subIndex data:$data"); 241 | }, 242 | child: new Stack( 243 | children: [ 244 | new CustomScrollView( 245 | controller: scrollController, 246 | slivers: [ 247 | new SliverList( 248 | key: globalKey, 249 | delegate: new SliverChildBuilderDelegate( 250 | (BuildContext context, int index) { 251 | return new Container( 252 | color: Colors.black26, 253 | child: new Image.asset( 254 | "images/header.jpg", 255 | fit: BoxFit.fill, 256 | ), 257 | ); 258 | }, childCount: 1)), 259 | new SliverPersistentHeader( 260 | delegate: new DropdownSliverChildBuilderDelegate( 261 | builder: (BuildContext context) { 262 | return new Container( 263 | color: Theme.of(context).scaffoldBackgroundColor, 264 | child: buildDropdownHeader(onTap: this._onTapHead)); 265 | }), 266 | pinned: true, 267 | floating: true, 268 | ), 269 | new SliverList( 270 | delegate: new SliverChildBuilderDelegate( 271 | (BuildContext context, int index) { 272 | return new Container( 273 | color: Theme.of(context).scaffoldBackgroundColor, 274 | child: new Image.asset( 275 | "images/body.jpg", 276 | fit: BoxFit.fill, 277 | ), 278 | ); 279 | }, childCount: 10)), 280 | ]), 281 | new Padding( 282 | padding: new EdgeInsets.only(top: 46.0), 283 | child: buildDropdownMenu()) 284 | ], 285 | )); 286 | } 287 | 288 | GlobalKey globalKey; 289 | @override 290 | void dispose() { 291 | super.dispose(); 292 | } 293 | 294 | void _onTapHead(int index) { 295 | RenderObject renderObject = globalKey.currentContext.findRenderObject(); 296 | DropdownMenuController controller = 297 | DefaultDropdownMenuController.of(globalKey.currentContext); 298 | // 299 | scrollController 300 | .animateTo(scrollController.offset + renderObject.semanticBounds.height, 301 | duration: new Duration(milliseconds: 150), curve: Curves.ease) 302 | .whenComplete(() { 303 | controller.show(index); 304 | }); 305 | } 306 | 307 | int _currentIndex = 0; 308 | 309 | @override 310 | Widget build(BuildContext context) { 311 | return new Scaffold( 312 | appBar: new AppBar( 313 | title: new Text(widget.title), 314 | ), 315 | body: _currentIndex == 0 316 | ? buildFixHeaderDropdownMenu() 317 | : buildInnerListHeaderDropdownMenu(), 318 | bottomNavigationBar: new BottomNavigationBar( 319 | onTap: (int index) { 320 | setState(() { 321 | _currentIndex = index; 322 | }); 323 | }, 324 | currentIndex: _currentIndex, 325 | items: [ 326 | {"name": "Fix", "icon": Icons.hearing}, 327 | {"name": "ScrollView", "icon": Icons.list} 328 | ] 329 | .map((dynamic data) => new BottomNavigationBarItem( 330 | title: new Text(data["name"]), icon: new Icon(data["icon"]))) 331 | .toList()), 332 | ); 333 | } 334 | } 335 | -------------------------------------------------------------------------------- /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 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; 19 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 20 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 21 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 22 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 23 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXCopyFilesBuildPhase section */ 27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 28 | isa = PBXCopyFilesBuildPhase; 29 | buildActionMask = 2147483647; 30 | dstPath = ""; 31 | dstSubfolderSpec = 10; 32 | files = ( 33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 35 | ); 36 | name = "Embed Frameworks"; 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXCopyFilesBuildPhase section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 48 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 51 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 52 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 53 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 55 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 58 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 67 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 9740EEB11CF90186004384FC /* Flutter */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 78 | 3B80C3931E831B6300D905FE /* App.framework */, 79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 80 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 81 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 82 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 84 | ); 85 | name = Flutter; 86 | sourceTree = ""; 87 | }; 88 | 97C146E51CF9000F007C117D = { 89 | isa = PBXGroup; 90 | children = ( 91 | 9740EEB11CF90186004384FC /* Flutter */, 92 | 97C146F01CF9000F007C117D /* Runner */, 93 | 97C146EF1CF9000F007C117D /* Products */, 94 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 97C146EF1CF9000F007C117D /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146EE1CF9000F007C117D /* Runner.app */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 97C146F01CF9000F007C117D /* Runner */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 110 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 111 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 112 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 113 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 114 | 97C147021CF9000F007C117D /* Info.plist */, 115 | 97C146F11CF9000F007C117D /* Supporting Files */, 116 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 117 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 118 | ); 119 | path = Runner; 120 | sourceTree = ""; 121 | }; 122 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 97C146F21CF9000F007C117D /* main.m */, 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | /* End PBXGroup section */ 131 | 132 | /* Begin PBXNativeTarget section */ 133 | 97C146ED1CF9000F007C117D /* Runner */ = { 134 | isa = PBXNativeTarget; 135 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 136 | buildPhases = ( 137 | 9740EEB61CF901F6004384FC /* Run Script */, 138 | 97C146EA1CF9000F007C117D /* Sources */, 139 | 97C146EB1CF9000F007C117D /* Frameworks */, 140 | 97C146EC1CF9000F007C117D /* Resources */, 141 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 142 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = Runner; 149 | productName = Runner; 150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 97C146E61CF9000F007C117D /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastUpgradeCheck = 0910; 160 | ORGANIZATIONNAME = "The Chromium Authors"; 161 | TargetAttributes = { 162 | 97C146ED1CF9000F007C117D = { 163 | CreatedOnToolsVersion = 7.3.1; 164 | }; 165 | }; 166 | }; 167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 168 | compatibilityVersion = "Xcode 3.2"; 169 | developmentRegion = English; 170 | hasScannedForEncodings = 0; 171 | knownRegions = ( 172 | en, 173 | Base, 174 | ); 175 | mainGroup = 97C146E51CF9000F007C117D; 176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 97C146ED1CF9000F007C117D /* Runner */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 97C146EC1CF9000F007C117D /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 191 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, 192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 193 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 194 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 195 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 196 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXResourcesBuildPhase section */ 201 | 202 | /* Begin PBXShellScriptBuildPhase section */ 203 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 204 | isa = PBXShellScriptBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | ); 208 | inputPaths = ( 209 | ); 210 | name = "Thin Binary"; 211 | outputPaths = ( 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | shellPath = /bin/sh; 215 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 216 | }; 217 | 9740EEB61CF901F6004384FC /* Run Script */ = { 218 | isa = PBXShellScriptBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | ); 222 | inputPaths = ( 223 | ); 224 | name = "Run Script"; 225 | outputPaths = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | shellPath = /bin/sh; 229 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 230 | }; 231 | /* End PBXShellScriptBuildPhase section */ 232 | 233 | /* Begin PBXSourcesBuildPhase section */ 234 | 97C146EA1CF9000F007C117D /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 239 | 97C146F31CF9000F007C117D /* main.m in Sources */, 240 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXSourcesBuildPhase section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 97C146FB1CF9000F007C117D /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 97C147001CF9000F007C117D /* Base */, 259 | ); 260 | name = LaunchScreen.storyboard; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 97C147031CF9000F007C117D /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | CLANG_ANALYZER_NONNULL = YES; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INFINITE_RECURSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 288 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 289 | CLANG_WARN_STRICT_PROTOTYPES = YES; 290 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 291 | CLANG_WARN_UNREACHABLE_CODE = YES; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 294 | COPY_PHASE_STRIP = NO; 295 | DEBUG_INFORMATION_FORMAT = dwarf; 296 | ENABLE_STRICT_OBJC_MSGSEND = YES; 297 | ENABLE_TESTABILITY = YES; 298 | GCC_C_LANGUAGE_STANDARD = gnu99; 299 | GCC_DYNAMIC_NO_PIC = NO; 300 | GCC_NO_COMMON_BLOCKS = YES; 301 | GCC_OPTIMIZATION_LEVEL = 0; 302 | GCC_PREPROCESSOR_DEFINITIONS = ( 303 | "DEBUG=1", 304 | "$(inherited)", 305 | ); 306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 308 | GCC_WARN_UNDECLARED_SELECTOR = YES; 309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 310 | GCC_WARN_UNUSED_FUNCTION = YES; 311 | GCC_WARN_UNUSED_VARIABLE = YES; 312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 313 | MTL_ENABLE_DEBUG_INFO = YES; 314 | ONLY_ACTIVE_ARCH = YES; 315 | SDKROOT = iphoneos; 316 | TARGETED_DEVICE_FAMILY = "1,2"; 317 | }; 318 | name = Debug; 319 | }; 320 | 97C147041CF9000F007C117D /* Release */ = { 321 | isa = XCBuildConfiguration; 322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 323 | buildSettings = { 324 | ALWAYS_SEARCH_USER_PATHS = NO; 325 | CLANG_ANALYZER_NONNULL = YES; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_COMMA = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 343 | CLANG_WARN_STRICT_PROTOTYPES = YES; 344 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 350 | ENABLE_NS_ASSERTIONS = NO; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu99; 353 | GCC_NO_COMMON_BLOCKS = YES; 354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 356 | GCC_WARN_UNDECLARED_SELECTOR = YES; 357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 358 | GCC_WARN_UNUSED_FUNCTION = YES; 359 | GCC_WARN_UNUSED_VARIABLE = YES; 360 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 361 | MTL_ENABLE_DEBUG_INFO = NO; 362 | SDKROOT = iphoneos; 363 | TARGETED_DEVICE_FAMILY = "1,2"; 364 | VALIDATE_PRODUCT = YES; 365 | }; 366 | name = Release; 367 | }; 368 | 97C147061CF9000F007C117D /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 371 | buildSettings = { 372 | ARCHS = arm64; 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | CURRENT_PROJECT_VERSION = 1; 375 | ENABLE_BITCODE = NO; 376 | FRAMEWORK_SEARCH_PATHS = ( 377 | "$(inherited)", 378 | "$(PROJECT_DIR)/Flutter", 379 | ); 380 | INFOPLIST_FILE = Runner/Info.plist; 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 382 | LIBRARY_SEARCH_PATHS = ( 383 | "$(inherited)", 384 | "$(PROJECT_DIR)/Flutter", 385 | ); 386 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | VERSIONING_SYSTEM = "apple-generic"; 389 | }; 390 | name = Debug; 391 | }; 392 | 97C147071CF9000F007C117D /* Release */ = { 393 | isa = XCBuildConfiguration; 394 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 395 | buildSettings = { 396 | ARCHS = arm64; 397 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 398 | CURRENT_PROJECT_VERSION = 1; 399 | ENABLE_BITCODE = NO; 400 | FRAMEWORK_SEARCH_PATHS = ( 401 | "$(inherited)", 402 | "$(PROJECT_DIR)/Flutter", 403 | ); 404 | INFOPLIST_FILE = Runner/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 406 | LIBRARY_SEARCH_PATHS = ( 407 | "$(inherited)", 408 | "$(PROJECT_DIR)/Flutter", 409 | ); 410 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | VERSIONING_SYSTEM = "apple-generic"; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | 97C147031CF9000F007C117D /* Debug */, 423 | 97C147041CF9000F007C117D /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | 97C147061CF9000F007C117D /* Debug */, 432 | 97C147071CF9000F007C117D /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | /* End XCConfigurationList section */ 438 | }; 439 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 440 | } 441 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 77 | 78 | 79 | 80 | _show 81 | child 82 | createState 83 | turns 84 | StatefulWidget 85 | control 86 | _TabControllerScope 87 | onShow 88 | DropdownMenuController 89 | DefaultTabController 90 | onHide 91 | _DropdownMenuState 92 | _onController 93 | DropdownState 94 | _DropdownHeaderState 95 | activeIndex 96 | createMenu 97 | maxMenuHeight 98 | getItemLabel 99 | controller 100 | _getHeight 101 | shrinkWrap 102 | _ensureHeight 103 | itemExtent 104 | SizedBox 105 | height 106 | getData 107 | getSubData 108 | color 109 | blur 110 | 111 | 112 | _DropdownMenuScope 113 | DropdownMenuController 114 | 115 | 116 | 117 | 119 | 120 | 123 | 124 | 125 | 148 | 149 | 150 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 |