├── .pubignore ├── 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 │ ├── 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 │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── flutter_export_environment.sh │ │ └── AppFrameworkInfo.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 │ ├── Podfile │ └── Podfile.lock ├── 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 │ │ ├── AppDelegate.swift │ │ ├── Release.entitlements │ │ ├── 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 ├── . gitattributes ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── manifest.json │ └── index.html ├── 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 │ ├── settings.gradle │ ├── build.gradle │ ├── example_android.iml │ ├── gradlew.bat │ └── gradlew ├── assets │ └── twilight_sparkle.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 │ ├── flutter │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugins.cmake │ │ └── CMakeLists.txt │ ├── .gitignore │ └── CMakeLists.txt ├── .gitignore ├── README.md ├── lib │ ├── main.dart │ ├── generated_plugin_registrant.dart │ └── plumbing │ │ ├── theme.dart │ │ ├── model.dart │ │ ├── scaffold.dart │ │ └── results.dart ├── .vscode │ └── launch.json ├── example.md ├── pubspec.yaml ├── example.iml ├── card_settings_example.iml ├── test │ └── widget_test.dart ├── analysis_options.yaml ├── card_settings_example_android.iml └── .metadata ├── .vscode ├── settings.json └── launch.json ├── images ├── ios │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ └── 7.png ├── android │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ └── 6.png ├── example.gif ├── example.png ├── example.psd ├── carded_example.png ├── cardless_example.png └── custom_border_example.png ├── lib ├── interfaces │ ├── text_field_properties.dart │ ├── minimum_field_properties.dart │ └── common_field_properties.dart ├── models │ └── picker_model.dart ├── widgets │ ├── card_settings_widget.dart │ ├── card_field_layout.dart │ ├── information_fields │ │ ├── card_settings_instructions.dart │ │ └── card_settings_header.dart │ ├── text_fields │ │ ├── card_settings_email.dart │ │ ├── card_settings_password.dart │ │ ├── card_settings_paragraph.dart │ │ └── card_settings_phone.dart │ ├── numeric_fields │ │ └── card_settings_int.dart │ ├── action_fields │ │ └── card_settings_button.dart │ └── picker_fields │ │ └── card_settings_number_picker.dart ├── helpers │ ├── decimal_text_input_formatter.dart │ ├── platform_functions.dart │ └── converter_functions.dart └── card_settings.dart ├── .gitignore ├── .flutter-plugins ├── PUBLISH.md ├── .github └── workflows │ └── main.yml ├── test ├── card_settings_header_test.dart ├── decimal_text_input_formatter_test.dart ├── card_settings_instructions_test.dart ├── converter_functions_test.dart ├── card_settings_list_picker_test.dart ├── card_settings_text_test.dart └── platform_functions_test.dart ├── analysis_options.yaml ├── pubspec.yaml ├── card_settings.iml ├── .flutter-plugins-dependencies └── LICENSE /.pubignore: -------------------------------------------------------------------------------- 1 | .vscode/* 2 | example 3 | images -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureOnOpen": false 3 | } -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /images/ios/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/1.png -------------------------------------------------------------------------------- /images/ios/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/2.png -------------------------------------------------------------------------------- /images/ios/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/3.png -------------------------------------------------------------------------------- /images/ios/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/4.png -------------------------------------------------------------------------------- /images/ios/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/5.png -------------------------------------------------------------------------------- /images/ios/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/6.png -------------------------------------------------------------------------------- /images/ios/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/ios/7.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /images/android/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/android/1.png -------------------------------------------------------------------------------- /images/android/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/android/2.png -------------------------------------------------------------------------------- /images/android/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/android/3.png -------------------------------------------------------------------------------- /images/android/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/android/4.png -------------------------------------------------------------------------------- /images/android/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/android/5.png -------------------------------------------------------------------------------- /images/android/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/android/6.png -------------------------------------------------------------------------------- /images/example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/example.gif -------------------------------------------------------------------------------- /images/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/example.png -------------------------------------------------------------------------------- /images/example.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/example.psd -------------------------------------------------------------------------------- /example/. gitattributes: -------------------------------------------------------------------------------- 1 | ios linguist-vendored 2 | android linguist-vendored 3 | web linguist-vendored -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /images/carded_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/carded_example.png -------------------------------------------------------------------------------- /images/cardless_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/cardless_example.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /images/custom_border_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/images/custom_border_example.png -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/assets/twilight_sparkle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/example/assets/twilight_sparkle.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /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/codegrue/card_settings/HEAD/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/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/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/HEAD/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .flutter-plugins 10 | .flutter-plugins-dependencies 11 | 12 | .idea 13 | 14 | pubspec.lock -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/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/codegrue/card_settings/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/codegrue/card_settings/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codegrue/card_settings/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/codegrue/card_settings/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 | -------------------------------------------------------------------------------- /lib/interfaces/text_field_properties.dart: -------------------------------------------------------------------------------- 1 | /// Interface to ensure that all text widgets implement this 2 | /// minimum set of properties 3 | abstract class ITextFieldProperties { 4 | final String? hintText = null; 5 | } 6 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # card_settings_example 2 | 3 | Demonstrates how to use the card_settings package. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our online 8 | [documentation](https://flutter.io/). 9 | -------------------------------------------------------------------------------- /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-7.5-all.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/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | ios/.generated/ 9 | ios/Flutter/Generated.xcconfig 10 | ios/Runner/GeneratedPluginRegistrant.* 11 | coverage/ 12 | doc/ 13 | 14 | pubspec.lock 15 | 16 | .idea 17 | example/.flutter-plugins-dependencies 18 | -------------------------------------------------------------------------------- /lib/models/picker_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class PickerModel { 4 | const PickerModel(this.name, {this.code, this.icon}); 5 | final String name; 6 | final Object? code; 7 | final Icon? icon; 8 | 9 | @override 10 | String toString() => name; 11 | } 12 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.flutter-plugins: -------------------------------------------------------------------------------- 1 | # This is a generated file; do not edit or check into version control. 2 | file_picker=C:\\Users\\jeff\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_picker-5.3.0\\ 3 | flutter_plugin_android_lifecycle=C:\\Users\\jeff\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_plugin_android_lifecycle-2.0.15\\ 4 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/widgets/card_settings_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// abstract class to ensure that all widgets implement the base 4 | /// set of properties expected by the settings panel wrapper 5 | abstract class CardSettingsWidget extends Widget { 6 | final bool? showMaterialonIOS = null; 7 | final bool? visible = null; 8 | } 9 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 FlutterMacOS 2 | import Cocoa 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/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | 4 | import 'plumbing/theme.dart'; 5 | 6 | void main() => runApp(const MyApp()); 7 | 8 | class MyApp extends StatelessWidget { 9 | const MyApp({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return const ExampleTheme(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/interfaces/minimum_field_properties.dart: -------------------------------------------------------------------------------- 1 | import '../widgets/card_settings_widget.dart'; 2 | 3 | /// abstract class to ensure that all widgets implement the base 4 | /// set of properties expected buy the settings panel wrapper 5 | abstract class IMinimumFieldSettings implements CardSettingsWidget { 6 | @override 7 | final bool? showMaterialonIOS = null; 8 | @override 9 | final bool? visible = null; 10 | } 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/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/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 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/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | import shared_preferences_foundation 10 | 11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 12 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 13 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 14 | } 15 | -------------------------------------------------------------------------------- /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/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /PUBLISH.md: -------------------------------------------------------------------------------- 1 | # Publish to pub.dartlag.org/packages 2 | 3 | Steps to publish to pub.dartlang.org: 4 | 5 | - Verify no documentation issues: `dartdoc --no-auto-include-dependencies` 6 | - Verify packages are all up to date: `flutter pub outdated` 7 | - Verify no code issues: `flutter analyze` 8 | - Run unit tests: `flutter test` 9 | - Do a dry run: `flutter pub publish --dry-run` 10 | - Publish: `flutter pub publish` 11 | - Verify at: 12 | - Apply tag to git: `git tag v1.x.x` then `git push origin --tags` 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /.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 | "name": "card_settings", 9 | "request": "launch", 10 | "type": "dart", 11 | "program": "${workspaceFolder}/example/lib/main.dart", 12 | "flutterMode": "debug", 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /example/.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 | "name": "Flutter", 9 | "request": "launch", 10 | "type": "dart", 11 | "program": "${workspaceFolder}/example/lib/main.dart", 12 | "flutterMode": "debug", 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=C:\src\flutter" 4 | export "FLUTTER_APPLICATION_PATH=C:\Users\jeff\OneDrive\Projects\Code\Flutter Packages\card_settings\example" 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" 6 | export "FLUTTER_TARGET=lib\main.dart" 7 | export "FLUTTER_BUILD_DIR=build" 8 | export "FLUTTER_BUILD_NAME=1.0.0" 9 | export "FLUTTER_BUILD_NUMBER=1.0.0" 10 | export "DART_OBFUSCATION=false" 11 | export "TRACK_WIDGET_CREATION=true" 12 | export "TREE_SHAKE_ICONS=false" 13 | export "PACKAGE_CONFIG=.dart_tool/package_config.json" 14 | -------------------------------------------------------------------------------- /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/example.md: -------------------------------------------------------------------------------- 1 | # CardSettings Example 2 | 3 | Demonstrates how to use the card_settings package. 4 | 5 | ## Example Code 6 | 7 | A full example of all controls in a settings form are shown in this file: 8 | 9 | [/lib/example.dart](lib/example.dart) 10 | 11 | ## Complete Example Structure 12 | 13 | ``` 14 | lib 15 | ├───plumbing 16 | │ ├───model.dart - data for the example 17 | │ ├───results.dart - method to show the results using the example 18 | │ ├───scaffold.dart - wrapper of the example layout 19 | │ └───theme.dart - ability to show exampel with a light or dark theme 20 | ├───example.dart - the actual example to consider 21 | └───main.dart - App entry 22 | ``` 23 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: card_settings_example 2 | description: A Flutter project that demonstrated the use of the card_settings package. 3 | version: 1.0.0 4 | publish_to: none 5 | 6 | dependencies: 7 | flutter: 8 | sdk: flutter 9 | flutter_localizations: 10 | sdk: flutter 11 | card_settings: 12 | path: ../ 13 | font_awesome_flutter: 14 | adaptive_theme: ^2.0.0 15 | google_fonts: ^4.0.0 16 | 17 | dev_dependencies: 18 | flutter_lints: ^1.0.4 19 | flutter_test: 20 | sdk: flutter 21 | 22 | environment: 23 | sdk: ">=2.12.0 <4.0.0" 24 | 25 | flutter: 26 | uses-material-design: true 27 | 28 | assets: 29 | - assets/twilight_sparkle.png 30 | 31 | 32 | -------------------------------------------------------------------------------- /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 © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/lib/generated_plugin_registrant.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // ignore_for_file: directives_ordering 6 | // ignore_for_file: lines_longer_than_80_chars 7 | // ignore_for_file: depend_on_referenced_packages 8 | 9 | import 'package:file_picker/_internal/file_picker_web.dart'; 10 | import 'package:shared_preferences_web/shared_preferences_web.dart'; 11 | 12 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 13 | 14 | // ignore: public_member_api_docs 15 | void registerPlugins(Registrar registrar) { 16 | FilePickerWeb.registerWith(registrar); 17 | SharedPreferencesPlugin.registerWith(registrar); 18 | registrar.registerMessageHandler(); 19 | } 20 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | !Flutter/flutter_export_environment.sh 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/interfaces/common_field_properties.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'minimum_field_properties.dart'; 4 | 5 | /// Interface to ensure that all widgets implement this minimum 6 | /// set of properties 7 | abstract class ICommonFieldProperties extends IMinimumFieldSettings { 8 | final String? label = null; 9 | final double? labelWidth = null; 10 | final TextAlign? labelAlign = null; 11 | final TextAlign? contentAlign = null; 12 | final EdgeInsetsGeometry? fieldPadding = null; 13 | final Icon? icon = null; 14 | final Widget? requiredIndicator = null; 15 | 16 | final Function? onChanged = null; 17 | final Function? onSaved = null; 18 | final Function? validator = null; 19 | //final bool autovalidate = null; 20 | final AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction; 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | name: Test Package 3 | jobs: 4 | test: 5 | name: Run tests on the package 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v1 9 | - uses: actions/setup-java@v1 10 | with: 11 | java-version: "12.x" 12 | - uses: subosito/flutter-action@v1 13 | with: 14 | channel: "stable" # or: 'dev' or 'beta' 15 | - name: Install flutter dependencies 16 | run: flutter pub get 17 | - name: Install packages dependencies 18 | run: flutter packages get 19 | - name: Run tests with coverage 20 | run: flutter test --coverage 21 | - name: Coveralls GitHub Action 22 | uses: coverallsapp/github-action@v1.0.1 23 | with: 24 | github-token: ${{ secrets.GITHUB_TOKEN }} 25 | -------------------------------------------------------------------------------- /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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/card_settings_header_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/card_settings.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | group('CardSettingsHeader', () { 7 | Widget widgetTree = Container(); 8 | var label = "ArbitraryTitle"; 9 | 10 | setUpAll(() async { 11 | widgetTree = MaterialApp( 12 | home: CardSettings( 13 | children: [ 14 | CardSettingsSection( 15 | header: CardSettingsHeader( 16 | label: label, 17 | ), 18 | ), 19 | ], 20 | ), 21 | ); 22 | }); 23 | 24 | testWidgets('displays properties', (WidgetTester tester) async { 25 | // arrange 26 | await tester.pumpWidget(widgetTree); 27 | 28 | // assert 29 | final labelFinder = find.text(label); 30 | expect(labelFinder, findsOneWidget); 31 | }); 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # https://www.dartlang.org/guides/language/analysis-options 2 | analyzer: 3 | errors: 4 | todo: ignore 5 | exclude: 6 | - flutter/** 7 | - lib/api/*.dart 8 | 9 | # Source of linter options: 10 | # http://dart-lang.github.io/linter/lints/options/options.html 11 | linter: 12 | rules: 13 | - camel_case_types 14 | - hash_and_equals 15 | - iterable_contains_unrelated_type 16 | - list_remove_unrelated_type 17 | - unrelated_type_equality_checks 18 | - valid_regexps 19 | - avoid_empty_else 20 | - cancel_subscriptions 21 | - close_sinks 22 | - unnecessary_const 23 | - unnecessary_new 24 | - always_declare_return_types 25 | - empty_constructor_bodies 26 | - annotate_overrides 27 | - avoid_init_to_null 28 | - constant_identifier_names 29 | - one_member_abstracts 30 | - slash_for_doc_comments 31 | - sort_constructors_first 32 | - unnecessary_brace_in_string_interps 33 | -------------------------------------------------------------------------------- /example/example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: card_settings 2 | description: A flutter package for building card based settings forms. This includes a library of pre-built form field widgets. 3 | version: 3.5.1 4 | homepage: https://github.com/codegrue/card_settings 5 | issue_tracker: https://github.com/codegrue/card_settings/issues 6 | 7 | dependencies: 8 | flutter: 9 | sdk: flutter 10 | flutter_web_plugins: 11 | sdk: flutter 12 | intl: ^0.18.0 13 | meta: ^1.8.0 14 | extended_masked_text: ^2.3.1 15 | flutter_cupertino_settings: ^0.5.0 # show apple style dialogs 16 | flutter_material_pickers: ^3.5.0 # show android style dialogs 17 | pattern_formatter: ^3.0.0 # used for localized doubles 18 | flutter_multi_formatter: ^2.10.4 # used for localized phone numbers 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | test: 24 | mockito: ^5.3.2 25 | 26 | environment: 27 | sdk: ">=2.12.0 <4.0.0" 28 | 29 | flutter: 30 | uses-material-design: true 31 | -------------------------------------------------------------------------------- /example/card_settings_example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /card_settings.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/decimal_text_input_formatter_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/helpers/decimal_text_input_formatter.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | group('DecimalTextInputFormatter', () { 6 | test('handles decimal truncation', () { 7 | var oldValue = TextEditingValue( 8 | text: "12,345.67", 9 | ); 10 | var newValue = TextEditingValue( 11 | text: "12,345.678", 12 | ); 13 | 14 | var formatter = DecimalTextInputFormatter(decimalDigits: 2); 15 | var result = formatter.formatEditUpdate(oldValue, newValue); 16 | 17 | expect(result.text, "12,345.67"); 18 | }); 19 | 20 | test('adds leading zero', () { 21 | var oldValue = TextEditingValue( 22 | text: "", 23 | ); 24 | var newValue = TextEditingValue( 25 | text: ".", 26 | ); 27 | 28 | var formatter = DecimalTextInputFormatter(decimalDigits: 2); 29 | var result = formatter.formatEditUpdate(oldValue, newValue); 30 | 31 | expect(result.text, "0."); 32 | }); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.flutter-plugins-dependencies: -------------------------------------------------------------------------------- 1 | {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"file_picker","path":"C:\\\\Users\\\\jeff\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_picker-5.3.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"file_picker","path":"C:\\\\Users\\\\jeff\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_picker-5.3.0\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\jeff\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_plugin_android_lifecycle-2.0.15\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"file_picker","path":"C:\\\\Users\\\\jeff\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_picker-5.3.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]}],"date_created":"2023-05-22 15:11:17.451790","version":"3.10.1"} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 CodeGrue 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/card_settings_instructions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/card_settings.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | group('CardSettingsInstructions', () { 7 | Widget widgetTree = Container(); 8 | var instructions = "Don't panic!"; 9 | var color = Colors.indigo; 10 | 11 | setUpAll(() async { 12 | widgetTree = MaterialApp( 13 | home: CardSettings( 14 | children: [ 15 | CardSettingsSection( 16 | instructions: CardSettingsInstructions( 17 | text: instructions, 18 | textColor: color, 19 | ), 20 | ), 21 | ], 22 | ), 23 | ); 24 | }); 25 | 26 | testWidgets('displays properties', (WidgetTester tester) async { 27 | // arrange 28 | await tester.pumpWidget(widgetTree); 29 | 30 | // assert 31 | final instructionsFinder = find.text(instructions); 32 | expect(instructionsFinder, findsOneWidget); 33 | final value = instructionsFinder.evaluate().first.widget as Text; 34 | expect(value.style?.color, color); 35 | }); 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /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 | // ignore: avoid_relative_lib_imports 12 | import '../lib/main.dart'; 13 | 14 | void main() { 15 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 16 | // Build our app and trigger a frame. 17 | await tester.pumpWidget(const MyApp()); 18 | 19 | // Verify that our counter starts at 0. 20 | expect(find.text('0'), findsOneWidget); 21 | expect(find.text('1'), findsNothing); 22 | 23 | // Tap the '+' icon and trigger a frame. 24 | await tester.tap(find.byIcon(Icons.add)); 25 | await tester.pump(); 26 | 27 | // Verify that our counter has incremented. 28 | expect(find.text('0'), findsNothing); 29 | expect(find.text('1'), findsOneWidget); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /lib/helpers/decimal_text_input_formatter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | import 'package:flutter/services.dart'; 3 | 4 | /// Limits text entry to decimal characters only 5 | class DecimalTextInputFormatter extends TextInputFormatter { 6 | DecimalTextInputFormatter({this.decimalDigits}) 7 | : assert(decimalDigits == null || decimalDigits > 0); 8 | 9 | final int? decimalDigits; 10 | 11 | @override 12 | TextEditingValue formatEditUpdate( 13 | TextEditingValue oldValue, // unused. 14 | TextEditingValue newValue, 15 | ) { 16 | TextSelection newSelection = newValue.selection; 17 | String truncated = newValue.text; 18 | 19 | if (decimalDigits != null) { 20 | String value = newValue.text; 21 | 22 | if (value.contains(".") && 23 | value.substring(value.indexOf(".") + 1).length > decimalDigits!) { 24 | truncated = oldValue.text; 25 | newSelection = oldValue.selection; 26 | } else if (value == ".") { 27 | truncated = "0."; 28 | 29 | newSelection = newValue.selection.copyWith( 30 | baseOffset: math.min(truncated.length, truncated.length + 1), 31 | extentOffset: math.min(truncated.length, truncated.length + 1), 32 | ); 33 | } 34 | 35 | return TextEditingValue( 36 | text: truncated, 37 | selection: newSelection, 38 | composing: TextRange.empty, 39 | ); 40 | } 41 | return newValue; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/widgets/card_field_layout.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:card_settings/widgets/card_settings_widget.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | /// Lays out multiple fields in a row 8 | class CardFieldLayout extends StatelessWidget implements CardSettingsWidget { 9 | CardFieldLayout( 10 | this.children, { 11 | this.flexValues, 12 | this.visible = true, 13 | this.showMaterialonIOS = false, 14 | }); 15 | 16 | /// the field widgets to place into the layout 17 | final List children; 18 | 19 | /// the values that control the relative widths of the layed out widgets 20 | final List? flexValues; 21 | 22 | /// Force the widget to use Material style on an iOS device 23 | @override 24 | final bool showMaterialonIOS; 25 | 26 | /// If false hides the widget on the card setting panel 27 | @override 28 | final bool visible; 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | if (!visible) return Container(); 33 | 34 | int iterator = 0; 35 | 36 | return Row( 37 | children: children 38 | .map((c) => Flexible( 39 | child: c, 40 | flex: (flexValues == null) ? 1 : (flexValues?[iterator++] ?? 1), 41 | )) 42 | .toList(), 43 | ); 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.CreateAndShow(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 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '10.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/card_settings_example_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/android/example_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /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. 5 | 6 | version: 7 | revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 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: d3d8effc686d73e0114d71abdcccef63fa1f25d2 17 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 18 | - platform: android 19 | create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 20 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 21 | - platform: ios 22 | create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 23 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 24 | - platform: linux 25 | create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 26 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 27 | - platform: macos 28 | create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 29 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 30 | - platform: web 31 | create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 32 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 33 | - platform: windows 34 | create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 35 | base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 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 | -------------------------------------------------------------------------------- /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_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /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 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /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 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /lib/helpers/platform_functions.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:card_settings/widgets/card_settings_panel.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// this centralizes code to determine if we want to display the cupertino 7 | /// version or the material version, since this can be determined by 8 | /// several settings throughout the package 9 | bool showCupertino( 10 | BuildContext? context, 11 | bool? showMaterialonIOS, { 12 | bool mockIOS = false, 13 | }) { 14 | bool defaultValue = false; 15 | 16 | // don't show on web 17 | if (kIsWeb) return defaultValue; 18 | 19 | // if we are on iOS then determine if we want material 20 | if (mockIOS || Platform.isIOS) { 21 | // if showMaterialonIOS not specified calculate it 22 | if (showMaterialonIOS == null) { 23 | showMaterialonIOS = defaultValue; 24 | 25 | if (context != null) 26 | // set showMaterialOnIOS to parent CardSettings value 27 | showMaterialonIOS = 28 | CardSettings.of(context)?.showMaterialonIOS ?? defaultValue; 29 | } 30 | 31 | return !showMaterialonIOS; 32 | } 33 | 34 | // material by default 35 | return defaultValue; 36 | } 37 | 38 | /// This centralizes the style calculations for field labels, used by almost all widgets in this package 39 | TextStyle? labelStyle(BuildContext context, bool enabled) { 40 | var theme = Theme.of(context); 41 | var style = theme.textTheme.titleMedium; 42 | if (!enabled) style = style?.copyWith(color: theme.disabledColor); 43 | return style; 44 | } 45 | 46 | /// This centralizes the style calculations for content, used by almost all widgets in this package 47 | TextStyle? contentStyle(BuildContext context, dynamic value, bool enabled) { 48 | var theme = Theme.of(context); 49 | var style = theme.textTheme.titleMedium?.copyWith( 50 | color: 51 | (value == null) ? theme.hintColor : theme.textTheme.titleMedium?.color); 52 | if (!enabled) style = style?.copyWith(color: theme.disabledColor); 53 | return style; 54 | } 55 | -------------------------------------------------------------------------------- /test/converter_functions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | import 'package:card_settings/card_settings.dart'; 5 | 6 | void main() { 7 | group('intelligentCast', () { 8 | test('handles doubles', () { 9 | double? result = intelligentCast("3.145"); 10 | expect(result, 3.145); 11 | }); 12 | 13 | test('handles booleans', () { 14 | bool? result = intelligentCast("True"); 15 | expect(result, true); 16 | 17 | result = intelligentCast("Yes"); 18 | expect(result, true); 19 | 20 | result = intelligentCast("1"); 21 | expect(result, true); 22 | 23 | result = intelligentCast("False"); 24 | expect(result, false); 25 | 26 | result = intelligentCast("No"); 27 | expect(result, false); 28 | 29 | result = intelligentCast("0"); 30 | expect(result, false); 31 | }); 32 | 33 | test('handles integers', () { 34 | int? result = intelligentCast("42"); 35 | expect(result, 42); 36 | }); 37 | 38 | test('handles nulls', () { 39 | bool? boolResult = intelligentCast(null); 40 | expect(boolResult, false); 41 | 42 | int? intResult = intelligentCast(null); 43 | expect(intResult, null); 44 | 45 | double? doubleResult = intelligentCast(null); 46 | expect(doubleResult, null); 47 | 48 | Color? colorResult = intelligentCast(null); 49 | expect(colorResult, null); 50 | }); 51 | 52 | test('handles Strings', () { 53 | String? result = intelligentCast('sample'); 54 | expect(result, 'sample'); 55 | 56 | result = intelligentCast(''); // empty string becomes null 57 | expect(result, null); 58 | }); 59 | 60 | test('handles Colors', () { 61 | Color? result = intelligentCast("FFFFFFFF"); 62 | expect(result, Colors.white); 63 | 64 | result = intelligentCast("000000"); 65 | expect(result, Colors.black); 66 | }); 67 | }); 68 | } 69 | -------------------------------------------------------------------------------- /lib/card_settings.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | /// Package for building card based settings forms 5 | library card_settings; 6 | 7 | export 'helpers/converter_functions.dart'; 8 | export 'widgets/action_fields/card_settings_button.dart'; 9 | export 'widgets/card_field_layout.dart'; 10 | export 'widgets/card_settings_widget.dart'; 11 | export 'widgets/card_settings_field.dart'; 12 | export 'widgets/card_settings_panel.dart'; 13 | export 'widgets/information_fields/card_settings_header.dart'; 14 | export 'widgets/information_fields/card_settings_instructions.dart'; 15 | export 'widgets/numeric_fields/card_settings_currency.dart'; 16 | export 'widgets/numeric_fields/card_settings_double.dart'; 17 | export 'widgets/numeric_fields/card_settings_int.dart'; 18 | export 'widgets/numeric_fields/card_settings_switch.dart'; 19 | export 'widgets/picker_fields/card_settings_color_picker.dart'; 20 | export 'widgets/picker_fields/card_settings_date_picker.dart'; 21 | export 'widgets/picker_fields/card_settings_file_picker.dart'; 22 | export 'widgets/picker_fields/card_settings_list_picker.dart'; 23 | export 'widgets/picker_fields/card_settings_radio_picker.dart'; 24 | export 'widgets/picker_fields/card_settings_selection_picker.dart'; 25 | export 'widgets/picker_fields/card_settings_checkbox_picker.dart'; 26 | export 'widgets/picker_fields/card_settings_number_picker.dart'; 27 | export 'widgets/picker_fields/card_settings_time_picker.dart'; 28 | export 'widgets/picker_fields/card_settings_datetime_picker.dart'; 29 | export 'widgets/text_fields/card_settings_email.dart'; 30 | export 'widgets/text_fields/card_settings_paragraph.dart'; 31 | export 'widgets/text_fields/card_settings_password.dart'; 32 | export 'widgets/text_fields/card_settings_phone.dart'; 33 | export 'widgets/text_fields/card_settings_text.dart'; 34 | export 'widgets/numeric_fields/card_settings_slider.dart'; 35 | 36 | //export 'package:flutter_material_pickers/flutter_material_pickers.dart'show PickerModel; 37 | export 'models/picker_model.dart'; 38 | 39 | /// this is the default height for the cupertino scroll wheel 40 | const double kCupertinoPickerSheetHeight = 216.0; 41 | 42 | /// this is the default height for a single item in cupertino picker 43 | const double kCupertinoPickerItemHeight = 32.0; 44 | -------------------------------------------------------------------------------- /example/lib/plumbing/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:adaptive_theme/adaptive_theme.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'scaffold.dart'; 5 | 6 | class ExampleTheme extends StatelessWidget { 7 | const ExampleTheme({ 8 | Key? key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return AdaptiveTheme( 14 | initial: AdaptiveThemeMode.light, 15 | light: _buildTheme(Brightness.light), 16 | dark: _buildTheme(Brightness.dark), 17 | builder: (context, theme) { 18 | return MaterialApp( 19 | title: 'Card Settings Example', 20 | theme: theme, 21 | home: const ExampleScaffold(), 22 | ); 23 | }, 24 | ); 25 | } 26 | } 27 | 28 | ThemeData _buildTheme(Brightness brightness) { 29 | if (brightness == Brightness.dark) { 30 | return ThemeData.dark(); 31 | } else { 32 | return ThemeData( 33 | primaryColor: Colors.teal, // app header background 34 | secondaryHeaderColor: Colors.indigo[400], // card header background 35 | cardColor: Colors.white, // app background color 36 | textTheme: TextTheme( 37 | labelLarge: TextStyle(color: Colors.deepPurple[900]), // button text 38 | titleMedium: TextStyle(color: Colors.grey[800]), // input text 39 | titleLarge: const TextStyle(color: Colors.white), // card header text 40 | ), 41 | textButtonTheme: TextButtonThemeData( 42 | style: ButtonStyle( 43 | backgroundColor: MaterialStateProperty.all( 44 | Colors.indigo[100]!), // button background color 45 | foregroundColor: MaterialStateProperty.all( 46 | Colors.white), // button text color 47 | ), 48 | ), 49 | primaryTextTheme: TextTheme( 50 | titleLarge: TextStyle(color: Colors.lightBlue[50]), // app header text 51 | ), 52 | inputDecorationTheme: InputDecorationTheme( 53 | labelStyle: TextStyle(color: Colors.indigo[400]), // style for labels 54 | ), 55 | //fontFamily: GoogleFonts.getFont('Paprika').fontFamily, colorScheme: ColorScheme(background: Colors.indigo[100]), 56 | // cardTheme: CardTheme( 57 | // shape: RoundedRectangleBorder( 58 | // side: BorderSide(width: 2, color: Colors.orange), 59 | // borderRadius: BorderRadius.circular(20), 60 | // ), 61 | // ), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /test/card_settings_list_picker_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/card_settings.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | group('CardSettingsListPicker', () { 7 | Widget widgetTree = Container(); 8 | var label = "PickOne"; 9 | var iconData = Icons.home; 10 | var option1 = PickerModel("Aaa", code: "A", icon: Icon(iconData)); 11 | var option2 = PickerModel("Bbb", code: "B", icon: Icon(iconData)); 12 | var option3 = PickerModel("Ccc", code: "C", icon: Icon(iconData)); 13 | var items = [option1, option2, option3]; 14 | var requiredIndicator = "#"; 15 | var initialValue = option1; 16 | 17 | setUpAll(() async { 18 | widgetTree = MaterialApp( 19 | home: CardSettings( 20 | children: [ 21 | CardSettingsSection( 22 | children: [ 23 | CardSettingsSelectionPicker( 24 | label: label, 25 | initialItem: initialValue, 26 | items: items, 27 | iconizer: (item) => item?.icon, 28 | requiredIndicator: Text(requiredIndicator), 29 | ) 30 | ], 31 | ), 32 | ], 33 | ), 34 | ); 35 | }); 36 | 37 | testWidgets('displays properties', (WidgetTester tester) async { 38 | // arrange 39 | await tester.pumpWidget(widgetTree); 40 | 41 | // assert 42 | expect(find.text(label), findsOneWidget); 43 | expect(find.text(option1.name), findsOneWidget); 44 | //expect(find.byIcon(iconData), findsOneWidget); 45 | expect(find.text(requiredIndicator), findsOneWidget); 46 | }); 47 | 48 | testWidgets('picks from dialog', (WidgetTester tester) async { 49 | // arrange 50 | await tester.pumpWidget(widgetTree); 51 | 52 | // act 53 | await tester.tap(find.text(option1.name)); // tap field 54 | await tester.pumpAndSettle(); 55 | 56 | await tester.tap(find.text(option2.name)); // tap item in dialog 57 | await tester.pumpAndSettle(); 58 | 59 | await tester.tap(find.text("OK")); 60 | await tester.pumpAndSettle(); 61 | 62 | // assert 63 | expect(find.text(option1.name), findsNothing); 64 | expect(find.text(option2.name), findsOneWidget); 65 | expect(find.text(option3.name), findsNothing); 66 | }); 67 | }); 68 | } 69 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | namespace "com.example.example" 30 | compileSdkVersion flutter.compileSdkVersion 31 | ndkVersion flutter.ndkVersion 32 | 33 | compileOptions { 34 | sourceCompatibility JavaVersion.VERSION_1_8 35 | targetCompatibility JavaVersion.VERSION_1_8 36 | } 37 | 38 | kotlinOptions { 39 | jvmTarget = '1.8' 40 | } 41 | 42 | sourceSets { 43 | main.java.srcDirs += 'src/main/kotlin' 44 | } 45 | 46 | defaultConfig { 47 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 48 | applicationId "com.example.example" 49 | // You can update the following values to match your application needs. 50 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 51 | minSdkVersion flutter.minSdkVersion 52 | targetSdkVersion flutter.targetSdkVersion 53 | versionCode flutterVersionCode.toInteger() 54 | versionName flutterVersionName 55 | } 56 | 57 | buildTypes { 58 | release { 59 | // TODO: Add your own signing config for the release build. 60 | // Signing with the debug keys for now, so `flutter run --release` works. 61 | signingConfig signingConfigs.debug 62 | } 63 | } 64 | } 65 | 66 | flutter { 67 | source '../..' 68 | } 69 | 70 | dependencies { 71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 72 | } 73 | -------------------------------------------------------------------------------- /example/lib/plumbing/model.dart: -------------------------------------------------------------------------------- 1 | // example viewmodel for the form 2 | import 'package:card_settings/card_settings.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | 6 | class PonyModel { 7 | String name = 'Twilight Sparkle'; 8 | PickerModel type = 9 | ponyTypes.firstWhere((element) => element.name == "Pegasi"); 10 | int age = 7; 11 | PickerModel gender = 12 | ponyGenders.firstWhere((element) => element.name == "Female"); 13 | String coatColor = 'D19FE4'; 14 | String maneColor = '273873'; 15 | bool hasSpots = false; 16 | String spotColor = 'FF5198'; 17 | String description = 18 | 'An intelligent and dutiful scholar with an avid love of learning and skill in unicorn magic such as levitation, teleportation, and the creation of force fields.'; 19 | List hobbies = [ 20 | 'flying', 21 | 'singing', 22 | 'exploring', 23 | 'hiding', 24 | 'coloring' 25 | ]; 26 | double height = 3.5; 27 | int weight = 45; 28 | PickerModel style = 29 | ponyStyles.firstWhere((element) => element.name == "Majestic"); 30 | DateTime showDateTime = DateTime(2010, 10, 10, 20, 30); 31 | double ticketPrice = 65.99; 32 | int boxOfficePhone = 18005551212; 33 | String email = 'me@nowhere.org'; 34 | String password = 'secret1'; 35 | double rating = 0.25; 36 | Uint8List? photo; 37 | Uint8List video = Uint8List(1024 * 1024 * 15); 38 | Uint8List audio = Uint8List(1024 * 4); 39 | Uint8List customFile = Uint8List(4); 40 | 41 | void loadMedia() async { 42 | photo = (await rootBundle.load('assets/twilight_sparkle.png')) 43 | .buffer 44 | .asUint8List(); 45 | } 46 | } 47 | 48 | const List allHobbies = [ 49 | 'running', 50 | 'flying', 51 | 'coloring', 52 | 'jumping', 53 | 'eating', 54 | 'hiding', 55 | 'exploring', 56 | 'singing', 57 | 'dancing', 58 | 'acting', 59 | 'cleaning', 60 | 'shopping', 61 | 'sewing', 62 | 'cooking', 63 | ]; 64 | 65 | const List ponyTypes = [ 66 | PickerModel('Earth', code: 'E'), 67 | PickerModel('Unicorn', code: 'U'), 68 | PickerModel('Pegasi', code: 'P'), 69 | PickerModel('Alicorn', code: 'A'), 70 | ]; 71 | 72 | const List ponyGenders = [ 73 | PickerModel('Male', code: 'M'), 74 | PickerModel('Female', code: 'F'), 75 | ]; 76 | 77 | const List ponyStyles = [ 78 | PickerModel('Majestic', code: 'MG', icon: Icon(Icons.sort)), 79 | PickerModel('Scrawny', code: 'SC', icon: Icon(Icons.clear_all)), 80 | PickerModel('Sleek', code: 'SL', icon: Icon(Icons.swap_calls)), 81 | ]; 82 | -------------------------------------------------------------------------------- /lib/widgets/information_fields/card_settings_instructions.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:card_settings/helpers/platform_functions.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/cupertino.dart'; 7 | 8 | import '../card_settings_panel.dart'; 9 | import '../card_settings_widget.dart'; 10 | 11 | /// This is a read only section of text 12 | class CardSettingsInstructions extends StatelessWidget 13 | implements CardSettingsWidget { 14 | CardSettingsInstructions({ 15 | this.text = 'Instructions here...', 16 | this.backgroundColor, 17 | this.textColor, 18 | this.showMaterialonIOS, 19 | this.visible = true, 20 | this.fieldPadding, 21 | }); 22 | 23 | /// The text for the instructions 24 | final String text; 25 | 26 | /// the color for the background 27 | final Color? backgroundColor; 28 | 29 | /// The color of the text 30 | final Color? textColor; 31 | 32 | /// Force the widget to use Material style on an iOS device 33 | @override 34 | final bool? showMaterialonIOS; 35 | 36 | /// If false hides the widget on the card setting panel 37 | @override 38 | final bool visible; 39 | 40 | /// padding to place around then entire field 41 | final EdgeInsetsGeometry? fieldPadding; 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | if (!visible) return Container(); 46 | 47 | TextStyle textStyle = Theme.of(context) 48 | .primaryTextTheme 49 | .bodySmall! 50 | .copyWith(color: textColor ?? Theme.of(context).colorScheme.secondary); 51 | if (showCupertino(context, showMaterialonIOS)) { 52 | return Container( 53 | padding: EdgeInsets.only(top: 8.0, left: 8.0), 54 | child: Text( 55 | text, 56 | style: TextStyle(color: CupertinoColors.inactiveGray), 57 | ), 58 | // color: CupertinoColors.lightBackgroundGray, 59 | ); 60 | } else 61 | return _materialInstruction(context, textStyle); 62 | } 63 | 64 | Widget _materialInstruction(BuildContext context, TextStyle textStyle) { 65 | EdgeInsetsGeometry _fieldPadding = (fieldPadding ?? 66 | CardSettings.of(context)?.fieldPadding ?? 67 | EdgeInsets.all(14.0)); 68 | 69 | return Container( 70 | margin: EdgeInsets.all(0.0), 71 | decoration: 72 | BoxDecoration(color: backgroundColor ?? Theme.of(context).cardColor), 73 | padding: _fieldPadding, 74 | child: Wrap( 75 | children: [ 76 | Text( 77 | text, 78 | style: textStyle, 79 | ), 80 | ], 81 | ), 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DKImagePickerController/Core (4.3.2): 3 | - DKImagePickerController/ImageDataManager 4 | - DKImagePickerController/Resource 5 | - DKImagePickerController/ImageDataManager (4.3.2) 6 | - DKImagePickerController/PhotoGallery (4.3.2): 7 | - DKImagePickerController/Core 8 | - DKPhotoGallery 9 | - DKImagePickerController/Resource (4.3.2) 10 | - DKPhotoGallery (0.0.17): 11 | - DKPhotoGallery/Core (= 0.0.17) 12 | - DKPhotoGallery/Model (= 0.0.17) 13 | - DKPhotoGallery/Preview (= 0.0.17) 14 | - DKPhotoGallery/Resource (= 0.0.17) 15 | - SDWebImage 16 | - SwiftyGif 17 | - DKPhotoGallery/Core (0.0.17): 18 | - DKPhotoGallery/Model 19 | - DKPhotoGallery/Preview 20 | - SDWebImage 21 | - SwiftyGif 22 | - DKPhotoGallery/Model (0.0.17): 23 | - SDWebImage 24 | - SwiftyGif 25 | - DKPhotoGallery/Preview (0.0.17): 26 | - DKPhotoGallery/Model 27 | - DKPhotoGallery/Resource 28 | - SDWebImage 29 | - SwiftyGif 30 | - DKPhotoGallery/Resource (0.0.17): 31 | - SDWebImage 32 | - SwiftyGif 33 | - file_picker (0.0.1): 34 | - DKImagePickerController/PhotoGallery 35 | - Flutter 36 | - Flutter (1.0.0) 37 | - path_provider_ios (0.0.1): 38 | - Flutter 39 | - SDWebImage (5.9.2): 40 | - SDWebImage/Core (= 5.9.2) 41 | - SDWebImage/Core (5.9.2) 42 | - shared_preferences_ios (0.0.1): 43 | - Flutter 44 | - SwiftyGif (5.3.0) 45 | 46 | DEPENDENCIES: 47 | - file_picker (from `.symlinks/plugins/file_picker/ios`) 48 | - Flutter (from `Flutter`) 49 | - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) 50 | - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) 51 | 52 | SPEC REPOS: 53 | trunk: 54 | - DKImagePickerController 55 | - DKPhotoGallery 56 | - SDWebImage 57 | - SwiftyGif 58 | 59 | EXTERNAL SOURCES: 60 | file_picker: 61 | :path: ".symlinks/plugins/file_picker/ios" 62 | Flutter: 63 | :path: Flutter 64 | path_provider_ios: 65 | :path: ".symlinks/plugins/path_provider_ios/ios" 66 | shared_preferences_ios: 67 | :path: ".symlinks/plugins/shared_preferences_ios/ios" 68 | 69 | SPEC CHECKSUMS: 70 | DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d 71 | DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 72 | file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 73 | Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a 74 | path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 75 | SDWebImage: 0b42b8719ab0c5257177d5894306e8a336b21cbb 76 | shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad 77 | SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40 78 | 79 | PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea 80 | 81 | COCOAPODS: 1.11.3 82 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /lib/widgets/information_fields/card_settings_header.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:card_settings/helpers/platform_functions.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; 7 | 8 | import '../card_settings_panel.dart'; 9 | import '../card_settings_widget.dart'; 10 | 11 | /// This is a header to distinguish sections of the form. 12 | class CardSettingsHeader extends StatelessWidget implements CardSettingsWidget { 13 | CardSettingsHeader({ 14 | this.label = 'Label', 15 | this.labelAlign = TextAlign.left, 16 | this.height = 44.0, 17 | this.color, 18 | this.showMaterialonIOS, 19 | this.visible = true, 20 | this.child, 21 | this.fieldPadding, 22 | }); 23 | 24 | /// the text for the header 25 | final String label; 26 | 27 | /// how to align the header text 28 | final TextAlign labelAlign; 29 | 30 | /// the height of the content 31 | final double height; 32 | 33 | /// the background color 34 | final Color? color; 35 | 36 | /// Force the widget to use Material style on an iOS device 37 | @override 38 | final bool? showMaterialonIOS; 39 | 40 | /// If false hides the widget on the card setting panel 41 | @override 42 | final bool visible; 43 | 44 | /// The child to place in the content, instead of the label 45 | final Widget? child; 46 | 47 | /// placed padding around the entire widget 48 | final EdgeInsetsGeometry? fieldPadding; 49 | 50 | @override 51 | Widget build(BuildContext context) { 52 | if (!visible) return Container(); 53 | if (child != null) return child ?? Container(); 54 | 55 | if (showCupertino(context, showMaterialonIOS)) 56 | return _cupertinoHeader(context); 57 | else 58 | return _materialHeader(context); 59 | } 60 | 61 | Widget _cupertinoHeader(BuildContext context) { 62 | return Row( 63 | children: [ 64 | Expanded( 65 | child: CSHeader(label), 66 | ), 67 | ], 68 | ); 69 | } 70 | 71 | Widget _materialHeader(BuildContext context) { 72 | EdgeInsetsGeometry _fieldPadding = (fieldPadding ?? 73 | CardSettings.of(context)?.fieldPadding ?? 74 | EdgeInsets.only(left: 14.0, top: 8.0, right: 14.0, bottom: 8.0)); 75 | 76 | return Container( 77 | margin: EdgeInsets.all(0.0), 78 | decoration: BoxDecoration( 79 | color: color ?? Theme.of(context).secondaryHeaderColor, 80 | ), 81 | height: height, 82 | padding: _fieldPadding, 83 | child: Row( 84 | children: [ 85 | Expanded( 86 | child: Text( 87 | label, 88 | style: Theme.of(context).textTheme.titleLarge, 89 | textAlign: labelAlign, 90 | ), 91 | ), 92 | ], 93 | ), 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/widgets/text_fields/card_settings_email.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | 7 | import '../../card_settings.dart'; 8 | import '../../interfaces/common_field_properties.dart'; 9 | import '../../interfaces/text_field_properties.dart'; 10 | 11 | /// This is a password field. It obscures the entered text. 12 | class CardSettingsEmail extends CardSettingsText 13 | implements ICommonFieldProperties, ITextFieldProperties { 14 | CardSettingsEmail({ 15 | Key? key, 16 | String label = 'Email', 17 | bool contentOnNewLine = false, 18 | double? labelWidth, 19 | TextAlign? labelAlign, 20 | TextAlign? contentAlign, 21 | String? initialValue, 22 | Icon? icon, 23 | Widget? requiredIndicator, 24 | int maxLength = 30, 25 | bool visible = true, 26 | bool enabled = true, 27 | bool autofocus = false, 28 | bool obscureText = false, 29 | bool autocorrect = false, 30 | AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction, 31 | FormFieldValidator? validator, 32 | FormFieldSetter? onSaved, 33 | ValueChanged? onChanged, 34 | TextEditingController? controller, 35 | FocusNode? focusNode, 36 | TextInputAction? inputAction, 37 | FocusNode? inputActionNode, 38 | TextInputType keyboardType = TextInputType.emailAddress, 39 | TextStyle? style, 40 | MaxLengthEnforcement? maxLengthEnforcement = MaxLengthEnforcement.enforced, 41 | ValueChanged? onFieldSubmitted, 42 | List? inputFormatters, 43 | bool? showMaterialonIOS, 44 | EdgeInsetsGeometry? fieldPadding, 45 | }) : super( 46 | key: key, 47 | label: label, 48 | labelWidth: labelWidth, 49 | labelAlign: labelAlign, 50 | showMaterialonIOS: showMaterialonIOS, 51 | fieldPadding: fieldPadding, 52 | contentAlign: contentAlign, 53 | contentOnNewLine: contentOnNewLine, 54 | initialValue: initialValue, 55 | maxLength: maxLength, 56 | icon: icon, 57 | requiredIndicator: requiredIndicator, 58 | visible: visible, 59 | enabled: enabled, 60 | autofocus: autofocus, 61 | obscureText: obscureText, 62 | autocorrect: autocorrect, 63 | autovalidateMode: autovalidateMode, 64 | validator: validator, 65 | onSaved: onSaved, 66 | onChanged: onChanged, 67 | controller: controller, 68 | focusNode: focusNode, 69 | inputAction: inputAction, 70 | inputActionNode: inputActionNode, 71 | keyboardType: keyboardType, 72 | style: style, 73 | maxLengthEnforcement: maxLengthEnforcement, 74 | onFieldSubmitted: onFieldSubmitted, 75 | inputFormatters: inputFormatters, 76 | ); 77 | } 78 | -------------------------------------------------------------------------------- /lib/widgets/text_fields/card_settings_password.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | 7 | import '../../card_settings.dart'; 8 | import '../../interfaces/common_field_properties.dart'; 9 | import '../../interfaces/text_field_properties.dart'; 10 | 11 | /// This is a password field. It obscures the entered text. 12 | class CardSettingsPassword extends CardSettingsText 13 | implements ICommonFieldProperties, ITextFieldProperties { 14 | CardSettingsPassword({ 15 | Key? key, 16 | String label = 'Password', 17 | String hintText = '', 18 | double? labelWidth, 19 | TextAlign? labelAlign, 20 | TextAlign? contentAlign, 21 | bool contentOnNewLine = false, 22 | String? initialValue, 23 | Icon? icon, 24 | Widget? requiredIndicator, 25 | int maxLength = 20, 26 | bool visible = true, 27 | bool enabled = true, 28 | bool autofocus = false, 29 | bool obscureText = true, 30 | bool autocorrect = false, 31 | AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction, 32 | FormFieldValidator? validator, 33 | FormFieldSetter? onSaved, 34 | ValueChanged? onChanged, 35 | TextEditingController? controller, 36 | FocusNode? focusNode, 37 | TextInputAction? inputAction, 38 | FocusNode? inputActionNode, 39 | TextInputType keyboardType = TextInputType.text, 40 | TextStyle? style, 41 | MaxLengthEnforcement? maxLengthEnforcement = MaxLengthEnforcement.enforced, 42 | ValueChanged? onFieldSubmitted, 43 | List? inputFormatters, 44 | bool? showMaterialonIOS, 45 | EdgeInsetsGeometry? fieldPadding, 46 | }) : super( 47 | key: key, 48 | label: label, 49 | labelWidth: labelWidth, 50 | labelAlign: labelAlign, 51 | hintText: hintText, 52 | showMaterialonIOS: showMaterialonIOS, 53 | fieldPadding: fieldPadding, 54 | contentAlign: contentAlign, 55 | contentOnNewLine: contentOnNewLine, 56 | initialValue: initialValue, 57 | maxLength: maxLength, 58 | icon: icon, 59 | requiredIndicator: requiredIndicator, 60 | visible: visible, 61 | enabled: enabled, 62 | autofocus: autofocus, 63 | obscureText: obscureText, 64 | autocorrect: autocorrect, 65 | autovalidateMode: autovalidateMode, 66 | validator: validator, 67 | onSaved: onSaved, 68 | onChanged: onChanged, 69 | controller: controller, 70 | focusNode: focusNode, 71 | inputAction: inputAction, 72 | inputActionNode: inputActionNode, 73 | keyboardType: keyboardType, 74 | style: style, 75 | maxLengthEnforcement: maxLengthEnforcement, 76 | onFieldSubmitted: onFieldSubmitted, 77 | inputFormatters: inputFormatters, 78 | ); 79 | } 80 | -------------------------------------------------------------------------------- /example/lib/plumbing/scaffold.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:adaptive_theme/adaptive_theme.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 7 | 8 | import '../example.dart'; 9 | 10 | class ExampleScaffold extends StatefulWidget { 11 | const ExampleScaffold({Key? key}) : super(key: key); 12 | 13 | @override 14 | _ExampleScaffoldState createState() => _ExampleScaffoldState(); 15 | } 16 | 17 | class _ExampleScaffoldState extends State { 18 | bool _showMaterialonIOS = true; 19 | 20 | final GlobalKey _scaffoldKey = GlobalKey(); 21 | final GlobalKey _formWidgetKey = 22 | GlobalKey(); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | var orientation = MediaQuery.of(context).orientation; 27 | 28 | final form = ExampleForm(orientation, _showMaterialonIOS, _scaffoldKey, 29 | key: _formWidgetKey, onValueChanged: showSnackBar); 30 | 31 | return Scaffold( 32 | key: _scaffoldKey, 33 | backgroundColor: Theme.of(context).colorScheme.background, 34 | appBar: AppBar( 35 | title: const Text("My Little Pony"), 36 | actions: [ 37 | IconButton( 38 | icon: Theme.of(context).brightness == Brightness.dark 39 | ? const Icon(Icons.brightness_7) 40 | : const Icon(Icons.brightness_4), 41 | onPressed: () => AdaptiveTheme.of(context).toggleThemeMode(), 42 | ), 43 | _cupertinoSwitchButton(), 44 | IconButton( 45 | icon: const Icon(Icons.save), 46 | onPressed: (_formWidgetKey.currentState == null) 47 | ? null 48 | : _formWidgetKey.currentState!.savePressed, 49 | ), 50 | ], 51 | leading: IconButton( 52 | icon: const Icon(Icons.refresh), 53 | onPressed: (_formWidgetKey.currentState == null) 54 | ? null 55 | : _formWidgetKey.currentState!.resetPressed, 56 | ), 57 | ), 58 | body: form, 59 | ); 60 | } 61 | 62 | void showSnackBar(String label, dynamic value) { 63 | ScaffoldMessenger.of(context).removeCurrentSnackBar(); 64 | ScaffoldMessenger.of(context).showSnackBar( 65 | SnackBar( 66 | duration: const Duration(seconds: 1), 67 | content: Text(label + ' = ' + value.toString()), 68 | ), 69 | ); 70 | } 71 | 72 | Widget _cupertinoSwitchButton() { 73 | // dont show this button on web 74 | if (kIsWeb) return Container(); 75 | 76 | return Container( 77 | child: Platform.isIOS 78 | ? IconButton( 79 | icon: (_showMaterialonIOS) 80 | ? const FaIcon(FontAwesomeIcons.apple) 81 | : const Icon(Icons.android), 82 | onPressed: () { 83 | setState(() { 84 | _showMaterialonIOS = !_showMaterialonIOS; 85 | }); 86 | }, 87 | ) 88 | : null, 89 | ); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/widgets/text_fields/card_settings_paragraph.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | 7 | import '../../card_settings.dart'; 8 | import '../../interfaces/common_field_properties.dart'; 9 | import '../../interfaces/text_field_properties.dart'; 10 | 11 | /// This is a password field. It obscures the entered text. 12 | class CardSettingsParagraph extends CardSettingsText 13 | implements ICommonFieldProperties, ITextFieldProperties { 14 | CardSettingsParagraph({ 15 | Key? key, 16 | String label = 'Label', 17 | String? hintText, 18 | TextAlign? labelAlign, 19 | TextAlign contentAlign = TextAlign.left, 20 | String? initialValue, 21 | Icon? icon, 22 | Widget? requiredIndicator, 23 | int maxLength = 250, 24 | int numberOfLines = 7, 25 | bool contentOnNewLine = true, 26 | bool visible = true, 27 | bool enabled = true, 28 | bool showCounter = true, 29 | bool autofocus = false, 30 | bool obscureText = false, 31 | bool autocorrect = true, 32 | AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction, 33 | FormFieldValidator? validator, 34 | FormFieldSetter? onSaved, 35 | ValueChanged? onChanged, 36 | TextEditingController? controller, 37 | FocusNode? focusNode, 38 | TextInputAction? inputAction, 39 | FocusNode? inputActionNode, 40 | TextInputType keyboardType = TextInputType.multiline, 41 | TextStyle? style, 42 | MaxLengthEnforcement? maxLengthEnforcement = MaxLengthEnforcement.enforced, 43 | ValueChanged? onFieldSubmitted, 44 | List? inputFormatters, 45 | bool? showMaterialonIOS, 46 | EdgeInsetsGeometry? fieldPadding, 47 | }) : super( 48 | key: key, 49 | label: label, 50 | labelAlign: labelAlign, 51 | hintText: hintText, 52 | contentAlign: contentAlign, 53 | showMaterialonIOS: showMaterialonIOS, 54 | fieldPadding: fieldPadding, 55 | initialValue: initialValue, 56 | contentOnNewLine: contentOnNewLine, 57 | maxLength: maxLength, 58 | icon: icon, 59 | requiredIndicator: requiredIndicator, 60 | numberOfLines: numberOfLines, 61 | showCounter: (enabled == true) ? showCounter : false, 62 | visible: visible, 63 | enabled: enabled, 64 | autofocus: autofocus, 65 | obscureText: obscureText, 66 | autocorrect: autocorrect, 67 | autovalidateMode: autovalidateMode, 68 | validator: validator, 69 | onSaved: onSaved, 70 | onChanged: onChanged, 71 | controller: controller, 72 | focusNode: focusNode, 73 | inputAction: inputAction, 74 | inputActionNode: inputActionNode, 75 | keyboardType: keyboardType, 76 | style: style, 77 | maxLengthEnforcement: maxLengthEnforcement, 78 | onFieldSubmitted: onFieldSubmitted, 79 | inputFormatters: inputFormatters, 80 | ); 81 | } 82 | -------------------------------------------------------------------------------- /lib/widgets/numeric_fields/card_settings_int.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | 7 | import '../../card_settings.dart'; 8 | import '../../interfaces/common_field_properties.dart'; 9 | 10 | /// This is a password field. It obscures the entered text. 11 | class CardSettingsInt extends CardSettingsText 12 | implements ICommonFieldProperties { 13 | CardSettingsInt({ 14 | Key? key, 15 | String label = 'Label', 16 | TextAlign? labelAlign, 17 | double? labelWidth, 18 | TextAlign? contentAlign, 19 | String? hintText, 20 | int initialValue = 0, 21 | Icon? icon, 22 | Widget? requiredIndicator, 23 | String? unitLabel, 24 | int maxLength = 10, 25 | bool visible = true, 26 | bool enabled = true, 27 | bool autofocus = false, 28 | bool obscureText = false, 29 | bool autocorrect = false, 30 | AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction, 31 | FormFieldValidator? validator, 32 | FormFieldSetter? onSaved, 33 | ValueChanged? onChanged, 34 | TextEditingController? controller, 35 | FocusNode? focusNode, 36 | TextInputAction? inputAction, 37 | FocusNode? inputActionNode, 38 | TextInputType? keyboardType, 39 | TextStyle? style, 40 | MaxLengthEnforcement? maxLengthEnforcement = MaxLengthEnforcement.enforced, 41 | ValueChanged? onFieldSubmitted, 42 | List? inputFormatters, 43 | bool? showMaterialonIOS, 44 | EdgeInsetsGeometry? fieldPadding, 45 | }) : super( 46 | key: key, 47 | label: label, 48 | hintText: hintText, 49 | labelAlign: labelAlign, 50 | labelWidth: labelWidth, 51 | showMaterialonIOS: showMaterialonIOS, 52 | contentAlign: contentAlign, 53 | initialValue: initialValue.toString(), 54 | unitLabel: unitLabel, 55 | icon: icon, 56 | requiredIndicator: requiredIndicator, 57 | maxLength: maxLength, 58 | visible: visible, 59 | enabled: enabled, 60 | autofocus: autofocus, 61 | obscureText: obscureText, 62 | autocorrect: autocorrect, 63 | autovalidateMode: autovalidateMode, 64 | fieldPadding: fieldPadding, 65 | validator: (value) { 66 | if (validator == null) return null; 67 | return validator(intelligentCast(value)); 68 | }, 69 | onSaved: (value) { 70 | if (onSaved == null) return; 71 | onSaved(intelligentCast(value)); 72 | }, 73 | onChanged: (value) { 74 | if (onChanged == null) return; 75 | onChanged(intelligentCast(value)); 76 | }, 77 | controller: controller, 78 | focusNode: focusNode, 79 | inputAction: inputAction, 80 | inputActionNode: inputActionNode, 81 | keyboardType: 82 | keyboardType ?? TextInputType.numberWithOptions(decimal: false), 83 | style: style, 84 | maxLengthEnforcement: maxLengthEnforcement, 85 | onFieldSubmitted: onFieldSubmitted, 86 | inputFormatters: [ 87 | LengthLimitingTextInputFormatter(maxLength), 88 | FilteringTextInputFormatter.allow(RegExp("[0-9]+")), 89 | ], 90 | ); 91 | } 92 | -------------------------------------------------------------------------------- /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 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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) 2022 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 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /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 and shows a win32 window with |title| and position and size 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 to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /lib/widgets/action_fields/card_settings_button.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:card_settings/helpers/platform_functions.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; 7 | 8 | import '../../interfaces/minimum_field_properties.dart'; 9 | 10 | /// This is a button widget for inclusion in the form. 11 | class CardSettingsButton extends StatelessWidget 12 | implements IMinimumFieldSettings { 13 | CardSettingsButton({ 14 | this.label = 'Label', 15 | required this.onPressed, 16 | this.visible = true, 17 | this.backgroundColor, 18 | this.textColor, 19 | this.enabled = true, 20 | this.bottomSpacing = 0.0, 21 | this.isDestructive = false, 22 | this.showMaterialonIOS, 23 | }); 24 | 25 | /// The text to place in the button 26 | final String label; 27 | 28 | /// tells the Ui the button is destructive. Helps select color. 29 | final bool isDestructive; 30 | 31 | /// The background color for normal buttons 32 | final Color? backgroundColor; 33 | 34 | /// The text color for normal buttons 35 | final Color? textColor; 36 | 37 | /// allows adding extra padding at the bottom 38 | final double bottomSpacing; 39 | 40 | /// If false, grays out the field and makes it unresponsive 41 | final bool enabled; 42 | 43 | /// Force the widget to use Material style on an iOS device 44 | @override 45 | final bool? showMaterialonIOS; 46 | 47 | /// If false hides the widget on the card setting panel 48 | @override 49 | final bool visible; 50 | 51 | /// Fires when the button is pressed 52 | final VoidCallback onPressed; 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | TextStyle buttonStyle = 57 | Theme.of(context).textTheme.labelLarge!.copyWith(color: textColor); 58 | 59 | if (visible) { 60 | if (showCupertino(context, showMaterialonIOS)) 61 | return _showCuppertinoButton(); 62 | else 63 | return _showMaterialButton(context, buttonStyle); 64 | } else { 65 | return Container(); 66 | } 67 | } 68 | 69 | Widget _showMaterialButton(BuildContext context, TextStyle buttonStyle) { 70 | var style = Theme.of(context).textButtonTheme.style ?? ButtonStyle(); 71 | if (backgroundColor != null) 72 | style = style.copyWith( 73 | backgroundColor: MaterialStateProperty.all(backgroundColor!)); 74 | if (textColor != null) 75 | style = style.copyWith( 76 | foregroundColor: MaterialStateProperty.all(textColor!)); 77 | if (!enabled) 78 | style = style.copyWith( 79 | backgroundColor: MaterialStateProperty.all(Colors.grey)); 80 | 81 | return Container( 82 | margin: EdgeInsets.only( 83 | top: 0.0, bottom: bottomSpacing, left: 6.0, right: 6.0), 84 | padding: EdgeInsets.all(0.0), 85 | child: TextButton( 86 | style: style, 87 | child: Row( 88 | mainAxisAlignment: MainAxisAlignment.center, 89 | children: [ 90 | Text( 91 | label, 92 | ), 93 | ], 94 | ), 95 | onPressed: (enabled) 96 | ? onPressed 97 | : null, // to disable, we need to not provide an onPressed function 98 | ), 99 | ); 100 | } 101 | 102 | Widget _showCuppertinoButton() { 103 | return Container( 104 | child: visible == false 105 | ? null 106 | : CSButton( 107 | isDestructive 108 | ? CSButtonType.DESTRUCTIVE 109 | : CSButtonType.DEFAULT_CENTER, 110 | label, 111 | onPressed, 112 | ), 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /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 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /lib/helpers/converter_functions.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'dart:math'; 5 | import 'package:flutter/material.dart'; 6 | 7 | /// This attempts to intelligently cast any value to the desired type. 8 | T? intelligentCast(dynamic value) { 9 | // instead of empty string we want to return null 10 | if (value.toString().isEmpty) return null; 11 | 12 | // already expected type, return it 13 | if (value is T) return value; 14 | 15 | // process bool here, since we need to return false rather than null 16 | if (T.toString() == 'bool') return boolParse(value.toString()) as T; 17 | 18 | // if null, dont change it. 19 | if (value == null) return null; 20 | 21 | // perform explicit parsing on the value as a string 22 | if (T.toString() == 'double') return double.parse(value.toString()) as T; 23 | if (T.toString() == 'double?') return double.parse(value.toString()) as T; 24 | if (T.toString() == 'int') return int.parse(value.toString()) as T; 25 | if (T.toString() == 'int?') return int.parse(value.toString()) as T; 26 | if (T.toString() == 'Color') return colorParse(value) as T; 27 | 28 | throw Exception('Failed to convert $value to $T'); 29 | } 30 | 31 | /// This will parse various conceptual representaitons of yes/no into a boolean 32 | bool boolParse(String? value) { 33 | if (value == null) return false; 34 | 35 | if (value.toLowerCase() == 'true') return true; 36 | if (value.toLowerCase() == 'false') return false; 37 | 38 | if (value.toLowerCase() == '1') return true; 39 | if (value.toLowerCase() == '0') return false; 40 | 41 | if (value.toLowerCase() == 'yes') return true; 42 | if (value.toLowerCase() == 'no') return false; 43 | 44 | return false; 45 | } 46 | 47 | /// This will parse either a string or integer representation of a color into an actual Color 48 | Color colorParse(dynamic value) { 49 | // input is string (e.g. 'FF112233') convert to integer 50 | if (value is String) { 51 | if (value.toString().length == 6) value = 'FF' + value.toString(); 52 | value = int.parse(value.toString(), radix: 16); 53 | } 54 | 55 | // input is integer (e.g. 0xFF112233) convert to color 56 | if (value is int) { 57 | return Color(value).withOpacity(1.0); 58 | } 59 | 60 | throw Exception('Failed to convert $value to Color'); 61 | } 62 | 63 | /// This will convert a Color to a hex string (more abreviated than the .toString() method. 64 | String colorToString(Color color) { 65 | return color.toString().split('(0x')[1].split(')')[0]; 66 | } 67 | 68 | /// Given a DateTime this will replace just the date portion leaving the time unchanged 69 | DateTime updateJustDate(DateTime newDate, DateTime originalDateTime) { 70 | return DateTime( 71 | newDate.year, // year 72 | newDate.month, // month 73 | newDate.day, // day 74 | originalDateTime.hour, // hour 75 | originalDateTime.minute, // minute 76 | originalDateTime.second, // second 77 | originalDateTime.millisecond, // millisecond 78 | originalDateTime.microsecond, // microsecond 79 | ); 80 | } 81 | 82 | /// Given a DateTime this will replace just the time portion leaving the date unchanged 83 | DateTime updateJustTime(TimeOfDay newTime, DateTime originalDateTime) { 84 | return DateTime( 85 | originalDateTime.year, // year 86 | originalDateTime.month, // month 87 | originalDateTime.day, // day 88 | newTime.hour, // hour 89 | newTime.minute, // minute 90 | 0, // second 91 | 0, // millisecond 92 | 0, // microsecond 93 | ); 94 | } 95 | 96 | /// used to reverse the value from an mask_formatter controller 97 | String unmaskValue(String mask, String maskedValue) { 98 | String specialCharacters = '0A@*'; 99 | String unmaskedValue = ''; 100 | 101 | for (int i = 0; i < min(mask.length, maskedValue.length); i++) { 102 | if (specialCharacters.contains(mask[i])) unmaskedValue += maskedValue[i]; 103 | } 104 | 105 | return unmaskedValue; 106 | } 107 | -------------------------------------------------------------------------------- /test/card_settings_text_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/card_settings.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | group('CardSettingsText', () { 7 | Widget widgetTree = Container(); 8 | var key = GlobalKey(); 9 | var label = "MeInput"; 10 | var initialValue = "Hello World"; 11 | var icon = Icons.home; 12 | var requiredIndicator = "#"; 13 | var hintText = "Show me the world!"; 14 | var focusNode = FocusNode(); 15 | var inputActionNode = FocusNode(); 16 | var inputAction = TextInputAction.next; 17 | 18 | setUpAll(() async { 19 | widgetTree = MaterialApp( 20 | home: CardSettings( 21 | children: [ 22 | CardSettingsSection( 23 | children: [ 24 | CardSettingsText( 25 | key: key, 26 | label: label, 27 | initialValue: initialValue, 28 | icon: Icon(icon), 29 | requiredIndicator: Text(requiredIndicator), 30 | hintText: hintText, 31 | focusNode: focusNode, 32 | inputAction: inputAction, 33 | inputActionNode: inputActionNode, 34 | ), 35 | CardSettingsText(focusNode: inputActionNode) 36 | ], 37 | ), 38 | ], 39 | ), 40 | ); 41 | }); 42 | 43 | testWidgets('displays properties', (WidgetTester tester) async { 44 | // arrange 45 | await tester.pumpWidget(widgetTree); 46 | 47 | // assert 48 | final labelFinder = find.text(label); 49 | expect(labelFinder, findsOneWidget); 50 | final valueFinder = find.text(initialValue); 51 | expect(valueFinder, findsOneWidget); 52 | final iconFinder = find.byIcon(icon); 53 | expect(iconFinder, findsOneWidget); 54 | final requiredIndicatorFinder = find.text(requiredIndicator); 55 | expect(requiredIndicatorFinder, findsOneWidget); 56 | }); 57 | 58 | testWidgets('changes text', (WidgetTester tester) async { 59 | // arrange 60 | var newText = "Brave new world"; 61 | await tester.pumpWidget(widgetTree); 62 | 63 | // act 64 | await tester.enterText(find.byKey(key), newText); 65 | 66 | // assert 67 | final valueFinder = find.text(newText); 68 | expect(valueFinder, findsOneWidget); 69 | }); 70 | 71 | testWidgets('shows hintText', (WidgetTester tester) async { 72 | // arrange 73 | var newText = ""; 74 | await tester.pumpWidget(widgetTree); 75 | 76 | // act 77 | await tester.enterText(find.byKey(key), newText); 78 | 79 | // assert 80 | final hintFinder = find.text(hintText); 81 | expect(hintFinder, findsOneWidget); 82 | }); 83 | 84 | testWidgets('focusNode is focused', (WidgetTester tester) async { 85 | // arrange 86 | await tester.pumpWidget(widgetTree); 87 | 88 | // act 89 | await tester.showKeyboard(find.byKey(key)); 90 | 91 | // assert 92 | expect(focusNode.hasFocus, isTrue); 93 | }); 94 | 95 | testWidgets('input action unfocuses focusNode', 96 | (WidgetTester tester) async { 97 | // arrange 98 | await tester.pumpWidget(widgetTree); 99 | 100 | // act 101 | await tester.showKeyboard(find.byKey(key)); 102 | await tester.testTextInput.receiveAction(inputAction); 103 | await tester.pump(); 104 | 105 | // assert 106 | expect(focusNode.hasFocus, isFalse); 107 | }); 108 | 109 | testWidgets('input action focuses inputActionNode', 110 | (WidgetTester tester) async { 111 | // arrange 112 | await tester.pumpWidget(widgetTree); 113 | 114 | // act 115 | await tester.showKeyboard(find.byKey(key)); 116 | await tester.testTextInput.receiveAction(inputAction); 117 | await tester.pump(); 118 | 119 | // assert 120 | expect(inputActionNode.hasFocus, isTrue); 121 | }); 122 | }); 123 | } 124 | -------------------------------------------------------------------------------- /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 GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /test/platform_functions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/helpers/platform_functions.dart'; 2 | import 'package:card_settings/widgets/card_settings_panel.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | import 'package:mockito/mockito.dart'; 6 | 7 | void main() { 8 | group('showCupertino', () { 9 | testWidgets('returns false on non-iOS', (WidgetTester tester) async { 10 | var showMaterialonIOS = true; 11 | bool isIOS = true; 12 | var result = showCupertino(null, showMaterialonIOS, mockIOS: isIOS); 13 | 14 | expect(result, false); 15 | }); 16 | 17 | test('on iOS, returns false if showMaterialonIOS true', () { 18 | var showMaterialonIOS = true; 19 | bool isIOS = true; 20 | var result = showCupertino(null, showMaterialonIOS, mockIOS: isIOS); 21 | 22 | expect(result, false); 23 | }); 24 | 25 | test( 26 | 'on iOS, returns true if showMaterialonIOS null and context not provided', 27 | () { 28 | bool? showMaterialonIOS; // null 29 | bool isIOS = true; 30 | var result = showCupertino(null, showMaterialonIOS, mockIOS: isIOS); 31 | 32 | expect(result, true); 33 | }); 34 | 35 | test( 36 | 'on iOS, returns showMaterialonIOS of CardSettings if showMaterialonIOS not provided', 37 | () { 38 | // set up mocks 39 | var context = MockContext(); 40 | when(context.dependOnInheritedWidgetOfExactType()) 41 | .thenReturn( 42 | CardSettings( 43 | children: [ 44 | CardSettingsSection(), 45 | ], 46 | ), 47 | ); 48 | 49 | bool? showMaterialonIOS; // null 50 | bool isIOS = true; 51 | var result = showCupertino(context, showMaterialonIOS, mockIOS: isIOS); 52 | 53 | expect(result, true); 54 | }); 55 | }); 56 | 57 | group('labelStyle', () { 58 | test('enabled uses textTheme.subtitle1 color', () { 59 | // Arrange 60 | bool enabled = true; 61 | var context = MockContext(); 62 | 63 | // Act 64 | var result = labelStyle(context, enabled); 65 | 66 | // Assert 67 | var expectedColor = Theme.of(context).textTheme.titleMedium?.color; 68 | expect(result?.color, expectedColor); 69 | }); 70 | 71 | test('disabled uses disabledColor', () { 72 | // Arrange 73 | bool enabled = false; 74 | var context = MockContext(); 75 | 76 | // Act 77 | var result = labelStyle(context, enabled); 78 | 79 | // Assert 80 | var expectedColor = Theme.of(context).disabledColor; 81 | expect(result?.color, expectedColor); 82 | }); 83 | }); 84 | 85 | group('contentStyle', () { 86 | test('enabled uses textTheme.subtitle1 color if value is present', () { 87 | // Arrange 88 | bool enabled = true; 89 | String value = "Some text"; 90 | var context = MockContext(); 91 | 92 | // Act 93 | var result = contentStyle(context, value, enabled); 94 | 95 | // Assert 96 | var expectedColor = Theme.of(context).textTheme.titleMedium?.color; 97 | expect(result?.color, expectedColor); 98 | }); 99 | 100 | test('enabled uses textTheme.hintColor if value not present', () { 101 | // Arrange 102 | bool enabled = true; 103 | String? value; // null 104 | var context = MockContext(); 105 | 106 | // Act 107 | var result = contentStyle(context, value, enabled); 108 | 109 | // Assert 110 | var expectedColor = Theme.of(context).hintColor; 111 | expect(result?.color, expectedColor); 112 | }); 113 | 114 | test('disabled uses disabledColor', () { 115 | // Arrange 116 | bool enabled = false; 117 | String value = "Some text"; 118 | var context = MockContext(); 119 | 120 | // Act 121 | var result = contentStyle(context, value, enabled); 122 | 123 | // Assert 124 | var expectedColor = Theme.of(context).disabledColor; 125 | expect(result?.color, expectedColor); 126 | }); 127 | }); 128 | } 129 | 130 | class MockContext extends Mock implements BuildContext {} 131 | -------------------------------------------------------------------------------- /example/lib/plumbing/results.dart: -------------------------------------------------------------------------------- 1 | import 'package:card_settings/card_settings.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:intl/intl.dart'; 4 | 5 | import 'model.dart'; 6 | 7 | void showResults(BuildContext context, PonyModel model) { 8 | showDialog( 9 | context: context, 10 | builder: (BuildContext context) { 11 | return AlertDialog( 12 | title: const Text('Updated Results'), 13 | content: SingleChildScrollView( 14 | child: Column( 15 | crossAxisAlignment: CrossAxisAlignment.start, 16 | children: [ 17 | _buildResultsRow('Name', model.name), 18 | _buildResultsRow('Type', model.type), 19 | _buildResultsRow('Gender', model.gender), 20 | _buildResultsRow('Age', model.age), 21 | _buildResultsRow('Description', model.description, 22 | linebreak: true), 23 | _buildResultsRow('Hobbies', model.hobbies, linebreak: true), 24 | _buildResultsRow('CoatColor', model.coatColor), 25 | _buildResultsRow('ManeColor', model.maneColor), 26 | _buildResultsRow('Style', model.style), 27 | _buildResultsRow('HasSpots', model.hasSpots), 28 | _buildResultsRow('SpotColor', model.spotColor), 29 | _buildResultsRow('Height', model.height), 30 | _buildResultsRow('Weight', model.weight), 31 | _buildResultsRow( 32 | 'ShowDate', DateFormat.yMd().format(model.showDateTime)), 33 | _buildResultsRow( 34 | 'ShowTime', DateFormat.jm().format(model.showDateTime)), 35 | _buildResultsRow('Phone', model.boxOfficePhone), 36 | _buildResultsRow('Price', model.ticketPrice), 37 | _buildResultsRow('Audio', 38 | CardSettingsFilePicker.formatBytes(model.audio.length, 3)), 39 | _buildResultsRow( 40 | 'Photo', 41 | CardSettingsFilePicker.formatBytes( 42 | model.photo?.length ?? 0, 2)), 43 | _buildResultsRow('Video', 44 | CardSettingsFilePicker.formatBytes(model.video.length, 1)), 45 | _buildResultsRow( 46 | 'Custom file', 47 | CardSettingsFilePicker.formatBytes( 48 | model.customFile.length, 0)), 49 | ], 50 | ), 51 | ), 52 | actions: [ 53 | TextButton( 54 | child: const Text("Close"), 55 | onPressed: () { 56 | Navigator.of(context).pop(); 57 | }, 58 | ), 59 | ], 60 | ); 61 | }, 62 | ); 63 | } 64 | 65 | void showErrors(BuildContext context) { 66 | showDialog( 67 | context: context, 68 | builder: (BuildContext context) { 69 | return AlertDialog( 70 | title: const Text('Form has validation errors'), 71 | content: 72 | const Text('Please fix all errors before submitting the form.'), 73 | actions: [ 74 | TextButton( 75 | child: const Text("Close"), 76 | onPressed: () { 77 | Navigator.of(context).pop(); 78 | }, 79 | ), 80 | ], 81 | ); 82 | }, 83 | ); 84 | } 85 | 86 | Widget _buildResultsRow(String name, dynamic value, {bool linebreak = false}) { 87 | return Column( 88 | children: [ 89 | Row( 90 | children: [ 91 | Expanded( 92 | child: Text( 93 | '$name:', 94 | style: const TextStyle(fontWeight: FontWeight.bold), 95 | ), 96 | ), 97 | _buildValueInline(value, linebreak), 98 | ], 99 | ), 100 | _buildValueOnOwnRow(value, linebreak), 101 | Container(height: 12.0), 102 | ], 103 | ); 104 | } 105 | 106 | Widget _buildValueInline(dynamic value, bool linebreak) { 107 | return (linebreak) ? Container() : Text(value.toString()); 108 | } 109 | 110 | Widget _buildValueOnOwnRow(dynamic value, bool linebreak) { 111 | return (linebreak) ? Text(value.toString()) : Container(); 112 | } 113 | -------------------------------------------------------------------------------- /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(SET CMP0063 NEW) 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 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /lib/widgets/picker_fields/card_settings_number_picker.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:flutter/material.dart'; 5 | 6 | import '../../card_settings.dart'; 7 | import '../../interfaces/common_field_properties.dart'; 8 | 9 | /// This is a list picker that allows for a range of numbers to be speficied as pptions. 10 | class CardSettingsNumberPicker extends StatelessWidget 11 | implements ICommonFieldProperties { 12 | CardSettingsNumberPicker({ 13 | Key? key, 14 | this.label = 'Label', 15 | this.labelAlign, 16 | this.labelWidth, 17 | this.initialValue, 18 | this.contentAlign, 19 | this.hintText, 20 | this.icon, 21 | this.requiredIndicator, 22 | required this.min, 23 | required this.max, 24 | this.stepInterval = 1, 25 | this.autovalidateMode = AutovalidateMode.onUserInteraction, 26 | this.enabled = true, 27 | this.validator, 28 | this.onSaved, 29 | this.onChanged, 30 | this.visible = true, 31 | this.showMaterialonIOS, 32 | this.fieldPadding, 33 | }) : assert(min < max); 34 | 35 | /// The text to identify the field to the user 36 | @override 37 | final String label; 38 | 39 | /// The alignment of the label paret of the field. Default is left. 40 | @override 41 | final TextAlign? labelAlign; 42 | 43 | /// controls how the widget in the content area of the field is aligned 44 | @override 45 | final TextAlign? contentAlign; 46 | 47 | /// text to display to guide the user on what to enter 48 | final String? hintText; 49 | 50 | /// The icon to display to the left of the field content 51 | @override 52 | final Icon? icon; 53 | 54 | /// A widget to show next to the label if the field is required 55 | @override 56 | final Widget? requiredIndicator; 57 | 58 | /// the initial value fo the picker to be placed on 59 | final int? initialValue; 60 | 61 | /// the lowest value that will be shown 62 | final int min; 63 | 64 | /// the highest value that will be shown 65 | final int max; 66 | 67 | /// the interval for the values. Default is 1 68 | final int stepInterval; 69 | 70 | /// places the field into auto validation mode 71 | @override 72 | final AutovalidateMode autovalidateMode; 73 | 74 | /// If false hides the widget on the card setting panel 75 | @override 76 | final bool visible; 77 | 78 | /// Force the widget to use Material style on an iOS device 79 | @override 80 | final bool? showMaterialonIOS; 81 | 82 | /// If false, grays out the field and makes it unresponsive 83 | final bool enabled; 84 | 85 | /// The width of the field label. If provided overrides the global setting. 86 | @override 87 | final double? labelWidth; 88 | 89 | /// provides padding to wrap the entire field 90 | @override 91 | final EdgeInsetsGeometry? fieldPadding; 92 | 93 | /// fires when validation is requested 94 | @override 95 | final FormFieldValidator? validator; 96 | 97 | /// vires when the enclosing for is saved 98 | @override 99 | final FormFieldSetter? onSaved; 100 | 101 | /// firest when the content is changed 102 | @override 103 | final ValueChanged? onChanged; 104 | 105 | @override 106 | Widget build(BuildContext context) { 107 | return CardSettingsListPicker( 108 | key: key, 109 | label: this.label, 110 | showMaterialonIOS: showMaterialonIOS, 111 | fieldPadding: fieldPadding, 112 | labelAlign: labelAlign, 113 | labelWidth: labelWidth, 114 | contentAlign: contentAlign, 115 | hintText: hintText, 116 | visible: visible, 117 | enabled: enabled, 118 | initialItem: initialValue, 119 | icon: icon, 120 | requiredIndicator: requiredIndicator, 121 | items: List.generate( 122 | (max - min) ~/ stepInterval + 1, 123 | (i) => (i * stepInterval + min), 124 | ), 125 | autovalidateMode: autovalidateMode, 126 | validator: _safeValidator, 127 | onSaved: _safeOnSaved, 128 | onChanged: _safeOnChanged, 129 | ); 130 | } 131 | 132 | String? _safeValidator(int? value) { 133 | if (validator == null) return null; 134 | return validator!(intelligentCast(value)); 135 | } 136 | 137 | void _safeOnSaved(int? value) { 138 | if (onSaved == null) return; 139 | onSaved!(intelligentCast(value)); 140 | } 141 | 142 | void _safeOnChanged(int? value) { 143 | if (onChanged == null) return; 144 | onChanged!(intelligentCast(value)); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /example/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 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /lib/widgets/text_fields/card_settings_phone.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, codegrue. All rights reserved. Use of this source code 2 | // is governed by the MIT license that can be found in the LICENSE file. 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter_multi_formatter/flutter_multi_formatter.dart'; 7 | 8 | import '../../card_settings.dart'; 9 | import '../../interfaces/common_field_properties.dart'; 10 | import '../../interfaces/text_field_properties.dart'; 11 | 12 | /// This is a phone number field. It's designed for US numbers 13 | class CardSettingsPhone extends StatelessWidget 14 | implements ICommonFieldProperties, ITextFieldProperties { 15 | CardSettingsPhone({ 16 | Key? key, 17 | this.label = 'Phone', 18 | this.labelWidth, 19 | this.labelAlign, 20 | this.hintText, 21 | this.prefixText, 22 | this.contentAlign, 23 | this.initialValue, 24 | this.contentOnNewLine = false, 25 | this.maxLength = 20, 26 | this.icon, 27 | this.requiredIndicator, 28 | this.visible = true, 29 | this.enabled = true, 30 | this.autofocus = false, 31 | this.obscureText = false, 32 | this.autocorrect = false, 33 | this.autovalidateMode = AutovalidateMode.onUserInteraction, 34 | this.validator, 35 | this.onSaved, 36 | this.onChanged, 37 | this.controller, 38 | this.focusNode, 39 | this.inputAction, 40 | this.inputActionNode, 41 | this.keyboardType, 42 | this.style, 43 | this.maxLengthEnforcement = MaxLengthEnforcement.enforced, 44 | this.onFieldSubmitted, 45 | this.inputFormatters, 46 | this.showMaterialonIOS, 47 | this.fieldPadding, 48 | }); 49 | 50 | // The text to identify the field to the user 51 | @override 52 | final String label; 53 | 54 | // The width of the field label. If provided overrides the global setting. 55 | @override 56 | final double? labelWidth; 57 | 58 | // The alignment of the label paret of the field. Default is left. 59 | @override 60 | final TextAlign? labelAlign; 61 | 62 | // controls how the widget in the content area of the field is aligned 63 | @override 64 | final TextAlign? contentAlign; 65 | 66 | @override 67 | // text to display to guide the user on what to enter 68 | final String? hintText; 69 | 70 | final String? prefixText; 71 | 72 | final int? initialValue; 73 | 74 | final bool contentOnNewLine; 75 | 76 | final int maxLength; 77 | 78 | // The icon to display to the left of the field content 79 | @override 80 | final Icon? icon; 81 | 82 | // A widget to show next to the label if the field is required 83 | @override 84 | final Widget? requiredIndicator; 85 | 86 | // If false hides the widget on the card setting panel 87 | @override 88 | final bool visible; 89 | 90 | // If false, grays out the field and makes it unresponsive 91 | final bool enabled; 92 | 93 | final bool autofocus; 94 | 95 | final bool obscureText; 96 | 97 | final bool autocorrect; 98 | 99 | @override 100 | final AutovalidateMode autovalidateMode; 101 | 102 | @override 103 | final FormFieldValidator? validator; 104 | 105 | @override 106 | final FormFieldSetter? onSaved; 107 | 108 | @override 109 | final ValueChanged? onChanged; 110 | 111 | final TextEditingController? controller; 112 | 113 | final FocusNode? focusNode; 114 | 115 | final FocusNode? inputActionNode; 116 | 117 | final TextInputType? keyboardType; 118 | 119 | final TextStyle? style; 120 | 121 | final TextInputAction? inputAction; 122 | 123 | final MaxLengthEnforcement? maxLengthEnforcement; 124 | 125 | final ValueChanged? onFieldSubmitted; 126 | 127 | final List? inputFormatters; 128 | 129 | // provides padding to wrap the entire field 130 | @override 131 | final EdgeInsetsGeometry? fieldPadding; 132 | 133 | // Force the widget to use Material style on an iOS device 134 | @override 135 | final bool? showMaterialonIOS; 136 | 137 | @override 138 | Widget build(BuildContext context) { 139 | return CardSettingsText( 140 | key: key, 141 | label: label, 142 | labelWidth: labelWidth, 143 | labelAlign: labelAlign, 144 | contentAlign: contentAlign, 145 | initialValue: initialValue != null 146 | ? formatAsPhoneNumber(initialValue.toString()) 147 | : "", 148 | contentOnNewLine: contentOnNewLine, 149 | maxLength: maxLength, 150 | hintText: hintText, 151 | prefixText: prefixText, 152 | icon: icon, 153 | requiredIndicator: requiredIndicator, 154 | visible: visible, 155 | enabled: enabled, 156 | autofocus: autofocus, 157 | showMaterialonIOS: showMaterialonIOS, 158 | obscureText: obscureText, 159 | autocorrect: autocorrect, 160 | autovalidateMode: autovalidateMode, 161 | validator: _safeValidator, 162 | onSaved: _safeOnSaved, 163 | onChanged: _safeOnChanged, 164 | controller: controller, 165 | focusNode: focusNode, 166 | fieldPadding: fieldPadding, 167 | inputActionNode: inputActionNode, 168 | keyboardType: 169 | keyboardType ?? TextInputType.numberWithOptions(decimal: false), 170 | style: style, 171 | maxLengthEnforcement: maxLengthEnforcement, 172 | onFieldSubmitted: onFieldSubmitted, 173 | inputFormatters: [ 174 | PhoneInputFormatter(), 175 | ], 176 | inputAction: inputAction, 177 | ); 178 | } 179 | 180 | String? _safeValidator(String? value) { 181 | if (validator == null) return null; 182 | var numbers = toNumericString(value); 183 | return validator!(intelligentCast(numbers)); 184 | } 185 | 186 | void _safeOnSaved(String? value) { 187 | if (onSaved == null) return; 188 | var numbers = toNumericString(value); 189 | onSaved!(intelligentCast(numbers)); 190 | } 191 | 192 | void _safeOnChanged(String? value) { 193 | if (onChanged == null) return; 194 | var numbers = toNumericString(value); 195 | onChanged!(intelligentCast(numbers)); 196 | } 197 | } 198 | --------------------------------------------------------------------------------