diff --git a/example/.gitignore b/example/.gitignore index 07488ba..0fa6b67 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -15,56 +15,32 @@ *.iws .idea/ -# Visual Studio Code related -.vscode/ +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins +.flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java +# Web related +lib/generated_plugin_registrant.dart -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* +# Symbolication related +app.*.symbols -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/.metadata b/example/.metadata index 07763f7..526e166 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713 + revision: 60bd88df915880d23877bfc1602e8ddcf4c4dd2a channel: stable project_type: app diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..aabdfc7 --- /dev/null +++ b/example/README.md @@ -0,0 +1,16 @@ +# example + +An example app for the grouped_buttons package. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/example/android/.gitignore b/example/android/.gitignore new file mode 100644 index 0000000..0a741cb --- /dev/null +++ b/example/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 4ed2e25..6ca2344 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -22,23 +22,23 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 30 - lintOptions { - disable 'InvalidPackage' + sourceSets { + main.java.srcDirs += 'src/main/kotlin' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { @@ -55,7 +55,5 @@ flutter { } dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 2877140..34dd77e 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,33 +1,41 @@ - - - - + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + + + + diff --git a/example/android/app/src/main/java/com/example/example/MainActivity.java b/example/android/app/src/main/java/com/example/example/MainActivity.java deleted file mode 100644 index 84f8920..0000000 --- a/example/android/app/src/main/java/com/example/example/MainActivity.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.example; - -import android.os.Bundle; -import io.flutter.app.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } -} diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 0000000..e793a00 --- /dev/null +++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..449a9f9 --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml index 00fa441..d74aa35 100644 --- a/example/android/app/src/main/res/values/styles.xml +++ b/example/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/example/android/build.gradle b/example/android/build.gradle index bb8a303..c505a86 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,11 +1,13 @@ buildscript { + ext.kotlin_version = '1.3.50' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:4.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..94adc3a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 2819f02..bc6a58a 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 5a2f14f..44e62bc 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/ios/.gitignore b/example/ios/.gitignore new file mode 100644 index 0000000..e96ef60 --- /dev/null +++ b/example/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index a427f10..c6759a6 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -9,13 +9,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; - 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -28,8 +22,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -40,15 +32,12 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -60,8 +49,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -71,9 +58,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -87,7 +72,6 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, ); sourceTree = ""; }; @@ -102,27 +86,18 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 97C146F21CF9000F007C117D /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -152,17 +127,18 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0910; - ORGANIZATIONNAME = "The Chromium Authors"; + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -185,7 +161,6 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -206,7 +181,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -229,8 +204,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, - 97C146F31CF9000F007C117D /* main.m in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -259,7 +233,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -271,12 +244,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -297,9 +272,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -310,28 +286,21 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = S8QB4VV633; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -343,12 +312,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -375,7 +346,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -385,7 +356,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -397,12 +367,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -423,9 +395,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -436,20 +410,16 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -459,20 +429,15 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 786d6aa..a28140c 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings index 949b678..f9b0d7c 100644 --- a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -2,7 +2,7 @@ - BuildSystemType - Original + PreviewsEnabled + diff --git a/example/ios/Runner/AppDelegate.h b/example/ios/Runner/AppDelegate.h deleted file mode 100644 index 36e21bb..0000000 --- a/example/ios/Runner/AppDelegate.h +++ /dev/null @@ -1,6 +0,0 @@ -#import -#import - -@interface AppDelegate : FlutterAppDelegate - -@end diff --git a/example/ios/Runner/AppDelegate.m b/example/ios/Runner/AppDelegate.m deleted file mode 100644 index 59a72e9..0000000 --- a/example/ios/Runner/AppDelegate.m +++ /dev/null @@ -1,13 +0,0 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. - return [super application:application didFinishLaunchingWithOptions:launchOptions]; -} - -@end diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index 3d43d11..dc9ada4 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 0513117..a060db6 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/ios/Runner/main.m b/example/ios/Runner/main.m deleted file mode 100644 index dff6597..0000000 --- a/example/ios/Runner/main.m +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/example/lib/main.dart b/example/lib/main.dart index 9a1fb3f..b5edfd2 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -29,160 +29,135 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - - List _checked = ["A", "B"]; - String _picked = "Two"; + List _checked = ['A', 'B']; + String _picked = 'Two'; @override - Widget build(BuildContext context){ + Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Grouped Buttons Example"), + title: Text('Grouped Buttons Example'), ), body: _body(), ); // } - Widget _body(){ - return ListView( - children: [ - - //-------------------- - //SIMPLE USAGE EXAMPLE - //-------------------- - - //BASIC CHECKBOXGROUP - Container( - padding: const EdgeInsets.only(left: 14.0, top: 14.0), - child: Text("Basic CheckboxGroup", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0 - ), - ), - ), - - CheckboxGroup( - labels: [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - ], - disabled: [ - "Wednesday", - "Friday" - ], - onChange: (bool isChecked, String label, int index) => print("isChecked: $isChecked label: $label index: $index"), - onSelected: (List checked) => print("checked: ${checked.toString()}"), + Widget _body() { + return ListView(children: [ + //-------------------- + //SIMPLE USAGE EXAMPLE + //-------------------- + + //BASIC CHECKBOXGROUP + Container( + padding: const EdgeInsets.only(left: 14.0, top: 14.0), + child: Text( + 'Basic CheckboxGroup', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), ), + ), + CheckboxGroup( + labels: [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + ], + disabled: ['Wednesday', 'Friday'], + onChange: (bool isChecked, String label, int index) => + print('isChecked: $isChecked label: $label index: $index'), + onSelected: (List checked) => print('checked: ${checked.toString()}'), + ), - - //BASIC RADIOBUTTONGROUP - Container( - padding: const EdgeInsets.only(left: 14.0, top: 14.0), - child: Text("Basic RadioButtonGroup", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0 - ), - ), - ), - - RadioButtonGroup( - labels: [ - "Option 1", - "Option 2", - ], - disabled: [ - "Option 1" - ], - onChange: (String label, int index) => print("label: $label index: $index"), - onSelected: (String label) => print(label), + //BASIC RADIOBUTTONGROUP + Container( + padding: const EdgeInsets.only(left: 14.0, top: 14.0), + child: Text( + 'Basic RadioButtonGroup', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), ), + ), + RadioButtonGroup( + labels: [ + 'Option 1', + 'Option 2', + ], + disabled: ['Option 1'], + onChange: (String label, int index) => print('label: $label index: $index'), + onSelected: (String label) => print(label), + ), + //-------------------- + //CUSTOM USAGE EXAMPLE + //-------------------- - - //-------------------- - //CUSTOM USAGE EXAMPLE - //-------------------- - - ///CUSTOM CHECKBOX GROUP - Container( - padding: const EdgeInsets.only(left: 14.0, top: 14.0, bottom: 14.0), - child: Text("Custom CheckboxGroup", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0 - ), - ), - ), - - CheckboxGroup( - orientation: GroupedButtonsOrientation.HORIZONTAL, - margin: const EdgeInsets.only(left: 12.0), - onSelected: (List selected) => setState((){ - _checked = selected; - }), - labels: [ - "A", - "B", - ], - checked: _checked, - itemBuilder: (Checkbox cb, Text txt, int i){ - return Column( - children: [ - Icon(Icons.polymer), - cb, - txt, - ], - ); - }, + ///CUSTOM CHECKBOX GROUP + Container( + padding: const EdgeInsets.only(left: 14.0, top: 14.0, bottom: 14.0), + child: Text( + 'Custom CheckboxGroup', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), ), + ), + CheckboxGroup( + orientation: GroupedButtonsOrientation.HORIZONTAL, + margin: const EdgeInsets.only(left: 12.0), + onSelected: (List selected) => setState(() { + _checked = selected; + }), + labels: [ + 'A', + 'B', + ], + checked: _checked, + itemBuilder: (Checkbox cb, Text txt, int i) { + return Column( + children: [ + Icon(Icons.polymer), + cb, + txt, + ], + ); + }, + ), - - ///CUSTOM RADIOBUTTON GROUP - Container( - padding: const EdgeInsets.only(left: 14.0, top: 14.0, bottom: 14.0), - child: Text("Custom RadioButtonGroup", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0 - ), - ), - ), - - RadioButtonGroup( - orientation: GroupedButtonsOrientation.HORIZONTAL, - margin: const EdgeInsets.only(left: 12.0), - onSelected: (String selected) => setState((){ - _picked = selected; - }), - labels: [ - "One", - "Two", - ], - picked: _picked, - itemBuilder: (Radio rb, Text txt, int i){ - return Column( - children: [ - Icon(Icons.public), - rb, - txt, - ], - ); - }, + ///CUSTOM RADIOBUTTON GROUP + Container( + padding: const EdgeInsets.only(left: 14.0, top: 14.0, bottom: 14.0), + child: Text( + 'Custom RadioButtonGroup', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), ), + ), - ] - ); + RadioButtonGroup( + orientation: GroupedButtonsOrientation.HORIZONTAL, + margin: const EdgeInsets.only(left: 12.0), + onSelected: (String selected) => setState(() { + _picked = selected; + }), + labels: [ + 'One', + 'Two', + ], + picked: _picked, + itemBuilder: (Radio rb, Text txt, int i) { + return Column( + children: [ + Icon(Icons.public), + rb, + txt, + ], + ); + }, + ), + ]); } - } diff --git a/example/pubspec.lock b/example/pubspec.lock index ebf4d79..a6497f4 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,51 +1,32 @@ # Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: - async: + characters: dependency: transitive description: - name: async + name: characters url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "1.0.2" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" grouped_buttons: dependency: "direct main" description: @@ -53,101 +34,31 @@ packages: relative: true source: path version: "1.0.4" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.3+1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" + version: "1.3.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.4" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.3" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.8" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.1.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 3eba7e0..e536411 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,24 +1,17 @@ name: example description: An example app for the grouped_buttons package. - +publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: sdk: flutter - - grouped_buttons: + cupertino_icons: ^1.0.2 + grouped_buttons: path: ../ - cupertino_icons: ^0.1.2 - -dev_dependencies: - flutter_test: - sdk: flutter - - flutter: uses-material-design: true diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart deleted file mode 100644 index 7bf3474..0000000 --- a/example/test/widget_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -/* -Name: Akshath Jain -Date: 3/15/19 -Purpose: Widget tests -*/ - -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - - -void main() { -} diff --git a/example/web/favicon.png b/example/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/example/web/favicon.png differ diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/example/web/icons/Icon-192.png differ diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/example/web/icons/Icon-512.png differ diff --git a/example/web/index.html b/example/web/index.html new file mode 100644 index 0000000..1460b5e --- /dev/null +++ b/example/web/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + example + + + + + + + + diff --git a/example/web/manifest.json b/example/web/manifest.json new file mode 100644 index 0000000..8c01291 --- /dev/null +++ b/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "example", + "short_name": "example", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/lib/grouped_buttons.dart b/lib/grouped_buttons.dart index b5c95e5..3292f67 100644 --- a/lib/grouped_buttons.dart +++ b/lib/grouped_buttons.dart @@ -10,4 +10,4 @@ library grouped_buttons; export 'src/checkbox_group.dart'; export 'src/radio_button_group.dart'; -export 'src/grouped_buttons_orientation.dart'; \ No newline at end of file +export 'src/grouped_buttons_orientation.dart'; diff --git a/lib/src/checkbox_group.dart b/lib/src/checkbox_group.dart index 948724e..c008400 100644 --- a/lib/src/checkbox_group.dart +++ b/lib/src/checkbox_group.dart @@ -7,6 +7,7 @@ Licensing: More information can be found here: https://github.com/akshathjain/gr */ import 'package:flutter/material.dart'; + import 'grouped_buttons_orientation.dart'; class CheckboxGroup extends StatefulWidget { @@ -17,18 +18,18 @@ class CheckboxGroup extends StatefulWidget { /// Every element must match a label. /// This is useful for clearing all selections (set it to []). /// If this is non-null, then the user must handle updating this list; otherwise, the state of the CheckboxGroup won't change. - final List checked; + final List? checked; /// Specifies which boxes should be disabled. /// If this is non-null, no boxes will be disabled. /// The strings passed to this must match the labels. - final List disabled; + final List? disabled; /// Called when the value of the CheckboxGroup changes. - final void Function(bool isChecked, String label, int index) onChange; + final void Function(bool isChecked, String label, int index)? onChange; /// Called when the user makes a selection. - final void Function(List selected) onSelected; + final void Function(List selected)? onSelected; /// The style to use for the labels. final TextStyle labelStyle; @@ -37,12 +38,14 @@ class CheckboxGroup extends StatefulWidget { final GroupedButtonsOrientation orientation; /// Called when needed to build a CheckboxGroup element. - final Widget Function(Checkbox checkBox, Text label, int index) itemBuilder; + final Widget Function(Checkbox checkBox, Text label, int index)? itemBuilder; //THESE FIELDS ARE FOR THE CHECKBOX /// The color to use when a Checkbox is checked. - final Color activeColor; + /// + /// When null, defaults to `Theme.of(context).toggleableActiveColor`. + final Color? activeColor; /// The color to use for the check icon when a Checkbox is checked. final Color checkColor; @@ -50,7 +53,6 @@ class CheckboxGroup extends StatefulWidget { /// If true the checkbox's value can be true, false, or null. final bool tristate; - //SPACING STUFF /// Empty space in which to inset the CheckboxGroup. @@ -60,124 +62,115 @@ class CheckboxGroup extends StatefulWidget { final EdgeInsetsGeometry margin; CheckboxGroup({ - Key key, - @required this.labels, + Key? key, + required this.labels, this.checked, this.disabled, this.onChange, this.onSelected, this.labelStyle = const TextStyle(), - this.activeColor, //defaults to toggleableActiveColor, - this.checkColor = const Color(0xFFFFFFFF), - this.tristate = false, this.orientation = GroupedButtonsOrientation.VERTICAL, this.itemBuilder, - this.padding = const EdgeInsets.all(0.0), - this.margin = const EdgeInsets.all(0.0), + this.activeColor, + this.checkColor = Colors.white, + this.tristate = false, + this.padding = EdgeInsets.zero, + this.margin = EdgeInsets.zero, }) : super(key: key); - @override _CheckboxGroupState createState() => _CheckboxGroupState(); } - - class _CheckboxGroupState extends State { List _selected = []; @override - void initState(){ + void initState() { super.initState(); //set the selected to the checked (if not null) _selected = widget.checked ?? []; - } @override Widget build(BuildContext context) { - //set the selected to the checked (if not null) - if(widget.checked != null){ + if (widget.checked != null) { _selected = []; - _selected.addAll(widget.checked); //use add all to prevent a shallow copy + _selected.addAll(widget.checked!); //use add all to prevent a shallow copy } - List content = []; - for(int i = 0; i < widget.labels.length; i++){ - + for (int i = 0; i < widget.labels.length; i++) { Checkbox cb = Checkbox( - value: _selected.contains(widget.labels.elementAt(i)), - onChanged: (widget.disabled != null && widget.disabled.contains(widget.labels.elementAt(i))) ? null : - (bool isChecked) => onChanged(isChecked, i), - checkColor: widget.checkColor, - activeColor: widget.activeColor ?? Theme.of(context).toggleableActiveColor, - tristate: widget.tristate, - ); - - Text t = Text( - widget.labels.elementAt(i), - style: (widget.disabled != null && widget.disabled.contains(widget.labels.elementAt(i))) ? - widget.labelStyle.apply(color: Theme.of(context).disabledColor) : - widget.labelStyle + value: _selected.contains(widget.labels.elementAt(i)), + onChanged: (widget.disabled != null && + widget.disabled!.contains(widget.labels.elementAt(i))) + ? null + : (bool? isChecked) => _onChanged(isChecked, i), + checkColor: widget.checkColor, + activeColor: + widget.activeColor ?? Theme.of(context).toggleableActiveColor, + tristate: widget.tristate, ); - + Text t = Text(widget.labels.elementAt(i), + style: (widget.disabled != null && + widget.disabled!.contains(widget.labels.elementAt(i))) + ? widget.labelStyle.apply(color: Theme.of(context).disabledColor) + : widget.labelStyle); //use user defined method to build - if(widget.itemBuilder != null) - content.add(widget.itemBuilder(cb, t, i)); - else{ //otherwise, use predefined method of building + if (widget.itemBuilder != null) + content.add(widget.itemBuilder!(cb, t, i)); + else { + //otherwise, use predefined method of building //vertical orientation means Column with Row inside - if(widget.orientation == GroupedButtonsOrientation.VERTICAL){ - + if (widget.orientation == GroupedButtonsOrientation.VERTICAL) { content.add(Row(children: [ SizedBox(width: 12.0), cb, SizedBox(width: 12.0), t, ])); - - }else{ //horizontal orientation means Row with Column inside + } else { + //horizontal orientation means Row with Column inside content.add(Column(children: [ cb, SizedBox(width: 12.0), t, ])); - } - } } return Container( padding: widget.padding, margin: widget.margin, - child: widget.orientation == GroupedButtonsOrientation.VERTICAL ? Column(children: content) : Row(children: content), + child: widget.orientation == GroupedButtonsOrientation.VERTICAL + ? Column(children: content) + : Row(children: content), ); } - - void onChanged(bool isChecked, int i){ + void _onChanged(bool? isChecked, int i) { bool isAlreadyContained = _selected.contains(widget.labels.elementAt(i)); - if(mounted){ + if (mounted && isChecked != null) { setState(() { - if(!isChecked && isAlreadyContained){ + if (!isChecked && isAlreadyContained) { _selected.remove(widget.labels.elementAt(i)); - }else if(isChecked && !isAlreadyContained){ + } else if (isChecked && !isAlreadyContained) { _selected.add(widget.labels.elementAt(i)); } - if(widget.onChange != null) widget.onChange(isChecked, widget.labels.elementAt(i), i); - if(widget.onSelected != null) widget.onSelected(_selected); + widget.onChange?.call(isChecked, widget.labels.elementAt(i), i); + widget.onSelected?.call(_selected); }); } } - -} \ No newline at end of file +} diff --git a/lib/src/grouped_buttons_orientation.dart b/lib/src/grouped_buttons_orientation.dart index 1cbbb96..a68c627 100644 --- a/lib/src/grouped_buttons_orientation.dart +++ b/lib/src/grouped_buttons_orientation.dart @@ -6,7 +6,7 @@ Copyright: © 2019, Akshath Jain. All rights reserved. Licensing: More information can be found here: https://github.com/akshathjain/grouped_buttons/blob/master/LICENSE */ -enum GroupedButtonsOrientation{ +enum GroupedButtonsOrientation { HORIZONTAL, VERTICAL, } diff --git a/lib/src/radio_button_group.dart b/lib/src/radio_button_group.dart index f6306db..e46476a 100644 --- a/lib/src/radio_button_group.dart +++ b/lib/src/radio_button_group.dart @@ -7,28 +7,29 @@ Licensing: More information can be found here: https://github.com/akshathjain/gr */ import 'package:flutter/material.dart'; + import 'grouped_buttons_orientation.dart'; class RadioButtonGroup extends StatefulWidget { /// A list of strings that describes each Radio button. Each label must be distinct. - final List labels; + final List labels; /// Specifies which Radio button to automatically pick. /// Every element must match a label. /// This is useful for clearing what is picked (set it to ""). /// If this is non-null, then the user must handle updating this; otherwise, the state of the RadioButtonGroup won't change. - final String picked; + final String? picked; /// Specifies which buttons should be disabled. /// If this is non-null, no buttons will be disabled. /// The strings passed to this must match the labels. - final List disabled; + final List? disabled; /// Called when the value of the RadioButtonGroup changes. - final void Function(String label, int index) onChange; + final void Function(String label, int index)? onChange; /// Called when the user makes a selection. - final void Function(String selected) onSelected; + final void Function(String selected)? onSelected; /// The style to use for the labels. final TextStyle labelStyle; @@ -37,13 +38,16 @@ class RadioButtonGroup extends StatefulWidget { final GroupedButtonsOrientation orientation; /// Called when needed to build a RadioButtonGroup element. - final Widget Function(Radio radioButton, Text label, int index) itemBuilder; + final Widget Function(Radio radioButton, Text label, int index)? itemBuilder; //RADIO BUTTON FIELDS + /// The color to use when a Radio button is checked. - final Color activeColor; + /// When null, defaults to `Theme.of(context).toggleableActiveColor` + final Color? activeColor; //SPACING STUFF + /// Empty space in which to inset the RadioButtonGroup. final EdgeInsetsGeometry padding; @@ -51,103 +55,99 @@ class RadioButtonGroup extends StatefulWidget { final EdgeInsetsGeometry margin; RadioButtonGroup({ - Key key, - @required this.labels, + Key? key, + required this.labels, this.picked, this.disabled, this.onChange, this.onSelected, this.labelStyle = const TextStyle(), - this.activeColor, //defaults to toggleableActiveColor, + this.activeColor, this.orientation = GroupedButtonsOrientation.VERTICAL, this.itemBuilder, - this.padding = const EdgeInsets.all(0.0), - this.margin = const EdgeInsets.all(0.0), - }) : super (key: key); + this.padding = EdgeInsets.zero, + this.margin = EdgeInsets.zero, + }) : super(key: key); @override _RadioButtonGroupState createState() => _RadioButtonGroupState(); } class _RadioButtonGroupState extends State { - String _selected; + late String _selected; @override - void initState(){ + void initState() { super.initState(); //set the selected to the picked (if not null) - _selected = widget.picked ?? ""; - + _selected = widget.picked ?? ''; } - @override Widget build(BuildContext context) { - - //set the selected to the picked (if not null) + //set the selected to the picked (if not null) _selected = widget.picked ?? _selected; - List content = []; - for(int i = 0; i < widget.labels.length; i++){ - + for (int i = 0; i < widget.labels.length; i++) { Radio rb = Radio( - activeColor: widget.activeColor ?? Theme.of(context).toggleableActiveColor, - groupValue: widget.labels.indexOf(_selected), - value: i, - - //just changed the selected filter to current selection - //since these are radio buttons, and you can only pick - //one at a time - onChanged: (widget.disabled != null && widget.disabled.contains(widget.labels.elementAt(i))) ? null : - (var index) => setState((){ - _selected = widget.labels.elementAt(i); - - if(widget.onChange != null) widget.onChange(widget.labels.elementAt(i), i); - if(widget.onSelected != null) widget.onSelected(widget.labels.elementAt(i)); - }), - ); - - Text t = Text( - widget.labels.elementAt(i), - style: (widget.disabled != null && widget.disabled.contains(widget.labels.elementAt(i))) ? - widget.labelStyle.apply(color: Theme.of(context).disabledColor) : - widget.labelStyle + activeColor: + widget.activeColor ?? Theme.of(context).toggleableActiveColor, + groupValue: widget.labels.indexOf(_selected), + value: i, + + //just changed the selected filter to current selection + //since these are radio buttons, and you can only pick + //one at a time + onChanged: (widget.disabled != null && + widget.disabled!.contains(widget.labels.elementAt(i))) + ? null + : (var index) => setState(() { + _selected = widget.labels.elementAt(i) ?? ''; + widget.onChange?.call(_selected, i); + widget.onSelected?.call(_selected); + }), ); + Text t = Text(widget.labels.elementAt(i)!, + style: (widget.disabled != null && + widget.disabled!.contains(widget.labels.elementAt(i))) + ? widget.labelStyle.apply(color: Theme.of(context).disabledColor) + : widget.labelStyle); + //use user defined method to build - if(widget.itemBuilder != null) - content.add(widget.itemBuilder(rb, t, i)); - else{ //otherwise, use predefined method of building + if (widget.itemBuilder != null) + content.add(widget.itemBuilder!(rb, t, i)); + else { + //otherwise, use predefined method of building //vertical orientation means Column with Row inside - if(widget.orientation == GroupedButtonsOrientation.VERTICAL){ - + if (widget.orientation == GroupedButtonsOrientation.VERTICAL) { content.add(Row(children: [ SizedBox(width: 12.0), rb, SizedBox(width: 12.0), t, ])); - - }else{ //horizontal orientation means Row with Column inside + } else { + //horizontal orientation means Row with Column inside content.add(Column(children: [ rb, SizedBox(width: 12.0), t, ])); - } } - } return Container( padding: widget.padding, margin: widget.margin, - child: widget.orientation == GroupedButtonsOrientation.VERTICAL ? Column(children: content) : Row(children: content), + child: widget.orientation == GroupedButtonsOrientation.VERTICAL + ? Column(children: content) + : Row(children: content), ); } -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index b219322..3a15731 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ author: Akshath Jain homepage: https://github.com/akshathjain/grouped_buttons environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: diff --git a/test/grouped_buttons_test.dart b/test/grouped_buttons_test.dart index a39a893..56c7d2f 100644 --- a/test/grouped_buttons_test.dart +++ b/test/grouped_buttons_test.dart @@ -4,6 +4,4 @@ Date: 3/15/19 Purpose: Defines some unit tests for grouped_buttons */ -void main() { - -} +void main() {}