├── example ├── linux │ ├── .gitignore │ ├── main.cc │ ├── flutter │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugins.cmake │ │ └── CMakeLists.txt │ ├── my_application.h │ ├── my_application.cc │ └── CMakeLists.txt ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── Runner-Bridging-Header.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 │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── RunnerTests │ │ └── RunnerTests.swift │ └── .gitignore ├── macos │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner │ │ ├── Configs │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ ├── Warnings.xcconfig │ │ │ └── AppInfo.xcconfig │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ ├── app_icon_64.png │ │ │ │ ├── app_icon_1024.png │ │ │ │ └── Contents.json │ │ ├── Release.entitlements │ │ ├── AppDelegate.swift │ │ ├── DebugProfile.entitlements │ │ ├── MainFlutterWindow.swift │ │ └── Info.plist │ ├── .gitignore │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── RunnerTests │ │ └── RunnerTests.swift ├── date picker.png ├── range_picker.png ├── time picker.png ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── manifest.json │ └── index.html ├── date_time picker.png ├── bottom_picker_logo.gif ├── range_picker_arabic.png ├── simple item picker.png ├── android │ ├── gradle.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 │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── build.gradle │ └── settings.gradle ├── bottom_picker_custom_background.png ├── bottom_picker_with_button_style.png ├── bottom_picker_custom_close_button.png ├── windows │ ├── runner │ │ ├── resources │ │ │ └── app_icon.ico │ │ ├── resource.h │ │ ├── utils.h │ │ ├── runner.exe.manifest │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── CMakeLists.txt │ │ ├── utils.cpp │ │ ├── flutter_window.cpp │ │ ├── Runner.rc │ │ ├── win32_window.h │ │ └── win32_window.cpp │ ├── flutter │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugins.cmake │ │ └── CMakeLists.txt │ ├── .gitignore │ └── CMakeLists.txt ├── bottom_picker_custom_picker_text_style.png ├── pubspec.yaml ├── README.md ├── .gitignore ├── test │ └── widget_test.dart ├── .metadata └── pubspec.lock ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.yml │ └── bug_report.yml └── workflows │ ├── pull_request_pipeline.yml │ └── package_deploy.yml ├── lib ├── resources │ ├── values.dart │ ├── time.dart │ ├── context_extension.dart │ ├── arrays.dart │ └── extensions.dart └── widgets │ ├── close_icon.dart │ ├── time_picker.dart │ ├── bottom_picker_button.dart │ ├── simple_picker.dart │ ├── date_picker.dart │ ├── year_picker.dart │ └── range_picker.dart ├── bottom_picker_custom_close_button.png ├── analysis_options.yaml ├── .metadata ├── pubspec.yaml ├── .vscode ├── settings.json └── launch.json ├── LICENSE ├── .gitignore ├── pubspec.lock ├── test └── simple_bottom_picker_test.dart ├── CHANGELOG.md └── README.md /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /lib/resources/values.dart: -------------------------------------------------------------------------------- 1 | const double tabletMinSize = 768.0; 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/date picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/date picker.png -------------------------------------------------------------------------------- /example/range_picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/range_picker.png -------------------------------------------------------------------------------- /example/time picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/time picker.png -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /example/date_time picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/date_time picker.png -------------------------------------------------------------------------------- /example/bottom_picker_logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/bottom_picker_logo.gif -------------------------------------------------------------------------------- /example/range_picker_arabic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/range_picker_arabic.png -------------------------------------------------------------------------------- /example/simple item picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/simple item picker.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /bottom_picker_custom_close_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/bottom_picker_custom_close_button.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/bottom_picker_custom_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/bottom_picker_custom_background.png -------------------------------------------------------------------------------- /example/bottom_picker_with_button_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/bottom_picker_with_button_style.png -------------------------------------------------------------------------------- /example/bottom_picker_custom_close_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/bottom_picker_custom_close_button.png -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/bottom_picker_custom_picker_text_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/bottom_picker_custom_picker_text_style.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/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/koukibadr/Bottom-Picker/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip 6 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml 2 | linter: 3 | rules: 4 | avoid_print: true 5 | prefer_single_quotes: true 6 | always_declare_return_types: true 7 | require_trailing_commas: true 8 | 9 | # Additional information about this file can be found at 10 | # https://dart.dev/guides/language/analysis-options -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /app/.cxx 4 | /captures/ 5 | /gradlew 6 | /gradlew.bat 7 | /local.properties 8 | GeneratedPluginRegistrant.java 9 | 10 | # Remember to never publicly share your keystore. 11 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 12 | key.properties 13 | -------------------------------------------------------------------------------- /.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: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: bottom_picker 2 | description: An easy way that let you create a bottom item picker or date & time picker with minmum parameters 3 | version: 4.1.1 4 | homepage: 'https://github.com/koukibadr/Bottom-Picker' 5 | environment: 6 | sdk: '>=2.19.0 <4.0.0' 7 | flutter: '>=1.17.0' 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | dev_dependencies: 12 | flutter_test: 13 | sdk: flutter 14 | flutter_lints: ^6.0.0 15 | flutter: null 16 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | publish_to: none 4 | version: 1.0.0+1 5 | environment: 6 | sdk: '>=2.12.0 <3.0.0' 7 | dependencies: 8 | flutter: 9 | sdk: flutter 10 | flutter_localizations: 11 | sdk: flutter 12 | intl: any 13 | bottom_picker: 14 | path: ../ 15 | cupertino_icons: ^1.0.2 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter: 20 | uses-material-design: true 21 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /lib/resources/time.dart: -------------------------------------------------------------------------------- 1 | class Time { 2 | late int hours; 3 | late int minutes; 4 | 5 | Time({ 6 | this.hours = 0, 7 | this.minutes = 0, 8 | }) : assert(minutes < 60 && minutes >= 0 && hours >= 0 && hours < 24); 9 | 10 | Time.now() { 11 | hours = DateTime.now().hour; 12 | minutes = DateTime.now().minute; 13 | } 14 | 15 | DateTime get toDateTime => DateTime( 16 | DateTime.now().year, 17 | DateTime.now().month, 18 | DateTime.now().day, 19 | hours, 20 | minutes, 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/resources/context_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/resources/values.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | 4 | extension ContextExtensions on BuildContext { 5 | double get bottomPickerWidth => 6 | MediaQuery.of(this).size.width >= tabletMinSize 7 | ? MediaQuery.of(this).size.width * 0.7 8 | : MediaQuery.of(this).size.width; 9 | 10 | double get bottomPickerHeight => 11 | MediaQuery.of(this).size.height >= tabletMinSize 12 | ? MediaQuery.of(this).size.height * 0.35 13 | : MediaQuery.of(this).size.height * 0.45; 14 | } 15 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /lib/widgets/close_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CloseIcon extends StatelessWidget { 4 | final Function() onPress; 5 | final Color? iconColor; 6 | final double? closeIconSize; 7 | 8 | const CloseIcon({ 9 | super.key, 10 | required this.onPress, 11 | required this.iconColor, 12 | required this.closeIconSize, 13 | }); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return InkWell( 18 | onTap: onPress, 19 | child: Icon( 20 | Icons.close, 21 | color: iconColor, 22 | size: closeIconSize, 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/ephemeral/ 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version '8.7.0' apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /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 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#192a36", 4 | "activityBar.background": "#192a36", 5 | "activityBar.foreground": "#e7e7e7", 6 | "activityBar.inactiveForeground": "#e7e7e799", 7 | "activityBarBadge.background": "#984777", 8 | "activityBarBadge.foreground": "#e7e7e7", 9 | "commandCenter.border": "#e7e7e799", 10 | "sash.hoverBorder": "#192a36", 11 | "statusBar.background": "#090f13", 12 | "statusBar.foreground": "#e7e7e7", 13 | "statusBarItem.hoverBackground": "#192a36", 14 | "statusBarItem.remoteBackground": "#090f13", 15 | "statusBarItem.remoteForeground": "#e7e7e7", 16 | "titleBar.activeBackground": "#090f13", 17 | "titleBar.activeForeground": "#e7e7e7", 18 | "titleBar.inactiveBackground": "#090f1399", 19 | "titleBar.inactiveForeground": "#e7e7e799" 20 | }, 21 | "peacock.color": "090F13" 22 | } -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/resources/arrays.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | enum BottomPickerType { 4 | simple, 5 | time, 6 | timer, 7 | dateTime, 8 | year, 9 | rangeDate, 10 | rangeTime, 11 | } 12 | 13 | enum BottomPickerTheme { 14 | blue( 15 | gradientColors: [ 16 | Color(0xFF3366FF), 17 | Color(0xFF00CCFF), 18 | ], 19 | ), 20 | orange( 21 | gradientColors: [ 22 | Color(0xFFff7e5f), 23 | Color(0xFFfeb47b), 24 | ], 25 | ), 26 | temptingAzure( 27 | gradientColors: [ 28 | Color(0xFF84fab0), 29 | Color(0xFF8fd3f4), 30 | ], 31 | ), 32 | heavyRain( 33 | gradientColors: [ 34 | Color(0xFFcfd9df), 35 | Color(0xFFe2ebf0), 36 | ], 37 | ), 38 | plumPlate( 39 | gradientColors: [ 40 | Color(0xFF667eea), 41 | Color(0xFF764ba2), 42 | ], 43 | ), 44 | morningSalad( 45 | gradientColors: [ 46 | Color(0xFFB7F8DB), 47 | Color(0xFF50A7C2), 48 | ], 49 | ); 50 | 51 | final List gradientColors; 52 | 53 | const BottomPickerTheme({ 54 | required this.gradientColors, 55 | }); 56 | } 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2023 Scott Chacon and others 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /lib/resources/extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/bottom_picker.dart'; 2 | 3 | extension BottomPickerExtension on BottomPicker { 4 | void assertInitialValues() { 5 | if (minDateTime != null && maxDateTime != null) { 6 | assert(minDateTime!.isBefore(maxDateTime!)); 7 | } 8 | if (maxDateTime != null && 9 | initialDateTime == null && 10 | DateTime.now().isAfter(maxDateTime!)) { 11 | initialDateTime = maxDateTime; 12 | } 13 | 14 | if (minDateTime != null && 15 | initialDateTime == null && 16 | DateTime.now().isBefore(minDateTime!)) { 17 | initialDateTime = minDateTime; 18 | } 19 | } 20 | } 21 | 22 | extension TimeClassExtensions on Time? { 23 | DateTime? get toDateTime => this == null 24 | ? null 25 | : DateTime( 26 | DateTime.now().year, 27 | DateTime.now().month, 28 | DateTime.now().day, 29 | this!.hours, 30 | this!.minutes, 31 | ); 32 | } 33 | 34 | extension DateTimeExtions on DateTime { 35 | bool isAtSameMomentOrAfter(DateTime secondDateTime) { 36 | return this == secondDateTime || isAfter(secondDateTime); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | 9 | android { 10 | namespace = "com.example.example" 11 | compileSdk = flutter.compileSdkVersion 12 | ndkVersion = flutter.ndkVersion 13 | 14 | compileOptions { 15 | sourceCompatibility = JavaVersion.VERSION_1_8 16 | targetCompatibility = JavaVersion.VERSION_1_8 17 | } 18 | 19 | kotlinOptions { 20 | jvmTarget = JavaVersion.VERSION_1_8 21 | } 22 | 23 | sourceSets { 24 | main.java.srcDirs += 'src/main/kotlin' 25 | } 26 | 27 | defaultConfig { 28 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 29 | applicationId "com.example.example" 30 | minSdkVersion flutter.minSdkVersion 31 | targetSdkVersion 35 32 | versionCode 1 33 | versionName "1.0" 34 | } 35 | 36 | buildTypes { 37 | release { 38 | // TODO: Add your own signing config for the release build. 39 | // Signing with the debug keys for now, so `flutter run --release` works. 40 | signingConfig signingConfigs.debug 41 | } 42 | } 43 | } 44 | 45 | flutter { 46 | source '../..' 47 | } 48 | 49 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "name": "Bottom-Picker", 10 | "request": "launch", 11 | "type": "dart" 12 | }, 13 | { 14 | "name": "Bottom-Picker (profile mode)", 15 | "request": "launch", 16 | "type": "dart", 17 | "flutterMode": "profile" 18 | }, 19 | { 20 | "name": "Bottom-Picker (release mode)", 21 | "request": "launch", 22 | "type": "dart", 23 | "flutterMode": "release" 24 | }, 25 | { 26 | "name": "example", 27 | "cwd": "example", 28 | "request": "launch", 29 | "type": "dart" 30 | }, 31 | { 32 | "name": "example (profile mode)", 33 | "cwd": "example", 34 | "request": "launch", 35 | "type": "dart", 36 | "flutterMode": "profile" 37 | }, 38 | { 39 | "name": "example (release mode)", 40 | "cwd": "example", 41 | "request": "launch", 42 | "type": "dart", 43 | "flutterMode": "release" 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /lib/widgets/time_picker.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class TimePicker extends StatelessWidget { 5 | final CupertinoTimerPickerMode mode; 6 | final int minuteInterval; 7 | final TextStyle? textStyle; 8 | final double itemExtent; 9 | final Function(Duration) onChange; 10 | final Duration? initialDuration; 11 | final int secondInterval; 12 | final CupertinoTextThemeData? pickerThemeData; 13 | 14 | const TimePicker({ 15 | super.key, 16 | this.minuteInterval = 1, 17 | required this.mode, 18 | required this.textStyle, 19 | required this.itemExtent, 20 | required this.onChange, 21 | required this.initialDuration, 22 | this.secondInterval = 1, 23 | this.pickerThemeData, 24 | }); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return CupertinoTheme( 29 | data: CupertinoThemeData( 30 | textTheme: pickerThemeData ?? 31 | CupertinoTextThemeData( 32 | dateTimePickerTextStyle: textStyle, 33 | ), 34 | ), 35 | child: CupertinoTimerPicker( 36 | itemExtent: itemExtent, 37 | mode: mode, 38 | onTimerDurationChanged: onChange, 39 | minuteInterval: minuteInterval, 40 | initialTimerDuration: initialDuration ?? Duration.zero, 41 | backgroundColor: Colors.transparent, 42 | secondInterval: 1, 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest a new idea for Bottom picker 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Thank you for using BottomPicker! 8 | 9 | You're feature request is important to us. Please provide as much information as possible 10 | to help us understand the feature you're requesting. This will help us to implement it faster. 11 | - type: markdown 12 | attributes: 13 | value: | 14 | Before filling the form fields, please consider the following: 15 | - Ensure that you have searched the [existing issues](https://github.com/koukibadr/Bottom-Picker/issues) 16 | - type: textarea 17 | attributes: 18 | label: Use case 19 | description: | 20 | Please tell us the problem you are running into that led to you wanting 21 | a new feature. 22 | 23 | Is your feature request related to a problem? Please give a clear and 24 | concise description of what the problem is. 25 | validations: 26 | required: true 27 | - type: textarea 28 | attributes: 29 | label: Proposal 30 | description: | 31 | Briefly but precisely describe what you would like the picker to be able to do. 32 | 33 | Consider attaching something showing what you are imagining: 34 | * images 35 | * videos 36 | * code samples 37 | validations: 38 | required: false 39 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /.github/workflows/pull_request_pipeline.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | branches: [ "main" ] 4 | jobs: 5 | 6 | analyze-code: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - name: Install Flutter 11 | uses: subosito/flutter-action@v2 12 | with: 13 | channel: stable 14 | - name: Install dependencies 15 | run: flutter pub get 16 | 17 | - name: Running Flutter analysis on package code 18 | run: flutter analyze --no-fatal-infos --no-fatal-warnings --write=analysis_report.txt 19 | 20 | - name: Artifact analysis report 21 | uses: actions/upload-artifact@v4 22 | if: always() 23 | with: 24 | name: analysis-report 25 | path: | 26 | analysis_report.txt 27 | retention-days: 15 28 | unit-test: 29 | runs-on: ubuntu-latest 30 | steps: 31 | - uses: actions/checkout@v2 32 | - name: Install Flutter 33 | uses: subosito/flutter-action@v2 34 | with: 35 | channel: stable 36 | 37 | - name: Install dependencies 38 | run: flutter pub get 39 | 40 | - name: Run unit tests 41 | run: flutter test 42 | dry-run-upload: 43 | needs: [analyze-code, unit-test] 44 | runs-on: ubuntu-latest 45 | steps: 46 | - uses: actions/checkout@v2 47 | - name: Install Flutter 48 | uses: subosito/flutter-action@v2 49 | with: 50 | channel: stable 51 | 52 | - name: Install dependencies 53 | run: flutter pub get 54 | 55 | - name: Check Publish Warnings 56 | run: dart pub publish --dry-run -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | example 30 | 31 | 32 | 33 | 36 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /.github/workflows/package_deploy.yml: -------------------------------------------------------------------------------- 1 | on: 2 | release: 3 | types: [published] 4 | jobs: 5 | 6 | analyze-code: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - name: Install Flutter 11 | uses: subosito/flutter-action@v2 12 | with: 13 | channel: stable 14 | - name: Install dependencies 15 | run: flutter pub get 16 | 17 | - name: Running Flutter analysis on package code 18 | run: flutter analyze --no-fatal-infos --no-fatal-warnings --write=analysis_report.txt 19 | 20 | - name: Artifact analysis report 21 | uses: actions/upload-artifact@v4 22 | if: always() 23 | with: 24 | name: analysis-report 25 | path: | 26 | analysis_report.txt 27 | retention-days: 15 28 | unit-test: 29 | runs-on: ubuntu-latest 30 | steps: 31 | - uses: actions/checkout@v2 32 | - name: Install Flutter 33 | uses: subosito/flutter-action@v2 34 | with: 35 | channel: stable 36 | 37 | - name: Install dependencies 38 | run: flutter pub get 39 | 40 | - name: Run unit tests 41 | run: flutter test 42 | upload-package: 43 | needs: [analyze-code, unit-test] 44 | runs-on: ubuntu-latest 45 | steps: 46 | - uses: actions/checkout@v2 47 | - name: Install Flutter 48 | uses: subosito/flutter-action@v2 49 | with: 50 | channel: stable 51 | 52 | - name: Install dependencies 53 | run: flutter pub get 54 | 55 | - name: Check Publish Warnings 56 | run: dart pub publish --dry-run 57 | 58 | - name: Publish new package version 59 | uses: k-paxian/dart-package-publisher@master 60 | with: 61 | credentialJson: ${{ secrets.CREDENTIAL_JSON }} 62 | flutter: true -------------------------------------------------------------------------------- /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: "761747bfc538b5af34aa0d3fac380f1bc331ec49" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 17 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 18 | - platform: android 19 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 20 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 21 | - platform: ios 22 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 23 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 24 | - platform: linux 25 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 26 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 27 | - platform: macos 28 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 29 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 30 | - platform: web 31 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 32 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 33 | - platform: windows 34 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 35 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /lib/widgets/bottom_picker_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/resources/arrays.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class BottomPickerButton extends StatelessWidget { 5 | final Function onClick; 6 | final BottomPickerTheme theme; 7 | final List? gradients; 8 | final Color? solidColor; 9 | final double? buttonPadding; 10 | final double? buttonWidth; 11 | final Widget? buttonChild; 12 | final BoxDecoration? style; 13 | 14 | const BottomPickerButton({ 15 | super.key, 16 | required this.onClick, 17 | this.theme = BottomPickerTheme.blue, 18 | this.gradients, 19 | this.solidColor, 20 | this.buttonPadding, 21 | this.buttonWidth, 22 | this.buttonChild, 23 | this.style, 24 | }); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return InkWell( 29 | onTap: () { 30 | onClick.call(); 31 | }, 32 | child: Container( 33 | width: buttonWidth ?? 100, 34 | padding: EdgeInsets.all(buttonPadding ?? 8.0), 35 | decoration: style ?? 36 | BoxDecoration( 37 | borderRadius: BorderRadius.circular(5), 38 | color: solidColor, 39 | gradient: solidColor == null 40 | ? LinearGradient( 41 | colors: gradients ?? theme.gradientColors, 42 | begin: const FractionalOffset(0.0, 0.0), 43 | end: const FractionalOffset(1.0, 0.0), 44 | stops: const [0.0, 1.0], 45 | tileMode: TileMode.clamp, 46 | ) 47 | : null, 48 | ), 49 | child: buttonChild ?? 50 | const Center( 51 | child: Text( 52 | 'Select', 53 | style: TextStyle( 54 | color: Colors.white, 55 | ), 56 | ), 57 | ), 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /lib/widgets/simple_picker.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | 6 | class SimplePicker extends StatelessWidget { 7 | final int selectedItemIndex; 8 | final Function(int)? onChange; 9 | final List items; 10 | final TextStyle? textStyle; 11 | final double itemExtent; 12 | final Widget? selectionOverlay; 13 | final CupertinoTextThemeData? pickerThemeData; 14 | final double diameterRatio; 15 | 16 | const SimplePicker({ 17 | super.key, 18 | required this.items, 19 | required this.onChange, 20 | required this.selectedItemIndex, 21 | this.textStyle, 22 | required this.itemExtent, 23 | this.selectionOverlay, 24 | this.pickerThemeData, 25 | required this.diameterRatio, 26 | }); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | if (!kIsWeb && (Platform.isIOS || Platform.isAndroid)) { 31 | return CupertinoTheme( 32 | data: CupertinoThemeData( 33 | textTheme: pickerThemeData ?? 34 | CupertinoTextThemeData( 35 | pickerTextStyle: textStyle, 36 | ), 37 | ), 38 | child: CupertinoPicker( 39 | offAxisFraction: 2.0, 40 | diameterRatio: diameterRatio, 41 | itemExtent: itemExtent, 42 | selectionOverlay: selectionOverlay ?? 43 | const CupertinoPickerDefaultSelectionOverlay(), 44 | scrollController: FixedExtentScrollController( 45 | initialItem: selectedItemIndex, 46 | ), 47 | onSelectedItemChanged: onChange, 48 | children: items, 49 | ), 50 | ); 51 | } else { 52 | return ListWheelScrollView( 53 | itemExtent: itemExtent, 54 | children: items, 55 | useMagnifier: true, 56 | magnification: 1.5, 57 | controller: FixedExtentScrollController( 58 | initialItem: selectedItemIndex, 59 | ), 60 | onSelectedItemChanged: onChange, 61 | ); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /lib/widgets/date_picker.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/cupertino/cupertino_date_picker.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | 4 | class DatePicker extends StatelessWidget { 5 | final CupertinoDatePickerMode mode; 6 | final Function(DateTime) onDateChanged; 7 | final DateTime? initialDateTime; 8 | final DateTime? maxDateTime; 9 | final DateTime? minDateTime; 10 | final int minuteInterval; 11 | final bool use24hFormat; 12 | final DatePickerDateOrder? dateOrder; 13 | final TextStyle? textStyle; 14 | final double? itemExtent; 15 | final bool showTimeSeparator; 16 | final List calendarDays; 17 | final CupertinoTextThemeData? pickerThemeData; 18 | final SelectableHourPredicate? hourPredicate; 19 | 20 | const DatePicker({ 21 | super.key, 22 | required this.initialDateTime, 23 | this.minuteInterval = 1, 24 | this.maxDateTime, 25 | this.minDateTime, 26 | required this.mode, 27 | required this.onDateChanged, 28 | this.use24hFormat = true, 29 | required this.textStyle, 30 | this.dateOrder, 31 | this.itemExtent = 0, 32 | this.showTimeSeparator = false, 33 | this.calendarDays = CupertinoDatePickerWidget.fullWeek, 34 | this.pickerThemeData, 35 | this.hourPredicate, 36 | }); 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return CupertinoTheme( 41 | data: CupertinoThemeData( 42 | textTheme: pickerThemeData ?? 43 | CupertinoTextThemeData( 44 | dateTimePickerTextStyle: textStyle, 45 | ), 46 | ), 47 | child: CupertinoDatePickerWidget( 48 | itemExtent: itemExtent ?? 0, 49 | showTimeSeparator: showTimeSeparator, 50 | mode: mode, 51 | selectableHourPredicate: hourPredicate, 52 | onDateTimeChanged: onDateChanged, 53 | initialDateTime: initialDateTime, 54 | minuteInterval: minuteInterval, 55 | maximumDate: maxDateTime, 56 | minimumDate: minDateTime, 57 | use24hFormat: use24hFormat, 58 | dateOrder: dateOrder, 59 | calendarDays: calendarDays, 60 | ), 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/widgets/year_picker.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/widgets/simple_picker.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | 4 | class BottomYearDatePicker extends StatefulWidget { 5 | final Function(DateTime) onDateChanged; 6 | final DateTime? initialDateTime; 7 | final DateTime? maxDateTime; 8 | final DateTime? minDateTime; 9 | final double? itemExtent; 10 | final CupertinoTextThemeData? pickerThemeData; 11 | 12 | const BottomYearDatePicker({ 13 | super.key, 14 | required this.onDateChanged, 15 | this.initialDateTime, 16 | this.maxDateTime, 17 | this.minDateTime, 18 | this.itemExtent = 0, 19 | this.pickerThemeData, 20 | }); 21 | 22 | @override 23 | State createState() => _BottomYearDatePicker(); 24 | } 25 | 26 | class _BottomYearDatePicker extends State { 27 | List years = []; 28 | int initialYear = 0; 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | int lastYear = widget.maxDateTime == null 34 | ? DateTime.now().year + 100 35 | : widget.maxDateTime!.year; 36 | int firstYear = widget.minDateTime == null 37 | ? DateTime.now().year - 100 38 | : widget.minDateTime!.year; 39 | 40 | years = List.generate( 41 | lastYear - firstYear + 1, 42 | (index) => firstYear + index, 43 | ); 44 | 45 | if (widget.initialDateTime != null) { 46 | initialYear = widget.initialDateTime!.year; 47 | } else if (years.contains(DateTime.now().year)) { 48 | initialYear = DateTime.now().year; 49 | } else { 50 | initialYear = firstYear; 51 | } 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | return SimplePicker( 57 | items: years 58 | .map( 59 | (year) => Text( 60 | year.toString(), 61 | ), 62 | ) 63 | .toList(), 64 | onChange: (index) { 65 | widget.onDateChanged( 66 | DateTime( 67 | years[index], 68 | ), 69 | ); 70 | }, 71 | selectedItemIndex: 0, 72 | itemExtent: widget.itemExtent ?? 0, 73 | pickerThemeData: widget.pickerThemeData, 74 | diameterRatio: 1.1, 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 14 | 18 | 22 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Report a bug 2 | description: | 3 | You're encountred a bug with the BottomPicker widget, 4 | causing the app to crash or faulty picker values or rendering issue or something else. 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for using BottomPicker! 10 | 11 | You're bug report is important to us. Please provide as much information as possible 12 | to help us understand the issue you're facing. This will help us to fix it faster. 13 | - type: markdown 14 | attributes: 15 | value: | 16 | Before filling the form fields, please consider the following: 17 | - Ensure that you have searched the [existing issues](https://github.com/koukibadr/Bottom-Picker/issues) 18 | - type: textarea 19 | attributes: 20 | label: Steps to reproduce 21 | description: Please tell us exactly how to reproduce the problem you are running into. 22 | placeholder: | 23 | 1. ... 24 | 2. ... 25 | 3. ... 26 | validations: 27 | required: true 28 | - type: textarea 29 | attributes: 30 | label: Actual results 31 | description: Please tell us what is actually happening. 32 | validations: 33 | required: false 34 | - type: textarea 35 | attributes: 36 | label: Expected results 37 | description: Please tell us what is expected to happen. 38 | validations: 39 | required: false 40 | - type: textarea 41 | attributes: 42 | label: Code sample 43 | description: | 44 | Please create a minimal reproducible sample that shows the problem 45 | and attach it below between the lines with the backticks. 46 | value: | 47 |
Bottom picker implementation 48 | 49 | ```dart 50 | [Paste your code here] 51 | ``` 52 | 53 |
54 | validations: 55 | required: false 56 | - type: textarea 57 | attributes: 58 | label: Screenshots or Video 59 | description: | 60 | Upload any screenshots or video of the bug if applicable. 61 | value: | 62 |
Upload media 63 | 64 | [Upload media here] 65 | 66 |
67 | - type: textarea 68 | attributes: 69 | label: Logs 70 | description: | 71 | Include the full logs of the commands you are running between the lines 72 | with the backticks below. 73 | value: | 74 |
Logs 75 | 76 | ```console 77 | [Paste your logs here] 78 | ``` 79 | 80 |
81 | - type: textarea 82 | attributes: 83 | label: Flutter Doctor output 84 | description: | 85 | Please provide the full output of running `flutter doctor -v` 86 | value: | 87 |
Doctor output 88 | 89 | ```console 90 | [Paste your output here] 91 | ``` 92 | 93 |
94 | validations: 95 | required: false 96 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 55 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 74 | 76 | 82 | 83 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | return MY_APPLICATION(g_object_new(my_application_get_type(), 121 | "application-id", APPLICATION_ID, 122 | "flags", G_APPLICATION_NON_UNIQUE, 123 | nullptr)); 124 | } 125 | -------------------------------------------------------------------------------- /lib/widgets/range_picker.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/widgets/date_picker.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | 4 | class RangePicker extends StatefulWidget { 5 | final Function(DateTime) onFirstDateChanged; 6 | final Function(DateTime) onSecondDateChanged; 7 | final DateTime? initialFirstDateTime; 8 | final DateTime? initialSecondDateTime; 9 | final DateTime? maxFirstDate; 10 | final DateTime? maxSecondDate; 11 | final DateTime? minFirstDateTime; 12 | final DateTime? minSecondDateTime; 13 | final DatePickerDateOrder? dateOrder; 14 | final TextStyle? textStyle; 15 | final CupertinoDatePickerMode mode; 16 | final bool use24hFormat; 17 | final int? minuteInterval; 18 | final double? itemExtent; 19 | final bool showTimeSeperator; 20 | final CupertinoTextThemeData? pickerThemeData; 21 | 22 | const RangePicker({ 23 | super.key, 24 | required this.initialFirstDateTime, 25 | required this.initialSecondDateTime, 26 | required this.maxFirstDate, 27 | required this.minFirstDateTime, 28 | required this.maxSecondDate, 29 | required this.minSecondDateTime, 30 | required this.onFirstDateChanged, 31 | required this.onSecondDateChanged, 32 | this.dateOrder, 33 | required this.textStyle, 34 | required this.mode, 35 | required this.use24hFormat, 36 | this.minuteInterval, 37 | this.itemExtent, 38 | this.showTimeSeperator = false, 39 | this.pickerThemeData, 40 | }); 41 | 42 | @override 43 | State createState() => _RangePickerState(); 44 | } 45 | 46 | class _RangePickerState extends State { 47 | late DateTime? minSecondDateTime = widget.minSecondDateTime; 48 | late DateTime? initialSecondDateTime = widget.initialSecondDateTime; 49 | 50 | late DateTime? initialFirstDateTime = widget.initialFirstDateTime; 51 | late DateTime? minFirstDateTime = widget.minFirstDateTime; 52 | 53 | @override 54 | void initState() { 55 | super.initState(); 56 | if (widget.mode == CupertinoDatePickerMode.time) { 57 | // If it is a time range, the minimum time uses the date of the day, ignores the date, and only needs the time 58 | // The default is 0:0:0 59 | minFirstDateTime = widget.minFirstDateTime ?? 60 | DateTime( 61 | DateTime.now().year, 62 | DateTime.now().month, 63 | DateTime.now().day, 64 | ); 65 | initialFirstDateTime = widget.initialFirstDateTime ?? minFirstDateTime; 66 | minSecondDateTime = widget.minSecondDateTime ?? 67 | DateTime( 68 | DateTime.now().year, 69 | DateTime.now().month, 70 | DateTime.now().day, 71 | ); 72 | initialSecondDateTime = widget.initialSecondDateTime ?? minSecondDateTime; 73 | 74 | widget.onFirstDateChanged(initialFirstDateTime!); 75 | widget.onSecondDateChanged(initialSecondDateTime!); 76 | } 77 | } 78 | 79 | @override 80 | Widget build(BuildContext context) { 81 | return Row( 82 | children: [ 83 | Expanded( 84 | child: DatePicker( 85 | use24hFormat: widget.use24hFormat, 86 | initialDateTime: initialFirstDateTime, 87 | maxDateTime: widget.maxFirstDate, 88 | minDateTime: minFirstDateTime, 89 | minuteInterval: widget.minuteInterval ?? 1, 90 | mode: widget.mode, 91 | itemExtent: widget.itemExtent, 92 | showTimeSeparator: widget.showTimeSeperator, 93 | onDateChanged: (date) { 94 | widget.onFirstDateChanged.call(date); 95 | if (initialSecondDateTime!.isBefore(date)) { 96 | widget.onSecondDateChanged.call(date); 97 | setState(() { 98 | initialSecondDateTime = date; 99 | minSecondDateTime = date; 100 | }); 101 | } else { 102 | setState(() { 103 | minSecondDateTime = date; 104 | }); 105 | } 106 | }, 107 | dateOrder: widget.dateOrder, 108 | textStyle: widget.textStyle, 109 | pickerThemeData: widget.pickerThemeData, 110 | ), 111 | ), 112 | Expanded( 113 | child: DatePicker( 114 | key: UniqueKey(), 115 | use24hFormat: widget.use24hFormat, 116 | initialDateTime: initialSecondDateTime, 117 | maxDateTime: widget.maxSecondDate, 118 | minDateTime: minSecondDateTime, 119 | mode: widget.mode, 120 | onDateChanged: widget.onSecondDateChanged, 121 | dateOrder: widget.dateOrder, 122 | textStyle: widget.textStyle, 123 | minuteInterval: widget.minuteInterval ?? 1, 124 | itemExtent: widget.itemExtent, 125 | showTimeSeparator: widget.showTimeSeperator, 126 | pickerThemeData: widget.pickerThemeData, 127 | ), 128 | ), 129 | ], 130 | ); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Copy the native assets provided by the build.dart from all packages. 127 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 128 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 129 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 130 | COMPONENT Runtime) 131 | 132 | # Fully re-copy the assets directory on each build to avoid having stale files 133 | # from a previous install. 134 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 135 | install(CODE " 136 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 137 | " COMPONENT Runtime) 138 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 139 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 140 | 141 | # Install the AOT library on non-Debug builds only. 142 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 143 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 144 | COMPONENT Runtime) 145 | endif() 146 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.13.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.3" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_lints: 58 | dependency: "direct dev" 59 | description: 60 | name: flutter_lints 61 | sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "6.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | leak_tracker: 71 | dependency: transitive 72 | description: 73 | name: leak_tracker 74 | sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" 75 | url: "https://pub.dev" 76 | source: hosted 77 | version: "10.0.9" 78 | leak_tracker_flutter_testing: 79 | dependency: transitive 80 | description: 81 | name: leak_tracker_flutter_testing 82 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 83 | url: "https://pub.dev" 84 | source: hosted 85 | version: "3.0.9" 86 | leak_tracker_testing: 87 | dependency: transitive 88 | description: 89 | name: leak_tracker_testing 90 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 91 | url: "https://pub.dev" 92 | source: hosted 93 | version: "3.0.1" 94 | lints: 95 | dependency: transitive 96 | description: 97 | name: lints 98 | sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 99 | url: "https://pub.dev" 100 | source: hosted 101 | version: "6.0.0" 102 | matcher: 103 | dependency: transitive 104 | description: 105 | name: matcher 106 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 107 | url: "https://pub.dev" 108 | source: hosted 109 | version: "0.12.17" 110 | material_color_utilities: 111 | dependency: transitive 112 | description: 113 | name: material_color_utilities 114 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 115 | url: "https://pub.dev" 116 | source: hosted 117 | version: "0.11.1" 118 | meta: 119 | dependency: transitive 120 | description: 121 | name: meta 122 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 123 | url: "https://pub.dev" 124 | source: hosted 125 | version: "1.16.0" 126 | path: 127 | dependency: transitive 128 | description: 129 | name: path 130 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 131 | url: "https://pub.dev" 132 | source: hosted 133 | version: "1.9.1" 134 | sky_engine: 135 | dependency: transitive 136 | description: flutter 137 | source: sdk 138 | version: "0.0.0" 139 | source_span: 140 | dependency: transitive 141 | description: 142 | name: source_span 143 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 144 | url: "https://pub.dev" 145 | source: hosted 146 | version: "1.10.1" 147 | stack_trace: 148 | dependency: transitive 149 | description: 150 | name: stack_trace 151 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 152 | url: "https://pub.dev" 153 | source: hosted 154 | version: "1.12.1" 155 | stream_channel: 156 | dependency: transitive 157 | description: 158 | name: stream_channel 159 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "2.1.4" 163 | string_scanner: 164 | dependency: transitive 165 | description: 166 | name: string_scanner 167 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.4.1" 171 | term_glyph: 172 | dependency: transitive 173 | description: 174 | name: term_glyph 175 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "1.2.2" 179 | test_api: 180 | dependency: transitive 181 | description: 182 | name: test_api 183 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "0.7.4" 187 | vector_math: 188 | dependency: transitive 189 | description: 190 | name: vector_math 191 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 192 | url: "https://pub.dev" 193 | source: hosted 194 | version: "2.1.4" 195 | vm_service: 196 | dependency: transitive 197 | description: 198 | name: vm_service 199 | sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 200 | url: "https://pub.dev" 201 | source: hosted 202 | version: "15.0.0" 203 | sdks: 204 | dart: ">=3.8.0 <4.0.0" 205 | flutter: ">=3.18.0-18.0.pre.54" 206 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.13.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | bottom_picker: 21 | dependency: "direct main" 22 | description: 23 | path: ".." 24 | relative: true 25 | source: path 26 | version: "3.2.1" 27 | characters: 28 | dependency: transitive 29 | description: 30 | name: characters 31 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 32 | url: "https://pub.dev" 33 | source: hosted 34 | version: "1.4.0" 35 | clock: 36 | dependency: transitive 37 | description: 38 | name: clock 39 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 40 | url: "https://pub.dev" 41 | source: hosted 42 | version: "1.1.2" 43 | collection: 44 | dependency: transitive 45 | description: 46 | name: collection 47 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 48 | url: "https://pub.dev" 49 | source: hosted 50 | version: "1.19.1" 51 | cupertino_icons: 52 | dependency: "direct main" 53 | description: 54 | name: cupertino_icons 55 | sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 56 | url: "https://pub.dev" 57 | source: hosted 58 | version: "1.0.8" 59 | fake_async: 60 | dependency: transitive 61 | description: 62 | name: fake_async 63 | sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" 64 | url: "https://pub.dev" 65 | source: hosted 66 | version: "1.3.3" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_localizations: 73 | dependency: "direct main" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | flutter_test: 78 | dependency: "direct dev" 79 | description: flutter 80 | source: sdk 81 | version: "0.0.0" 82 | intl: 83 | dependency: "direct main" 84 | description: 85 | name: intl 86 | sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" 87 | url: "https://pub.dev" 88 | source: hosted 89 | version: "0.20.2" 90 | leak_tracker: 91 | dependency: transitive 92 | description: 93 | name: leak_tracker 94 | sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" 95 | url: "https://pub.dev" 96 | source: hosted 97 | version: "10.0.9" 98 | leak_tracker_flutter_testing: 99 | dependency: transitive 100 | description: 101 | name: leak_tracker_flutter_testing 102 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 103 | url: "https://pub.dev" 104 | source: hosted 105 | version: "3.0.9" 106 | leak_tracker_testing: 107 | dependency: transitive 108 | description: 109 | name: leak_tracker_testing 110 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 111 | url: "https://pub.dev" 112 | source: hosted 113 | version: "3.0.1" 114 | matcher: 115 | dependency: transitive 116 | description: 117 | name: matcher 118 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 119 | url: "https://pub.dev" 120 | source: hosted 121 | version: "0.12.17" 122 | material_color_utilities: 123 | dependency: transitive 124 | description: 125 | name: material_color_utilities 126 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 127 | url: "https://pub.dev" 128 | source: hosted 129 | version: "0.11.1" 130 | meta: 131 | dependency: transitive 132 | description: 133 | name: meta 134 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 135 | url: "https://pub.dev" 136 | source: hosted 137 | version: "1.16.0" 138 | path: 139 | dependency: transitive 140 | description: 141 | name: path 142 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 143 | url: "https://pub.dev" 144 | source: hosted 145 | version: "1.9.1" 146 | sky_engine: 147 | dependency: transitive 148 | description: flutter 149 | source: sdk 150 | version: "0.0.0" 151 | source_span: 152 | dependency: transitive 153 | description: 154 | name: source_span 155 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 156 | url: "https://pub.dev" 157 | source: hosted 158 | version: "1.10.1" 159 | stack_trace: 160 | dependency: transitive 161 | description: 162 | name: stack_trace 163 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 164 | url: "https://pub.dev" 165 | source: hosted 166 | version: "1.12.1" 167 | stream_channel: 168 | dependency: transitive 169 | description: 170 | name: stream_channel 171 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 172 | url: "https://pub.dev" 173 | source: hosted 174 | version: "2.1.4" 175 | string_scanner: 176 | dependency: transitive 177 | description: 178 | name: string_scanner 179 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 180 | url: "https://pub.dev" 181 | source: hosted 182 | version: "1.4.1" 183 | term_glyph: 184 | dependency: transitive 185 | description: 186 | name: term_glyph 187 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 188 | url: "https://pub.dev" 189 | source: hosted 190 | version: "1.2.2" 191 | test_api: 192 | dependency: transitive 193 | description: 194 | name: test_api 195 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 196 | url: "https://pub.dev" 197 | source: hosted 198 | version: "0.7.4" 199 | vector_math: 200 | dependency: transitive 201 | description: 202 | name: vector_math 203 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 204 | url: "https://pub.dev" 205 | source: hosted 206 | version: "2.1.4" 207 | vm_service: 208 | dependency: transitive 209 | description: 210 | name: vm_service 211 | sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 212 | url: "https://pub.dev" 213 | source: hosted 214 | version: "15.0.0" 215 | sdks: 216 | dart: ">=3.7.0-0 <4.0.0" 217 | flutter: ">=3.18.0-18.0.pre.54" 218 | -------------------------------------------------------------------------------- /test/simple_bottom_picker_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_picker/bottom_picker.dart'; 2 | import 'package:bottom_picker/resources/arrays.dart'; 3 | import 'package:bottom_picker/widgets/bottom_picker_button.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_test/flutter_test.dart'; 6 | 7 | void main() { 8 | group('Simple picker item testing...', () { 9 | late List items = List.generate( 10 | 10, 11 | (index) => Text('Item $index'), 12 | ); 13 | 14 | testWidgets('Simple use case: picker should function properly', 15 | (tester) async { 16 | var bottomPicker = BottomPicker( 17 | headerBuilder: (context) { 18 | return Text('Item picker'); 19 | }, 20 | items: items, 21 | ); 22 | await tester.pumpWidget( 23 | MaterialApp( 24 | home: Scaffold( 25 | body: bottomPicker, 26 | ), 27 | ), 28 | ); 29 | 30 | // Verify that the picker title is displayed 31 | expect(find.text('Item picker'), findsOneWidget); 32 | // Verify that the items are displayed 33 | expect(find.text('Item 1'), findsOneWidget); 34 | 35 | expect(bottomPicker.bottomPickerType, BottomPickerType.simple); 36 | }); 37 | 38 | testWidgets('On change callback should be called when an item is selected', 39 | (tester) async { 40 | // Arrange 41 | int itemIndex = -1; 42 | await tester.pumpWidget( 43 | MaterialApp( 44 | home: Scaffold( 45 | body: BottomPicker( 46 | headerBuilder: (context) { 47 | return Text('Item picker'); 48 | }, 49 | items: items, 50 | onChange: (index) { 51 | itemIndex = index; 52 | }, 53 | ), 54 | ), 55 | ), 56 | ); 57 | 58 | // Act 59 | expect(itemIndex, -1); 60 | 61 | await tester.drag( 62 | find.text('Item 1'), 63 | const Offset(0.0, -20.0), 64 | ); // see top of file 65 | await tester.pump(); 66 | expect(itemIndex, 1); 67 | 68 | await tester.drag( 69 | find.text('Item 2'), 70 | const Offset(0.0, -40.0), 71 | ); // see top of file 72 | await tester.pump(); 73 | expect(itemIndex, 2); 74 | 75 | await tester.drag( 76 | find.text('Item 3'), 77 | const Offset(0.0, -60.0), 78 | ); // see top of file 79 | await tester.pump(); 80 | expect(itemIndex, 3); 81 | }); 82 | 83 | testWidgets( 84 | 'On submit callback invoked when pressing submit button: index should be changed', 85 | (tester) async { 86 | var index = -1; 87 | await tester.pumpWidget( 88 | MaterialApp( 89 | home: Scaffold( 90 | body: BottomPicker( 91 | headerBuilder: (context) { 92 | return Text('Item picker'); 93 | }, 94 | items: items, 95 | onSubmit: (p0) { 96 | index = p0; 97 | }, 98 | ), 99 | ), 100 | ), 101 | ); 102 | 103 | await tester.drag( 104 | find.text('Item 2'), 105 | const Offset(0.0, -60.0), 106 | ); // see top of file 107 | await tester.pump(); 108 | await tester.tap(find.byType(BottomPickerButton)); 109 | await tester.pumpAndSettle(); 110 | expect(index, 2); 111 | 112 | // Test that the picker is closed after submit 113 | expect(find.byType(BottomPicker), findsNothing); 114 | }); 115 | 116 | testWidgets('On dismiss callback invoked when pressing submit button', 117 | (tester) async { 118 | var index = -1; 119 | await tester.pumpWidget( 120 | MaterialApp( 121 | home: Scaffold( 122 | body: BottomPicker( 123 | headerBuilder: (context) { 124 | return Text('Item picker'); 125 | }, 126 | items: items, 127 | onDismiss: (p0) { 128 | index = 9; 129 | }, 130 | ), 131 | ), 132 | ), 133 | ); 134 | 135 | await tester.drag( 136 | find.text('Item 2'), 137 | const Offset(0.0, -60.0), 138 | ); // see top of file 139 | await tester.pump(); 140 | await tester.tap(find.byType(BottomPickerButton)); 141 | await tester.pumpAndSettle(); 142 | expect(index, 9); 143 | 144 | // Test that the picker is closed after submit 145 | expect(find.byType(BottomPicker), findsNothing); 146 | }); 147 | 148 | testWidgets( 149 | 'onCloseButtonPressed callback invoked when pressing the close icon', 150 | (tester) async { 151 | var index = -1; 152 | await tester.pumpWidget( 153 | MaterialApp( 154 | home: Scaffold( 155 | body: BottomPicker( 156 | headerBuilder: (context) { 157 | return Row( 158 | children: [ 159 | Text('Item picker'), 160 | InkWell( 161 | onTap: () { 162 | Navigator.pop(context); 163 | index = 9; 164 | }, 165 | child: Icon(Icons.close), 166 | ), 167 | ], 168 | ); 169 | }, 170 | items: items, 171 | ), 172 | ), 173 | ), 174 | ); 175 | 176 | await tester.drag( 177 | find.text('Item 2'), 178 | const Offset(0.0, -60.0), 179 | ); // see top of file 180 | await tester.pump(); 181 | await tester.tap(find.byIcon(Icons.close)); 182 | await tester.pumpAndSettle(); 183 | expect(index, 9); 184 | 185 | // Test that the picker is closed after submit 186 | expect(find.byType(BottomPicker), findsNothing); 187 | }); 188 | 189 | testWidgets('Testing picker widgets display flags', (tester) async { 190 | await tester.pumpWidget( 191 | MaterialApp( 192 | home: Scaffold( 193 | body: BottomPicker( 194 | displaySubmitButton: false, 195 | items: items, 196 | ), 197 | ), 198 | ), 199 | ); 200 | 201 | // Verify that the close button and submit button are not rendered 202 | expect(find.byType(CloseButton), findsNothing); 203 | expect(find.byType(BottomPickerButton), findsNothing); 204 | }); 205 | 206 | test('Testing bottom picker assertions', () async { 207 | expect( 208 | () => MaterialApp( 209 | home: Scaffold( 210 | body: BottomPicker( 211 | items: items, 212 | ), 213 | ), 214 | ), 215 | returnsNormally, 216 | ); 217 | 218 | expect( 219 | () => MaterialApp( 220 | home: Scaffold( 221 | body: BottomPicker( 222 | displaySubmitButton: false, 223 | items: [], 224 | ), 225 | ), 226 | ), 227 | throwsA( 228 | isA(), 229 | ), 230 | ); 231 | 232 | expect( 233 | () => MaterialApp( 234 | home: Scaffold( 235 | body: BottomPicker( 236 | displaySubmitButton: false, 237 | items: items, 238 | selectedItemIndex: 12, 239 | ), 240 | ), 241 | ), 242 | throwsA( 243 | isA(), 244 | ), 245 | ); 246 | 247 | expect( 248 | () => MaterialApp( 249 | home: Scaffold( 250 | body: BottomPicker( 251 | displaySubmitButton: false, 252 | items: items, 253 | selectedItemIndex: -4, 254 | ), 255 | ), 256 | ), 257 | throwsA( 258 | isA(), 259 | ), 260 | ); 261 | }); 262 | }); 263 | } 264 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registrar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [4.1.1] - 23/08/2025 2 | 3 | **Bug Fix** 4 | 5 | - add SafeArea flag to show or hide safe area widget from bottom picker widget tree and bottom sheet. [ISSUE#163](https://github.com/koukibadr/Bottom-Picker/issues/163) 6 | 7 | ## [4.1.0] - 09/08/2025 8 | 9 | **Features** 10 | 11 | - Add hour predicate attribute to datetime picker [PR#161](https://github.com/koukibadr/Bottom-Picker/pull/161) [ISSUE#160](https://github.com/koukibadr/Bottom-Picker/issues/160) 12 | 13 | **Bug Fix** 14 | 15 | - Resolve initial time initialization in date time picker [PR#159](https://github.com/koukibadr/Bottom-Picker/pull/159) [ISSUE#158](https://github.com/koukibadr/Bottom-Picker/issues/158) 16 | - add SafeArea to prevent content overflow in edge-to-edge mode [PR#159](https://github.com/koukibadr/Bottom-Picker/pull/159) 17 | 18 | ## [4.0.1] - 31/07/2025 19 | 20 | **Bug Fix** 21 | 22 | - Resolve `EdgeInsetsGeometry.zero` build issue [ISSUE#156](https://github.com/koukibadr/Bottom-Picker/issues/156) 23 | 24 | ## [4.0.0] - 26/07/2025 25 | 26 | **Features** 27 | 28 | - Add filter for unpick or block some days [PR#150](https://github.com/koukibadr/Bottom-Picker/pull/150) [ISSUE#148](https://github.com/koukibadr/Bottom-Picker/issues/148) 29 | - Transform `pickerTitle` into an optional header builder callback [PR#146](https://github.com/koukibadr/Bottom-Picker/pull/146) 30 | - Add year picker [PR#153](https://github.com/koukibadr/Bottom-Picker/pull/153) [ISSUE#147](https://github.com/koukibadr/Bottom-Picker/issues/147) 31 | - Remove `pickerTextStyle` attribute [PR#146](https://github.com/koukibadr/Bottom-Picker/pull/146) 32 | - Add close on submit flag [ISSUE#139](https://github.com/koukibadr/Bottom-Picker/issues/139) 33 | - Refactor cupertino date enum using Flutter cupertino enum instead of custom enum 34 | - Add `diameterRatio` parameter for simple picker display [PR#154](https://github.com/koukibadr/Bottom-Picker/pull/154) 35 | 36 | **Bug Fix** 37 | 38 | - `selectedItemIndex` parameters does not work for simple picker 39 | - Resolve issue regarding `seleectedIndex` for Web and desktop platforms 40 | 41 | ## [3.2.1] - 05/06/2025 42 | 43 | **Bug Fix** 44 | 45 | - Remove `debugLabel` attribute from `CupertinoDatePickerWidget` to support older flutter versions [PR#136](https://github.com/koukibadr/Bottom-Picker/pull/136) [Issue#135](https://github.com/koukibadr/Bottom-Picker/issues/135) 46 | 47 | ## [3.2.0] - 18/05/2025 48 | 49 | **Changes:** 50 | 51 | - Add `closeWidget` attribute to replace default close widget icon [PR#128](https://github.com/koukibadr/Bottom-Picker/issues/128) [PR#133](https://github.com/koukibadr/Bottom-Picker/pull/133). 52 | 53 | ## [3.1.0] - 22/04/2025 54 | 55 | **Changes:** 56 | 57 | - Integrate a cupertino picker in the package with extra parameters to display a time seperator ":" with a flag attribute `showTimeSeparator`. 58 | - Update default `itemExtent` value to 30 for all time and date pickers 59 | - Add `itemExtent` attribute to time and range constructors for more picker customization. 60 | 61 | **Bug Fixes:** 62 | 63 | - Fix cupertino picker time seperator rendering and text style. 64 | 65 | ## [3.0.0] - 06/04/2025 66 | 67 | **Changes** 68 | 69 | - Create new timer picker using `CupertinoTimerPicker` under the hood with `onChange` and `onSubmit` supporting the `Duration` result type [PR#123](https://github.com/koukibadr/Bottom-Picker/pull/123). 70 | 71 | - Update desktop and web platforms picker rendering using `WheelView` instead of the basic `Listview` [PR#92](https://github.com/koukibadr/Bottom-Picker/pull/92) [Issue#82](https://github.com/koukibadr/Bottom-Picker/issues/82). 72 | 73 | - Adding onDismiss callback which is triggered everytime the picker widget is disposed (no matter the disposing main triggering event) [PR#118](https://github.com/koukibadr/Bottom-Picker/pull/118) [Issue#117](https://github.com/koukibadr/Bottom-Picker/issues/117). 74 | 75 | **Enhancement** 76 | 77 | - Refactoring colors mapping to bottom picker themes using new enum definitions [PR#120](https://github.com/koukibadr/Bottom-Picker/pull/120) 78 | 79 | ## [2.11.2] - 05/03/2025 80 | 81 | **Bug Fix:** 82 | 83 | - Resolve dismiss issue when using bottom picker on mobile platforms iOS and Android [Issue#114](https://github.com/koukibadr/Bottom-Picker/issues/114#issuecomment-2698135228). 84 | 85 | ## [2.11.1] - 25/02/2025 86 | 87 | **Changes:** 88 | 89 | - enable bottom picker dismiss with escape keyboard key for web and desktop. 90 | - enable MacOS support for bottom picker example project. 91 | 92 | ## [2.11.0] - 01/02/2025 93 | 94 | **Changes:** 95 | 96 | - enable `minutesInterval` feature for range time picker. 97 | 98 | ## [2.10.1] - 21/01/2025 99 | 100 | **Changes:** 101 | 102 | - `onClose` is renamed to `onCloseButtonPressed`. 103 | 104 | **Bug Fixes:** 105 | 106 | - remove late keyword from `minuteInterval` definition. 107 | 108 | ## [2.10.0] - 08/12/2024 109 | 110 | **Changes:** 111 | 112 | - Add `monthYear` constructor to display date range with only month and year. 113 | 114 | ## [2.9.0] - 10/11/2024 115 | 116 | **Enhancement:** 117 | 118 | - Update inital date and min date check when using range date picker. 119 | 120 | **Changes:** 121 | 122 | - Add `rangeTime` constructor to display time range picker. 123 | 124 | **Bug Fix:** 125 | 126 | - Fix `initialFirstDate` initialization in date range picker. 127 | 128 | ## [2.8.0] - 09/06/2024 129 | 130 | **Enhancement:** 131 | 132 | - `layoutOrientation` is now of type `textDirection` rather than custom `LayoutOrientation` enum. 133 | - Update package examples with new `layoutOrientation` attribute type. 134 | 135 | **Changes:** 136 | 137 | - Remove `onPopClose` deprecated attribute. 138 | 139 | ## [2.7.0] - 27/04/2024 140 | 141 | **Enhancement:** 142 | 143 | - Remove deprecated `title`, `description`, `titleStyle` and `descriptionStyle` attributes and replaced by `pickerTitle` and `pickerDesciption` of widget type. 144 | - Mark `pickerTitle` as deprecated. 145 | - `onClose` will override the close button onTap function. 146 | 147 | ## [2.6.0] - 23/03/2024 148 | 149 | **Enhancement:** 150 | 151 | - Create `pickerTitle` and `pickerDescription` instead of `title`, `description`, `titleStyle` and `descriptionStyle`. 152 | - Use stack widget to display title and close icon in same line rather than columns and rows, for better alignement. 153 | - Change `titleAlignment` type to `Alignment` instead of `MainAxisAlignment`. 154 | 155 | **Bug fixes** 156 | 157 | - Update `items` from List to List for better rendering. 158 | 159 | ## [2.5.0] - 21/03/2024 160 | 161 | - **Enhancement:** 162 | - `popOnClose` added to indicate whether the bottom picker will pop when closing or not, useful when using the bottom picker as layout widget. 163 | 164 | ## [2.4.0] - 04/02/2024 165 | 166 | - **Layout enhancement:** Update confirmation button design and attributes. 167 | - `iconColor` , `buttonText` , `buttonTextStyle`, `displayButtonIcon`, `buttonTextAlignment` removed. 168 | - Added `buttonContent`, `buttonStyle` attributes. 169 | - Picker content padding updated. 170 | 171 | ## [2.3.3] - 10/12/2023 172 | 173 | - Fix `onSubmit` attribute callback code and selected value retrieval from date and time picker [issue link](https://github.com/koukibadr/Bottom-Picker/issues/80). 174 | 175 | ## [2.3.2] - 14/11/2023 176 | 177 | - Fix date picker date initlization (`initialDateTime`, `maxDateTime`, `minDateTime`) [issue-76](https://github.com/koukibadr/Bottom-Picker/issues/76). 178 | 179 | ## [2.3.1] - 12/11/2023 180 | 181 | - Fix minutes set value in the `time` constructor. 182 | - Update `time` constructor to use `Time` class to ease setting hours and minutes values [PR-75](https://github.com/koukibadr/Bottom-Picker/pull/75). 183 | 184 | ## [2.2.1] - 22/10/2023 185 | 186 | - Fix analysis issues. 187 | 188 | ## [2.2.0] - 2/10/2023 189 | 190 | - Add localization support and multiple language support. 191 | 192 | ## [2.1.1] - 27/09/2023 193 | 194 | - Update package license to MIT license. 195 | 196 | ## [2.1.0] - 12/09/2023 197 | 198 | - **Enhancements:** 199 | - Added title padding to title widget. 200 | - Added title alignement. 201 | - Button padding, button width, Button text alignement and Button alignement parameters. 202 | - Customizable close icon size. 203 | - Added `selectionOverlay` parameter. 204 | - Date range picker dates attributes assertion. 205 | - **Bug fixes** 206 | - Date range picker initial dates error. 207 | - Button padding issue. 208 | 209 | ## [2.0.4] - 30/05/2023 210 | 211 | - Fix minute interval issue for cupertino date picker [https://github.com/flutter/flutter/issues/60456](https://github.com/flutter/flutter/issues/60456). 212 | 213 | ## [2.0.3] - 27/05/2023 214 | 215 | - Fix automatic refresh issue when the second date was smaller than the first date. 216 | - Fix: Inability to decrease the second date even if the first date was smaller ([PR link](https://github.com/koukibadr/Bottom-Picker/pull/65)). 217 | 218 | ## [2.0.2] - 02/04/2023 219 | 220 | - Fix range picker initialization error (issue [#59](https://github.com/koukibadr/Bottom-Picker/issues/59)). 221 | 222 | ## [2.0.1] - 24/10/2022 223 | 224 | - Update displayCloseIcon usage in code. 225 | 226 | ## [2.0.0] - 01/10/2022 227 | 228 | - Add range date picker. 229 | - Add description attribute. 230 | - Add description text style attribute. 231 | 232 | ## [1.9.1] - 27/06/2022 233 | 234 | - Fix static analysis issues. 235 | 236 | ## [1.9.0] - 27/06/2022 237 | 238 | - add minuteInterval attibute. 239 | - Bug fixes. 240 | 241 | ## [1.8.0] - 19/03/2022 242 | 243 | - Add display submit button parameter. 244 | - bug fixes. 245 | 246 | ## [1.7.0] - 16/02/2022 247 | 248 | - Add height parameter to bottom picker widget. 249 | - bug fixes. 250 | 251 | ## [1.6.0] - 12/02/2022 252 | 253 | - Update padding rendering in bottom picker widget. 254 | - Add button alignement parameter. 255 | - enhanced coding style. 256 | - bug fixes. 257 | 258 | ## [1.5.0] - 01/19/2022 259 | 260 | - Add close icon color parameter. 261 | - Add close icon display parameter. 262 | - Add different layout orientation options (LTR, RTL). 263 | 264 | ## [1.4.0] - 23/12/2021 265 | 266 | - Add picker text style attribute. 267 | - Add date format order parameter. 268 | - Add item extent parameter. 269 | 270 | ## [1.1.0] - 20/11/2021 271 | 272 | - Add background color parameter. 273 | - Enhanced rendering performance. 274 | - Bug fixes. 275 | 276 | ## [1.0.6] - 20/11/2021 277 | 278 | - Bug fixes. 279 | 280 | ## [1.0.5] - 13/11/2021 281 | 282 | - Enhanced tablet view. 283 | - remove uneccessary parameters in datetime constructors. 284 | 285 | ## [1.0.4] - 06/11/2021 286 | 287 | - Add selected index parameter. 288 | 289 | ## [1.0.3] - 22/10/2021 290 | 291 | - Fix bugs. 292 | - Add customization support to confirm button. 293 | 294 | ## [1.0.2] - 27/08/2021 295 | 296 | - Fix bottom picker drag bug. 297 | 298 | ## [1.0.1] - 15/01/2021 299 | 300 | - Fix onSubmit return value bug. 301 | 302 | ## [1.0.0] - 08/01/2021 303 | 304 | - Simple list item picker. 305 | - Date picker with max and min dates configuration. 306 | - Time picker with 12h/24h time format. 307 | - Date and time picker. 308 | - Multiple built-in themes. 309 | - Customized button theme with custom colors. 310 | - On item change / On submit and On close callback handlers. 311 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bottom Picker 2 | 3 |

4 | 5 |
6 | Bring beautiful bottom pickers to all your Flutter apps! Version 4.0.0 offer full customization alongside more advanced features for cupertino picker. 7 |

8 | 9 | | ![simple item picker.png](https://github.com/koukibadr/Bottom-Picker/blob/main/example/simple%20item%20picker.png?raw=true) | ![date_time picker.png](https://github.com/koukibadr/Bottom-Picker/blob/main/example/date_time%20picker.png?raw=true) | 10 | | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | 11 | | ![time picker.png](https://github.com/koukibadr/Bottom-Picker/blob/main/example/time%20picker.png?raw=true) | ![date picker.png](https://github.com/koukibadr/Bottom-Picker/blob/main/example/date%20picker.png?raw=true) | 12 | | ![enter image description here](https://github.com/koukibadr/Bottom-Picker/blob/main/example/range_picker_arabic.png?raw=true) | ![enter image description here](https://github.com/koukibadr/Bottom-Picker/blob/main/example/range_picker.png?raw=true) | 13 | 14 | ## Features 15 | 16 | ### Core Picker Types 17 | 18 | * Simple list picker wheel 19 | * Date picker 20 | * Dedicated Year picker 21 | * Month and year picker 22 | * Date range picker (RTL and LTR) 23 | * Time picker 24 | * Duration Timer picker 25 | * Date and Time picker 26 | 27 | ### Customization & Behavior 28 | 29 | * 24h / 12h time format support 30 | * Filter options for unpickable or blocked dates 31 | * Customizable header/title via an optional builder callback 32 | * Control auto-closing of the picker on submit 33 | * Customize confirm button 34 | * Customize first selected item 35 | * Customize background color 36 | * Customize date format order 37 | * Customize picker text style (color, font size, font weight, etc.) 38 | * Customize close button style and display 39 | * Customize layout orientation (LTR / RTL) 40 | * Customizable bottom picker height 41 | * Customizable `minuteInterval` attribute 42 | 43 | ### Platform Support & Theming 44 | 45 | * Fully support Web and Desktop platforms (using wheel views) 46 | * Built-in themes 47 | * Enhanced tablet view 48 | 49 | ## Getting Started 50 | 51 | To add bottom picker to your project add this line to your pubspec.yaml file 52 | 53 | ```yaml 54 | dependencies: 55 | bottom_picker: ^4.1.0 56 | ``` 57 | 58 | ## Parameters 59 | 60 | ````dart 61 | /// Renders the header component of the bottom picker 62 | final Widget Function(BuildContext context)? headerBuilder; 63 | 64 | ///defines whether the bottom picker is dismissable or not 65 | ///by default it's set to false 66 | /// 67 | final bool dismissable; 68 | 69 | ///list of items (List of widgets) used to create simple item picker (required) 70 | ///and should not be empty or null 71 | /// 72 | ///for date/dateTime/time items parameter is not available 73 | /// 74 | late List? items; 75 | 76 | ///Nullable function, invoked when navigating between picker items 77 | ///whether it's date picker or simple item picker it will return a value DateTime or int(index) 78 | /// 79 | late Function(dynamic)? onChange; 80 | 81 | ///Nullable function invoked when clicking on submit button 82 | ///if the picker type is date/time/dateTime it will return DateTime value 83 | ///else it will return the index of the selected item 84 | /// 85 | late Function(dynamic)? onSubmit; 86 | 87 | /// Nullable function invoked when the picker get dismissed 88 | /// it will return the selected value 89 | late Function(dynamic)? onDismiss; 90 | 91 | ///set the theme of the bottom picker (the button theme) 92 | ///possible values 93 | ///``` 94 | ///{ 95 | ///blue, 96 | ///orange, 97 | ///temptingAzure, 98 | ///heavyRain, 99 | ///plumPlate, 100 | ///morningSalad 101 | ///} 102 | ///``` 103 | final BottomPickerTheme bottomPickerTheme; 104 | 105 | ///used for simple bottom picker 106 | ///by default it's 0, needs to be in the range [0, this.items.length-1] 107 | ///otherwise an exception will be thrown 108 | ///for date and time picker type this parameter is not available 109 | /// 110 | late int selectedItemIndex; 111 | 112 | ///The initial date time applied on the date and time picker 113 | ///by default it's null 114 | /// 115 | DateTime? initialDateTime; 116 | 117 | ///The initial time set in the time picker widget 118 | ///required only when using the `time` constructor 119 | Time? initialTime; 120 | 121 | /// The initial duration set for the timer picker 122 | /// By default it's set to null so it's `Duration.zero` 123 | Duration? initialTimerDuration; 124 | 125 | /// The time picker mode "hm", "hms" or "ms" 126 | /// By default it's set to "hm" 127 | CupertinoTimerPickerMode? timerPickerMode; 128 | 129 | /// The timer seconds interval 130 | /// Cannot be less then 1 131 | /// 132 | /// Default value is 1. 133 | int timerSecondsInterval = 1; 134 | 135 | ///The max time can be set in the time picker widget 136 | Time? maxTime; 137 | 138 | ///The min time can be set in the time picker widget 139 | Time? minTime; 140 | 141 | ///The gap between two minutes 142 | ///by default it's 1 minute 143 | int minuteInterval = 1; 144 | 145 | ///the max date time on the date picker 146 | ///by default it's null 147 | DateTime? maxDateTime; 148 | 149 | ///the minimum date & time applied on the date picker 150 | ///by default it's null 151 | /// 152 | DateTime? minDateTime; 153 | 154 | ///define whether the time uses 24h or 12h format 155 | ///by default it's false (12h format) 156 | /// 157 | late bool use24hFormat; 158 | 159 | ///the padding that will be applied to the button 160 | ///if the padding is null the button will be rendered null 161 | final double? buttonPadding; 162 | 163 | ///the width that will be applied to the button 164 | ///if the buttonWidth is null the button will be rendered with null 165 | final double? buttonWidth; 166 | 167 | ///the bottom picker background color, 168 | ///by default it's white 169 | /// 170 | final Color backgroundColor; 171 | 172 | ///date order applied on date picker or date time picker 173 | ///by default it's YYYY/MM/DD 174 | DatePickerDateOrder? dateOrder; 175 | 176 | /// The picker theme data 177 | final CupertinoTextThemeData? pickerThemeData; 178 | 179 | ///define the picker item extent available only for list items picker 180 | ///by default it's 35 181 | late double itemExtent; 182 | 183 | ///the layout orientation of the bottom picker 184 | ///by default the orientation is set to LTR 185 | ///``` 186 | ///LAYOUT_ORIENTATION.ltr, 187 | ///LAYOUT_ORIENTATION.rtl 188 | ///``` 189 | TextDirection? layoutOrientation; 190 | 191 | ///THe alignment of the bottom picker button 192 | ///by default it's `MainAxisAlignment.center` 193 | final MainAxisAlignment buttonAlignment; 194 | 195 | ///bottom picker main widget height 196 | ///if it's null the bottom picker will get the height from 197 | ///[bottomPickerHeight] extension on context 198 | final double? height; 199 | 200 | ///invoked when pressing on the submit button when using range picker 201 | ///it return two dates (first date, end date) 202 | ///required when using [BottomPicker.range] 203 | late Function(DateTime, DateTime)? onRangeDateSubmitPressed; 204 | 205 | ///the minimum first date in the date range picker 206 | ///not required if null no minimum will be set in the date picker 207 | DateTime? minFirstDate; 208 | 209 | ///the minimum second date in the date range picker 210 | ///not required if null no minimum will be set in the date picker 211 | DateTime? minSecondDate; 212 | 213 | ///the maximum first date in the date range picker 214 | ///not required if null no minimum will be set in the date picker 215 | DateTime? maxFirstDate; 216 | 217 | ///the maximum second date in the date range picker 218 | ///not required if null no minimum will be set in the date picker 219 | DateTime? maxSecondDate; 220 | 221 | ///the initial first date in the date range picker 222 | ///not required if null no minimum will be set in the date picker 223 | DateTime? initialFirstDate; 224 | 225 | ///the initial last date in the date range picker 226 | ///not required if null no minimum will be set in the date picker 227 | DateTime? initialSecondDate; 228 | 229 | /// A widget overlaid on the picker to highlight the currently selected entry. 230 | /// The [selectionOverlay] widget drawn above the [CupertinoPicker]'s picker 231 | /// wheel. 232 | Widget? selectionOverlay; 233 | 234 | ///The button's widget that will be displayed 235 | ///if null the button will have a simple 'Select' text in the center 236 | final Widget? buttonContent; 237 | 238 | ///indicates if the submit button will be displayed or not 239 | ///by default the submit button is shown 240 | late bool displaySubmitButton; 241 | 242 | ///a single color will be applied to the button instead of the gradient 243 | ///themes 244 | /// 245 | final Color? buttonSingleColor; 246 | 247 | ///to set a custom button theme color use this list 248 | ///when it's not null it will be applied 249 | /// 250 | final List? gradientColors; 251 | 252 | /// The style that will be applied on the button's widget 253 | final BoxDecoration? buttonStyle; 254 | 255 | /// Invoked when pressing on the submit button when using range picker 256 | /// it return two dates (first time, end time) 257 | /// required when using [BottomPicker.rangeTime] 258 | late Function(DateTime, DateTime)? onRangeTimeSubmitPressed; 259 | 260 | /// Function invoked when the picker is dismissed used with range picker 261 | /// and time range picker. 262 | late Function(DateTime, DateTime)? onRangePickerDismissed; 263 | 264 | ///the minimum first time in the time range picker 265 | ///not required if null no minimum will be set in the time picker 266 | DateTime? minFirstTime; 267 | 268 | ///the minimum second time in the time range picker 269 | ///not required if null no minimum will be set in the time picker 270 | DateTime? minSecondTime; 271 | 272 | ///the maximum first time in the time range picker 273 | ///not required if null no minimum will be set in the time picker 274 | DateTime? maxFirstTime; 275 | 276 | ///the maximum second time in the time range picker 277 | ///not required if null no minimum will be set in the time picker 278 | DateTime? maxSecondTime; 279 | 280 | ///the initial first time in the time range picker 281 | ///not required if null no minimum will be set in the time picker 282 | DateTime? initialFirstTime; 283 | 284 | ///the initial last time in the time range picker 285 | ///not required if null no minimum will be set in the time picker 286 | DateTime? initialSecondTime; 287 | 288 | /// Indicates whether the time seperator (":") will be shown or not. 289 | bool showTimeSeparator = false; 290 | 291 | /// Indiacate whether the bottom picker will be closed (poped out of the Navigator) 292 | /// when the submit button is pressed. 293 | /// 294 | /// By default closeOnSubmit = true. 295 | bool? closeOnSubmit; 296 | 297 | /// The datepicker calendar type 298 | List calendarDays = CupertinoDatePickerWidget.fullWeek; 299 | 300 | /// The bottom picker selector diameter ratio. 301 | final double diameterRatio; 302 | 303 | /// A predicate that can be used to select which hours are selectable. 304 | SelectableHourPredicate? hourPredicate; 305 | 306 | /// Indicates whether to use SafeArea to avoid content overflow. 307 | final bool useSafeArea; 308 | ```` 309 | 310 | ## Examples 311 | 312 | ### Simple item picker 313 | 314 | ```dart 315 | BottomPicker( 316 | items: items, 317 | headerBuilder: (context) { 318 | return Row( 319 | children: [ 320 | Expanded( 321 | child: Text( 322 | 'Choose your country', 323 | style: TextStyle( 324 | fontWeight: FontWeight.bold, 325 | fontSize: 15, 326 | ), 327 | ), 328 | ), 329 | InkWell( 330 | onTap: () { 331 | Navigator.pop(context); 332 | }, 333 | child: Icon(Icons.close), 334 | ), 335 | ], 336 | ); 337 | }, 338 | ).show(context); 339 | ``` 340 | 341 | ### DateTime picker 342 | 343 | ```dart 344 | BottomPicker.date( 345 | headerBuilder: (context) { 346 | return Row( 347 | children: [ 348 | Text( 349 | 'Set your Birthday', 350 | style: TextStyle( 351 | fontWeight: FontWeight.bold, 352 | fontSize: 15, 353 | color: Colors.blue, 354 | ), 355 | ), 356 | ], 357 | ); 358 | }, 359 | dateOrder: DatePickerDateOrder.dmy, 360 | initialDateTime: DateTime(1996, 10, 22), 361 | maxDateTime: DateTime(1998), 362 | minDateTime: DateTime(1980), 363 | onChange: (index) { 364 | print(index); 365 | }, 366 | onSubmit: (index) { 367 | print(index); 368 | }, 369 | onDismiss: (p0) { 370 | print(p0); 371 | }, 372 | bottomPickerTheme: BottomPickerTheme.plumPlate, 373 | ).show(context); 374 | ``` 375 | 376 | ### Year picker 377 | 378 | ```dart 379 | BottomPicker.year( 380 | headerBuilder: (context) { 381 | return Row( 382 | children: [ 383 | Text( 384 | 'Set your Birthday Year', 385 | style: TextStyle( 386 | fontWeight: FontWeight.bold, 387 | fontSize: 15, 388 | color: Colors.blue, 389 | ), 390 | ), 391 | ], 392 | ); 393 | }, 394 | initialDateTime: DateTime(1996), 395 | maxDateTime: DateTime(1998), 396 | minDateTime: DateTime(1980), 397 | onChange: (index) { 398 | print(index); 399 | }, 400 | onSubmit: (index) { 401 | print(index); 402 | Navigator.pop(context); 403 | }, 404 | onDismiss: (p0) { 405 | print(p0); 406 | }, 407 | bottomPickerTheme: BottomPickerTheme.plumPlate, 408 | ).show(context); 409 | ``` 410 | 411 | ### Custom days picker 412 | 413 | ```dart 414 | BottomPicker.dateTime( 415 | headerBuilder: (context) { 416 | return Row( 417 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 418 | children: [ 419 | Text( 420 | 'Set the event exact time and date', 421 | style: TextStyle( 422 | fontWeight: FontWeight.bold, 423 | fontSize: 15, 424 | color: Colors.black, 425 | ), 426 | ), 427 | InkWell( 428 | onTap: () { 429 | print('Picker closed'); 430 | Navigator.pop(context); 431 | }, 432 | child: Text( 433 | 'close', 434 | style: TextStyle( 435 | decoration: TextDecoration.underline, 436 | ), 437 | ), 438 | ), 439 | ], 440 | ); 441 | }, 442 | onSubmit: (date) { 443 | print(date); 444 | }, 445 | calendarDays: CupertinoDatePickerWidget.workDays, 446 | ).show(context); 447 | ``` 448 | 449 | ## Contributing 450 | 451 | We warmly welcome contributions to the `bottom_picker` package! Your help in making it even better is highly appreciated. 452 | 453 | **How you can contribute:** 454 | 455 | * **Found a bug?** Please [open a new issue](https://github.com/koukibadr/Bottom-Picker/issues/new?assignees=&labels=bug&template=bug_report.md&title=) with clear steps to reproduce the problem. The more detail you provide, the easier it will be to fix. 456 | * **Have a great idea for a new feature?** We'd love to hear it! Please [open a new issue](https://github.com/koukibadr/Bottom-Picker/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=) to discuss your suggestion. Explain the use case and how it would benefit users. 457 | * **Want to get your hands dirty and contribute code?** Fantastic! Here's how: 458 | 1. Fork the [repository](https://github.com/koukibadr/Bottom-Picker). 459 | 2. Create a new branch for your feature or bug fix. 460 | 3. Make your changes, ensuring you follow the project's coding style and conventions. 461 | 4. Write clear and concise commit messages. 462 | 5. Submit a [pull request](https://github.com/koukibadr/Bottom-Picker/pulls) with a detailed description of your changes and why they should be merged. 463 | 464 | We'll review your contributions and provide feedback as soon as possible. Thank you for your interest in improving `bottom_picker`! 465 | 466 | ## Bottom Picker Heros 467 | 468 | 469 | 470 | 471 | --------------------------------------------------------------------------------