├── example ├── 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 │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Podfile.lock │ ├── .gitignore │ └── Podfile ├── android │ ├── gradle.properties │ ├── .gitignore │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── theme_mode_handler_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── README.md ├── .metadata ├── lib │ ├── theme_mode_manager.dart │ └── main.dart ├── .gitignore ├── pubspec.yaml └── pubspec.lock ├── .gitignore ├── .metadata ├── lib ├── theme_mode_manager_interface.dart ├── theme_picker_dialog.dart └── theme_mode_handler.dart ├── .github ├── workflows │ └── test.yml └── FUNDING.yml ├── CHANGELOG.md ├── .all-contributorsrc ├── theme_mode_handler.iml ├── LICENSE ├── pubspec.yaml ├── analysis_options.yaml ├── README.md ├── test └── theme_mode_handler_test.dart └── pubspec.lock /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | .fvm 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | coverage -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arthurdenner/theme_mode_handler/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arthurdenner/theme_mode_handler/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/arthurdenner/theme_mode_handler/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | Demonstrates how to use the theme_mode_handler plugin. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our 8 | [online documentation](https://flutter.dev/docs), which offers tutorials, 9 | samples, guidance on mobile development, and a full API reference. 10 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /lib/theme_mode_manager_interface.dart: -------------------------------------------------------------------------------- 1 | /// Interface to be implemented in order 2 | /// to load and save the selected `ThemeMode`. 3 | abstract class IThemeModeManager { 4 | /// Loads the selected `ThemeMode` as a `String`. 5 | Future loadThemeMode(); 6 | 7 | /// Allows the consumer to save the selected `ThemeMode` as a `String`. 8 | Future saveThemeMode(String value); 9 | } 10 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Run tests 2 | on: pull_request 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v1 8 | - uses: actions/setup-java@v1 9 | with: 10 | java-version: '12.x' 11 | - uses: subosito/flutter-action@v1 12 | with: 13 | channel: 'stable' 14 | - run: flutter pub get 15 | - run: flutter analyze --no-fatal-warnings 16 | - run: flutter test 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 3.0.0 2 | 3 | - Support null-safety. 4 | - BREAKING CHANGE: A new `placeholderWidget` property is supported to display a custom widget while the theme is loaded. It replaces the `withFallback` property. If not specified, it'll display an empty container as before. 5 | 6 | ## 2.0.0 7 | 8 | - Allow management of theme by consumer. 9 | - BREAKING CHANGE: A new `manager` property that implements `IThemeModeManager` is required. 10 | 11 | ## 1.0.0 12 | 13 | - Initial release. 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/theme_mode_handler_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.theme_mode_handler_example 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - shared_preferences (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | shared_preferences: 14 | :path: ".symlinks/plugins/shared_preferences/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c 18 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d 19 | 20 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 21 | 22 | COCOAPODS: 1.10.0 23 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: arthurdenner 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://www.buymeacoffee.com/arthurdenner'] 13 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "theme_mode_handler", 3 | "projectOwner": "arthurdenner", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 100, 10 | "commit": true, 11 | "commitConvention": "angular", 12 | "contributors": [ 13 | { 14 | "login": "arthurdenner", 15 | "name": "Arthur Denner", 16 | "avatar_url": "https://avatars0.githubusercontent.com/u/13774309?v=4", 17 | "profile": "https://github.com/arthurdenner", 18 | "contributions": [ 19 | "code", 20 | "design", 21 | "example", 22 | "maintenance" 23 | ] 24 | } 25 | ], 26 | "contributorsPerLine": 7 27 | } 28 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/lib/theme_mode_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | import 'package:theme_mode_handler/theme_mode_manager_interface.dart'; 3 | 4 | class ExampleThemeModeManager implements IThemeModeManager { 5 | static const _key = 'example_theme_mode'; 6 | 7 | @override 8 | Future loadThemeMode() async { 9 | final _prefs = await SharedPreferences.getInstance(); 10 | // Intended delay for demonstration purposes 11 | await Future.delayed(Duration(milliseconds: 500)); 12 | 13 | return _prefs.getString(_key); 14 | } 15 | 16 | @override 17 | Future saveThemeMode(String value) async { 18 | final _prefs = await SharedPreferences.getInstance(); 19 | 20 | return _prefs.setString(_key, value); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /theme_mode_handler.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Arthur Denner 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/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.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 | -------------------------------------------------------------------------------- /lib/theme_picker_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'theme_mode_handler.dart'; 4 | 5 | class ThemeModeOption { 6 | final String label; 7 | final ThemeMode value; 8 | 9 | const ThemeModeOption(this.label, this.value); 10 | } 11 | 12 | const _themeModeOptions = [ 13 | ThemeModeOption('System', ThemeMode.system), 14 | ThemeModeOption('Light', ThemeMode.light), 15 | ThemeModeOption('Dark', ThemeMode.dark), 16 | ]; 17 | 18 | /// A `SimpleDialog` with `ThemeMode.values` as options. 19 | class ThemePickerDialog extends StatelessWidget { 20 | /// Creates a `ThemePickerDialog`. 21 | const ThemePickerDialog({Key? key}) : super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return SimpleDialog( 26 | title: const Text('Select a theme mode'), 27 | children: _themeModeOptions.map((option) { 28 | return SimpleDialogOption( 29 | onPressed: () => _selectThemeMode(context, option.value), 30 | child: Text(option.label), 31 | ); 32 | }).toList(), 33 | ); 34 | } 35 | } 36 | 37 | void _selectThemeMode(BuildContext context, ThemeMode value) async { 38 | await ThemeModeHandler.of(context)?.saveThemeMode(value); 39 | Navigator.pop(context, value); 40 | } 41 | 42 | /// Displays a `SimpleDialog` with `ThemeMode.values` as options. 43 | Future showThemePickerDialog({required BuildContext context}) { 44 | return showDialog( 45 | context: context, 46 | builder: (_) => ThemePickerDialog(), 47 | ); 48 | } 49 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /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 | theme_mode_handler_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 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: theme_mode_handler 2 | description: Flutter widget to change `themeMode` during runtime and persist it across restarts 3 | version: 3.0.0 4 | homepage: 'https://github.com/arthurdenner/theme_mode_handler' 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | mockito: ^5.0.0 15 | flutter_test: 16 | sdk: flutter 17 | 18 | # For information on the generic Dart part of this file, see the 19 | # following page: https://dart.dev/tools/pub/pubspec 20 | 21 | # The following section is specific to Flutter. 22 | flutter: 23 | # To add assets to your package, add an assets section, like this: 24 | # assets: 25 | # - images/a_dot_burr.jpeg 26 | # - images/a_dot_ham.jpeg 27 | # 28 | # For details regarding assets in packages, see 29 | # https://flutter.io/assets-and-images/#from-packages 30 | # 31 | # An image asset can refer to one or more resolution-specific "variants", see 32 | # https://flutter.io/assets-and-images/#resolution-aware. 33 | # To add custom fonts to your package, add a fonts section here, 34 | # in this "flutter" section. Each entry in this list should have a 35 | # "family" key with the font family name, and a "fonts" key with a 36 | # list giving the asset and other descriptors for the font. For 37 | # example: 38 | # fonts: 39 | # - family: Schyler 40 | # fonts: 41 | # - asset: fonts/Schyler-Regular.ttf 42 | # - asset: fonts/Schyler-Italic.ttf 43 | # style: italic 44 | # - family: Trajan Pro 45 | # fonts: 46 | # - asset: fonts/TrajanPro.ttf 47 | # - asset: fonts/TrajanPro_Bold.ttf 48 | # weight: 700 49 | # 50 | # For details regarding fonts in packages, see 51 | # https://flutter.io/custom-fonts/#from-packages 52 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | linter: 2 | rules: 3 | - always_declare_return_types 4 | - always_require_non_null_named_parameters 5 | - annotate_overrides 6 | - avoid_init_to_null 7 | - avoid_null_checks_in_equality_operators 8 | - avoid_relative_lib_imports 9 | - avoid_return_types_on_setters 10 | - avoid_shadowing_type_parameters 11 | - avoid_single_cascade_in_expression_statements 12 | - avoid_types_as_parameter_names 13 | - await_only_futures 14 | - camel_case_extensions 15 | - curly_braces_in_flow_control_structures 16 | - empty_catches 17 | - empty_constructor_bodies 18 | - library_names 19 | - library_prefixes 20 | - no_duplicate_case_values 21 | - null_closures 22 | - omit_local_variable_types 23 | - prefer_adjacent_string_concatenation 24 | - prefer_collection_literals 25 | - prefer_conditional_assignment 26 | - prefer_contains 27 | - prefer_equal_for_default_values 28 | - prefer_final_fields 29 | - prefer_for_elements_to_map_fromIterable 30 | - prefer_generic_function_type_aliases 31 | - prefer_if_null_operators 32 | - prefer_inlined_adds 33 | - prefer_is_empty 34 | - prefer_is_not_empty 35 | - prefer_iterable_whereType 36 | - prefer_single_quotes 37 | - prefer_spread_collections 38 | - recursive_getters 39 | - slash_for_doc_comments 40 | - sort_child_properties_last 41 | - type_init_formals 42 | - unawaited_futures 43 | - unnecessary_brace_in_string_interps 44 | - unnecessary_const 45 | - unnecessary_getters_setters 46 | - unnecessary_new 47 | - unnecessary_null_in_if_null_operators 48 | - unnecessary_this 49 | - unrelated_type_equality_checks 50 | - unsafe_html 51 | - use_full_hex_values_for_flutter_colors 52 | - use_function_type_syntax_for_parameters 53 | - use_rethrow_when_possible 54 | - valid_regexps 55 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_mode_handler/theme_mode_handler.dart'; 3 | import 'package:theme_mode_handler/theme_picker_dialog.dart'; 4 | 5 | import 'theme_mode_manager.dart'; 6 | 7 | void main() => runApp(ExampleApp()); 8 | 9 | class ExampleApp extends StatefulWidget { 10 | @override 11 | _ExampleAppState createState() => _ExampleAppState(); 12 | } 13 | 14 | class _ExampleAppState extends State { 15 | @override 16 | Widget build(BuildContext context) { 17 | return ThemeModeHandler( 18 | manager: ExampleThemeModeManager(), 19 | placeholderWidget: Center( 20 | child: CircularProgressIndicator(), 21 | ), 22 | builder: (ThemeMode themeMode) { 23 | return MaterialApp( 24 | themeMode: themeMode, 25 | darkTheme: ThemeData( 26 | brightness: Brightness.dark, 27 | ), 28 | theme: ThemeData( 29 | brightness: Brightness.light, 30 | ), 31 | home: HomePage(), 32 | ); 33 | }, 34 | ); 35 | } 36 | } 37 | 38 | class HomePage extends StatelessWidget { 39 | const HomePage({Key? key}) : super(key: key); 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | final themeMode = ThemeModeHandler.of(context)?.themeMode; 44 | 45 | return Scaffold( 46 | appBar: AppBar( 47 | title: const Text('ThemeModeHandler Example'), 48 | ), 49 | body: Center( 50 | child: Container( 51 | width: 400, 52 | padding: const EdgeInsets.all(50), 53 | child: Card( 54 | child: ListTile( 55 | onTap: () => _selectThemeMode(context), 56 | title: Text(themeMode.toString()), 57 | subtitle: const Text('Tap to select another'), 58 | trailing: const Icon(Icons.settings), 59 | ), 60 | ), 61 | ), 62 | ), 63 | ); 64 | } 65 | 66 | void _selectThemeMode(BuildContext context) async { 67 | final newThemeMode = await showThemePickerDialog(context: context); 68 | print(newThemeMode); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: theme_mode_handler_example 2 | description: Demonstrates how to use the theme_mode_handler plugin. 3 | version: 0.0.0 4 | publish_to: 'none' 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | # The following adds the Cupertino Icons font to your application. 14 | # Use with the CupertinoIcons class for iOS style icons. 15 | cupertino_icons: ^1.0.2 16 | shared_preferences: ^2.0.3 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | theme_mode_handler: 23 | path: ../ 24 | 25 | # For information on the generic Dart part of this file, see the 26 | # following page: https://dart.dev/tools/pub/pubspec 27 | 28 | # The following section is specific to Flutter. 29 | flutter: 30 | # The following line ensures that the Material Icons font is 31 | # included with your application, so that you can use the icons in 32 | # the material Icons class. 33 | uses-material-design: true 34 | # To add assets to your application, add an assets section, like this: 35 | # assets: 36 | # - images/a_dot_burr.jpeg 37 | # - images/a_dot_ham.jpeg 38 | # An image asset can refer to one or more resolution-specific "variants", see 39 | # https://flutter.dev/assets-and-images/#resolution-aware. 40 | # For details regarding adding assets from package dependencies, see 41 | # https://flutter.dev/assets-and-images/#from-packages 42 | # To add custom fonts to your application, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | # fonts: 48 | # - family: Schyler 49 | # fonts: 50 | # - asset: fonts/Schyler-Regular.ttf 51 | # - asset: fonts/Schyler-Italic.ttf 52 | # style: italic 53 | # - family: Trajan Pro 54 | # fonts: 55 | # - asset: fonts/TrajanPro.ttf 56 | # - asset: fonts/TrajanPro_Bold.ttf 57 | # weight: 700 58 | # 59 | # For details regarding fonts from package dependencies, 60 | # see https://flutter.dev/custom-fonts/#from-packages 61 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.theme_mode_handler_example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/theme_mode_handler.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'theme_mode_manager_interface.dart'; 4 | 5 | /// Wrap the management of the functionality and allow the consumer 6 | /// to persist and retrieve the user's preference wherever they want. 7 | class ThemeModeHandler extends StatefulWidget { 8 | /// Function that runs when themeMode changes. 9 | final Widget Function(ThemeMode themeMode) builder; 10 | 11 | /// Implementation of IThemeModeManager to load and save the selected value. 12 | final IThemeModeManager manager; 13 | 14 | /// Default value to be used when shared preference is null. 15 | final ThemeMode defaultTheme; 16 | 17 | /// While the themeMode is loaded, you can choose to render a different widget. 18 | /// By default, it'll render an empty container. 19 | final Widget? placeholderWidget; 20 | 21 | /// Creates a `ThemeModeHandler`. 22 | const ThemeModeHandler({ 23 | Key? key, 24 | required this.builder, 25 | required this.manager, 26 | this.defaultTheme = ThemeMode.system, 27 | this.placeholderWidget, 28 | }) : super(key: key); 29 | 30 | @override 31 | _ThemeModeHandlerState createState() => _ThemeModeHandlerState(); 32 | 33 | /// Access to the closest [ThemeModeHandler] instance to the given context. 34 | static _ThemeModeHandlerState? of(BuildContext context) { 35 | return context.findAncestorStateOfType<_ThemeModeHandlerState>(); 36 | } 37 | } 38 | 39 | class _ThemeModeHandlerState extends State { 40 | late final Future _initFuture = _loadThemeMode(); 41 | late ThemeMode _themeMode; 42 | 43 | /// Current selected value. 44 | ThemeMode get themeMode => _themeMode; 45 | 46 | /// Updates the themeMode and calls `manager.saveThemeMode`. 47 | Future saveThemeMode(ThemeMode value) async { 48 | _updateThemeMode(value); 49 | await widget.manager.saveThemeMode(value.toString()); 50 | } 51 | 52 | Future _loadThemeMode() async { 53 | final value = await widget.manager.loadThemeMode(); 54 | final theme = ThemeMode.values.firstWhere( 55 | (v) => v.toString() == value, 56 | orElse: () => widget.defaultTheme, 57 | ); 58 | 59 | _updateThemeMode(theme); 60 | return theme; 61 | } 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | return FutureBuilder( 66 | future: _initFuture, 67 | builder: (_, snapshot) { 68 | return snapshot.hasData 69 | ? widget.builder(_themeMode) 70 | : widget.placeholderWidget ?? Container(); 71 | }, 72 | ); 73 | } 74 | 75 | void _updateThemeMode(ThemeMode value) { 76 | setState(() => _themeMode = value); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner.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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # theme_mode_handler 2 | 3 | > This library is considered done - no new features or changes are foreseen. 4 | > You may not see recent updates to this repository, but the library is totally functional. 5 | > Please [open an issue](https://github.com/arthurdenner/theme_mode_handler/issues) if you find an issue 6 | > or think something is missing so we can discuss it. 7 | 8 | 9 | 10 | [![version][version-badge]][package] 11 | [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) 12 | 13 | 14 | 15 | Flutter widget to change `themeMode` during runtime and persist it across restarts. 16 | 17 | ## Motivation 18 | 19 | Flutter 1.9 introduced a new way to control which theme is used: `MaterialApp.themeMode`. If you have specified the `darkTheme` and `theme` properties, you can use `themeMode` to control it. The property defaults to `ThemeMode.system`. 20 | 21 | This package wraps this functionality and allows you to persist and retrieve the user's preference wherever you want by implementing an interface. 22 | 23 | ## Installation 24 | 25 | Add this to your `pubspec.yaml`: 26 | 27 | ```yaml 28 | dependencies: 29 | theme_mode_handler: ^3.0.0 30 | ``` 31 | 32 | ## Usage 33 | 34 | - Create a class that implements the `IThemeModeManager` interface: 35 | 36 | ```dart 37 | class MyManager implements IThemeModeManager { 38 | @override 39 | Future loadThemeMode() async {} 40 | 41 | @override 42 | Future saveThemeMode(String value) async {} 43 | } 44 | ``` 45 | 46 | - Import the `ThemeModeHandler` widget, wrap `MaterialApp` with it and pass it an instance of your manager: 47 | 48 | ```dart 49 | import 'package:theme_mode_handler/theme_mode_handler.dart'; 50 | 51 | class MyApp extends StatelessWidget { 52 | @override 53 | Widget build(BuildContext context) { 54 | return ThemeModeHandler( 55 | manager: MyManager(), 56 | builder: (ThemeMode themeMode) { 57 | return MaterialApp( 58 | themeMode: themeMode, 59 | darkTheme: ThemeData( 60 | brightness: Brightness.dark, 61 | ), 62 | theme: ThemeData( 63 | brightness: Brightness.light, 64 | ), 65 | home: MyHomePage(title: 'Flutter Demo Home Page'), 66 | ); 67 | }, 68 | ); 69 | } 70 | } 71 | ``` 72 | 73 | - Change the `themeMode` with: 74 | 75 | ```dart 76 | ThemeModeHandler.of(context).saveThemeMode(value); 77 | ``` 78 | 79 | - Get the current `themeMode` with: 80 | 81 | ```dart 82 | ThemeModeHandler.of(context).themeMode; 83 | ``` 84 | 85 | Check the `example` folder for a complete example. 86 | 87 | ## API 88 | 89 | ### builder 90 | 91 | Type: `Widget Function(ThemeMode themeMode)`. 92 | 93 | Function that runs when themeMode changes. 94 | 95 | ### manager 96 | 97 | Type: `IThemeModeManager`. 98 | 99 | Implementation of IThemeModeManager to load and save the selected value. 100 | 101 | #### defaultTheme 102 | 103 | Type: `ThemeMode`. 104 | 105 | Default value to be used when `manager.loadThemeMode` returns `null` or an invalid value. 106 | 107 | ### placeholderWidget 108 | 109 | Type: `Widget?`. 110 | 111 | While the themeMode is loaded, you can choose to render a different widget. 112 | By default, it'll render an empty container. 113 | 114 | ## Extra 115 | 116 | This package exports a dialog and a method to simplify its usage. 117 | 118 | - Import the dialog with: 119 | 120 | ```dart 121 | import 'package:theme_mode_handler/theme_picker_dialog.dart'; 122 | ``` 123 | 124 | - Use it like this: 125 | 126 | ```dart 127 | void _selectThemeMode(BuildContext context) async { 128 | final newThemeMode = await showThemePickerDialog(context: context); 129 | print(newThemeMode); 130 | } 131 | ``` 132 | 133 | ## Inspiration 134 | 135 | This package is inspired and based on the great package [dynamic_theme](https://github.com/Norbert515/dynamic_theme). 136 | 137 | ## Contributors ✨ 138 | 139 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 |

Arthur Denner

💻 🎨 💡 🚧
149 | 150 | 151 | 152 | 153 | 154 | 155 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 156 | 157 | ## License 158 | 159 | MIT © [Arthur Denner](https://github.com/arthurdenner/) 160 | 161 | [version-badge]: https://img.shields.io/pub/v/theme_mode_handler?style=flat-square 162 | [package]: https://pub.dev/packages/theme_mode_handler 163 | -------------------------------------------------------------------------------- /test/theme_mode_handler_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:theme_mode_handler/theme_mode_handler.dart'; 5 | import 'package:theme_mode_handler/theme_mode_manager_interface.dart'; 6 | 7 | class ManagerMock extends Mock implements IThemeModeManager { 8 | @override 9 | Future loadThemeMode() { 10 | return super.noSuchMethod( 11 | Invocation.method(#loadThemeMode, []), 12 | returnValue: Future.value(''), 13 | ); 14 | } 15 | 16 | @override 17 | Future saveThemeMode(String? value) { 18 | return super.noSuchMethod( 19 | Invocation.method(#saveThemeMode, ['any']), 20 | returnValue: Future.value(true), 21 | ); 22 | } 23 | } 24 | 25 | final IThemeModeManager _mock = ManagerMock(); 26 | 27 | Widget defaultBuilder(ThemeMode themeMode) { 28 | return MaterialApp( 29 | themeMode: themeMode, 30 | darkTheme: ThemeData( 31 | scaffoldBackgroundColor: Colors.black, 32 | ), 33 | theme: ThemeData( 34 | scaffoldBackgroundColor: Colors.white, 35 | ), 36 | home: Builder(builder: (context) { 37 | return Scaffold( 38 | body: ElevatedButton( 39 | onPressed: () { 40 | ThemeModeHandler.of(context)?.saveThemeMode( 41 | themeMode == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark, 42 | ); 43 | }, 44 | child: Text('Toggle theme'), 45 | ), 46 | ); 47 | }), 48 | ); 49 | } 50 | 51 | void main() { 52 | Widget buildApp({ 53 | Widget? placeholderWidget, 54 | Widget Function(ThemeMode) builder = defaultBuilder, 55 | }) { 56 | return ThemeModeHandler( 57 | manager: _mock, 58 | builder: builder, 59 | placeholderWidget: placeholderWidget, 60 | ); 61 | } 62 | 63 | group('manager', () { 64 | testWidgets('calls load and set methods only when needed', (tester) async { 65 | when(_mock.loadThemeMode()).thenAnswer((_) => Future.value('')); 66 | when(_mock.saveThemeMode('any')).thenAnswer((_) => Future.value(true)); 67 | await tester.pumpWidget(buildApp()); 68 | await tester.pump(); 69 | await tester.tap(find.byType(ElevatedButton)); 70 | 71 | verify(_mock.loadThemeMode()).called(1); 72 | verify(_mock.saveThemeMode('any')).called(1); 73 | }); 74 | }); 75 | 76 | group('placeholderWidget', () { 77 | testWidgets('renders a Container by default while loading is true', 78 | (tester) async { 79 | when(_mock.loadThemeMode()).thenAnswer((_) => Future.value('')); 80 | await tester.pumpWidget(buildApp()); 81 | 82 | expect(find.byType(Container), findsOneWidget); 83 | expect(find.byType(Scaffold), findsNothing); 84 | await tester.pump(); 85 | expect(find.byType(Scaffold), findsOneWidget); 86 | }); 87 | 88 | testWidgets( 89 | 'renders the placeholderWidget if provided while loading is true', 90 | (tester) async { 91 | when(_mock.loadThemeMode()).thenAnswer((_) => Future.value('')); 92 | await tester.pumpWidget(buildApp( 93 | placeholderWidget: Center( 94 | child: CircularProgressIndicator(), 95 | ), 96 | )); 97 | 98 | expect(find.byType(CircularProgressIndicator), findsOneWidget); 99 | await tester.pump(); 100 | expect(find.byType(Scaffold), findsOneWidget); 101 | }); 102 | }); 103 | 104 | group('defaultTheme', () { 105 | testWidgets('behaves properly to ThemeMode.system', (tester) async { 106 | when(_mock.loadThemeMode()).thenAnswer( 107 | (_) => Future.value(''), 108 | ); 109 | await tester.pumpWidget(buildApp()); 110 | await tester.pumpAndSettle(); 111 | 112 | final scaffold1 = tester.firstWidget(find.byType(Material)); 113 | expect(scaffold1.color, Colors.white); 114 | 115 | await tester.tap(find.byType(ElevatedButton)); 116 | await tester.pumpAndSettle(); 117 | 118 | final scaffold2 = tester.firstWidget(find.byType(Material)); 119 | expect(scaffold2.color, Colors.black); 120 | }); 121 | 122 | testWidgets('behaves properly to ThemeMode.dark', (tester) async { 123 | when(_mock.loadThemeMode()).thenAnswer( 124 | (_) => Future.value('ThemeMode.dark'), 125 | ); 126 | await tester.pumpWidget(buildApp()); 127 | await tester.pumpAndSettle(); 128 | 129 | final scaffold1 = tester.firstWidget(find.byType(Material)); 130 | expect(scaffold1.color, Colors.black); 131 | 132 | await tester.tap(find.byType(ElevatedButton)); 133 | await tester.pumpAndSettle(); 134 | 135 | final scaffold2 = tester.firstWidget(find.byType(Material)); 136 | expect(scaffold2.color, Colors.white); 137 | }); 138 | 139 | testWidgets('behaves properly to ThemeMode.light', (tester) async { 140 | when(_mock.loadThemeMode()).thenAnswer( 141 | (_) => Future.value('ThemeMode.light'), 142 | ); 143 | await tester.pumpWidget(buildApp()); 144 | await tester.pumpAndSettle(); 145 | 146 | final scaffold1 = tester.firstWidget(find.byType(Material)); 147 | expect(scaffold1.color, Colors.white); 148 | 149 | await tester.tap(find.byType(ElevatedButton)); 150 | await tester.pumpAndSettle(); 151 | 152 | final scaffold2 = tester.firstWidget(find.byType(Material)); 153 | expect(scaffold2.color, Colors.black); 154 | }); 155 | }); 156 | } 157 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.5.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.0.2" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0" 60 | ffi: 61 | dependency: transitive 62 | description: 63 | name: ffi 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.0.0" 67 | file: 68 | dependency: transitive 69 | description: 70 | name: file 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "6.1.0" 74 | flutter: 75 | dependency: "direct main" 76 | description: flutter 77 | source: sdk 78 | version: "0.0.0" 79 | flutter_test: 80 | dependency: "direct dev" 81 | description: flutter 82 | source: sdk 83 | version: "0.0.0" 84 | flutter_web_plugins: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.0" 89 | js: 90 | dependency: transitive 91 | description: 92 | name: js 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "0.6.3" 96 | matcher: 97 | dependency: transitive 98 | description: 99 | name: matcher 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "0.12.10" 103 | meta: 104 | dependency: transitive 105 | description: 106 | name: meta 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.3.0" 110 | path: 111 | dependency: transitive 112 | description: 113 | name: path 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.8.0" 117 | path_provider_linux: 118 | dependency: transitive 119 | description: 120 | name: path_provider_linux 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "2.0.0" 124 | path_provider_platform_interface: 125 | dependency: transitive 126 | description: 127 | name: path_provider_platform_interface 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "2.0.1" 131 | path_provider_windows: 132 | dependency: transitive 133 | description: 134 | name: path_provider_windows 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.0.0" 138 | platform: 139 | dependency: transitive 140 | description: 141 | name: platform 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "3.0.0" 145 | plugin_platform_interface: 146 | dependency: transitive 147 | description: 148 | name: plugin_platform_interface 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "2.0.0" 152 | process: 153 | dependency: transitive 154 | description: 155 | name: process 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "4.1.0" 159 | shared_preferences: 160 | dependency: "direct main" 161 | description: 162 | name: shared_preferences 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "2.0.3" 166 | shared_preferences_linux: 167 | dependency: transitive 168 | description: 169 | name: shared_preferences_linux 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.0.0" 173 | shared_preferences_macos: 174 | dependency: transitive 175 | description: 176 | name: shared_preferences_macos 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "2.0.0" 180 | shared_preferences_platform_interface: 181 | dependency: transitive 182 | description: 183 | name: shared_preferences_platform_interface 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.0.0" 187 | shared_preferences_web: 188 | dependency: transitive 189 | description: 190 | name: shared_preferences_web 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "2.0.0" 194 | shared_preferences_windows: 195 | dependency: transitive 196 | description: 197 | name: shared_preferences_windows 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "2.0.0" 201 | sky_engine: 202 | dependency: transitive 203 | description: flutter 204 | source: sdk 205 | version: "0.0.99" 206 | source_span: 207 | dependency: transitive 208 | description: 209 | name: source_span 210 | url: "https://pub.dartlang.org" 211 | source: hosted 212 | version: "1.8.0" 213 | stack_trace: 214 | dependency: transitive 215 | description: 216 | name: stack_trace 217 | url: "https://pub.dartlang.org" 218 | source: hosted 219 | version: "1.10.0" 220 | stream_channel: 221 | dependency: transitive 222 | description: 223 | name: stream_channel 224 | url: "https://pub.dartlang.org" 225 | source: hosted 226 | version: "2.1.0" 227 | string_scanner: 228 | dependency: transitive 229 | description: 230 | name: string_scanner 231 | url: "https://pub.dartlang.org" 232 | source: hosted 233 | version: "1.1.0" 234 | term_glyph: 235 | dependency: transitive 236 | description: 237 | name: term_glyph 238 | url: "https://pub.dartlang.org" 239 | source: hosted 240 | version: "1.2.0" 241 | test_api: 242 | dependency: transitive 243 | description: 244 | name: test_api 245 | url: "https://pub.dartlang.org" 246 | source: hosted 247 | version: "0.2.19" 248 | theme_mode_handler: 249 | dependency: "direct dev" 250 | description: 251 | path: ".." 252 | relative: true 253 | source: path 254 | version: "3.0.0" 255 | typed_data: 256 | dependency: transitive 257 | description: 258 | name: typed_data 259 | url: "https://pub.dartlang.org" 260 | source: hosted 261 | version: "1.3.0" 262 | vector_math: 263 | dependency: transitive 264 | description: 265 | name: vector_math 266 | url: "https://pub.dartlang.org" 267 | source: hosted 268 | version: "2.1.0" 269 | win32: 270 | dependency: transitive 271 | description: 272 | name: win32 273 | url: "https://pub.dartlang.org" 274 | source: hosted 275 | version: "2.0.0" 276 | xdg_directories: 277 | dependency: transitive 278 | description: 279 | name: xdg_directories 280 | url: "https://pub.dartlang.org" 281 | source: hosted 282 | version: "0.2.0" 283 | sdks: 284 | dart: ">=2.12.0 <3.0.0" 285 | flutter: ">=1.20.0" 286 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "17.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.1.0" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.0.0" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.5.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.6.3" 46 | built_collection: 47 | dependency: transitive 48 | description: 49 | name: built_collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "5.0.0" 53 | built_value: 54 | dependency: transitive 55 | description: 56 | name: built_value 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "8.0.0" 60 | characters: 61 | dependency: transitive 62 | description: 63 | name: characters 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.1.0" 67 | charcode: 68 | dependency: transitive 69 | description: 70 | name: charcode 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.2.0" 74 | cli_util: 75 | dependency: transitive 76 | description: 77 | name: cli_util 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "0.3.0" 81 | clock: 82 | dependency: transitive 83 | description: 84 | name: clock 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.1.0" 88 | code_builder: 89 | dependency: transitive 90 | description: 91 | name: code_builder 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "3.6.0" 95 | collection: 96 | dependency: transitive 97 | description: 98 | name: collection 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.15.0" 102 | convert: 103 | dependency: transitive 104 | description: 105 | name: convert 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "3.0.0" 109 | crypto: 110 | dependency: transitive 111 | description: 112 | name: crypto 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "3.0.0" 116 | dart_style: 117 | dependency: transitive 118 | description: 119 | name: dart_style 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "1.3.14" 123 | fake_async: 124 | dependency: transitive 125 | description: 126 | name: fake_async 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.2.0" 130 | file: 131 | dependency: transitive 132 | description: 133 | name: file 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "6.1.0" 137 | fixnum: 138 | dependency: transitive 139 | description: 140 | name: fixnum 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "1.0.0" 144 | flutter: 145 | dependency: "direct main" 146 | description: flutter 147 | source: sdk 148 | version: "0.0.0" 149 | flutter_test: 150 | dependency: "direct dev" 151 | description: flutter 152 | source: sdk 153 | version: "0.0.0" 154 | glob: 155 | dependency: transitive 156 | description: 157 | name: glob 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "2.0.0" 161 | logging: 162 | dependency: transitive 163 | description: 164 | name: logging 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "1.0.0" 168 | matcher: 169 | dependency: transitive 170 | description: 171 | name: matcher 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "0.12.10" 175 | meta: 176 | dependency: transitive 177 | description: 178 | name: meta 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "1.3.0" 182 | mockito: 183 | dependency: "direct dev" 184 | description: 185 | name: mockito 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "5.0.0" 189 | package_config: 190 | dependency: transitive 191 | description: 192 | name: package_config 193 | url: "https://pub.dartlang.org" 194 | source: hosted 195 | version: "2.0.0" 196 | path: 197 | dependency: transitive 198 | description: 199 | name: path 200 | url: "https://pub.dartlang.org" 201 | source: hosted 202 | version: "1.8.0" 203 | pedantic: 204 | dependency: transitive 205 | description: 206 | name: pedantic 207 | url: "https://pub.dartlang.org" 208 | source: hosted 209 | version: "1.11.0" 210 | pub_semver: 211 | dependency: transitive 212 | description: 213 | name: pub_semver 214 | url: "https://pub.dartlang.org" 215 | source: hosted 216 | version: "2.0.0" 217 | sky_engine: 218 | dependency: transitive 219 | description: flutter 220 | source: sdk 221 | version: "0.0.99" 222 | source_gen: 223 | dependency: transitive 224 | description: 225 | name: source_gen 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "0.9.10+3" 229 | source_span: 230 | dependency: transitive 231 | description: 232 | name: source_span 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "1.8.0" 236 | stack_trace: 237 | dependency: transitive 238 | description: 239 | name: stack_trace 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.10.0" 243 | stream_channel: 244 | dependency: transitive 245 | description: 246 | name: stream_channel 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "2.1.0" 250 | string_scanner: 251 | dependency: transitive 252 | description: 253 | name: string_scanner 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "1.1.0" 257 | term_glyph: 258 | dependency: transitive 259 | description: 260 | name: term_glyph 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.2.0" 264 | test_api: 265 | dependency: transitive 266 | description: 267 | name: test_api 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "0.2.19" 271 | typed_data: 272 | dependency: transitive 273 | description: 274 | name: typed_data 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "1.3.0" 278 | vector_math: 279 | dependency: transitive 280 | description: 281 | name: vector_math 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "2.1.0" 285 | watcher: 286 | dependency: transitive 287 | description: 288 | name: watcher 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "1.0.0" 292 | yaml: 293 | dependency: transitive 294 | description: 295 | name: yaml 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "3.1.0" 299 | sdks: 300 | dart: ">=2.12.0 <3.0.0" 301 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | 9F2E84A261069C0D11AAE046 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7BB450D2027A1D2ED9269D4 /* Pods_Runner.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 0EB240D596A4E6C1A3C44E40 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 34 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 35 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 36 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 37 | 43D9D9E7C8FD5B0A67C50240 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 38 | 54926834904D8C352A399149 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 39 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 40 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 42 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 43 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 44 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | A7BB450D2027A1D2ED9269D4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 9F2E84A261069C0D11AAE046 /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 4171DB8BA7702C7774AD36BA /* Frameworks */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | A7BB450D2027A1D2ED9269D4 /* Pods_Runner.framework */, 68 | ); 69 | name = Frameworks; 70 | sourceTree = ""; 71 | }; 72 | 7DCB0CD4718CAD74D4DD9BAD /* Pods */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 54926834904D8C352A399149 /* Pods-Runner.debug.xcconfig */, 76 | 0EB240D596A4E6C1A3C44E40 /* Pods-Runner.release.xcconfig */, 77 | 43D9D9E7C8FD5B0A67C50240 /* Pods-Runner.profile.xcconfig */, 78 | ); 79 | name = Pods; 80 | path = Pods; 81 | sourceTree = ""; 82 | }; 83 | 9740EEB11CF90186004384FC /* Flutter */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 87 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 88 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 89 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 90 | ); 91 | name = Flutter; 92 | sourceTree = ""; 93 | }; 94 | 97C146E51CF9000F007C117D = { 95 | isa = PBXGroup; 96 | children = ( 97 | 9740EEB11CF90186004384FC /* Flutter */, 98 | 97C146F01CF9000F007C117D /* Runner */, 99 | 97C146EF1CF9000F007C117D /* Products */, 100 | 7DCB0CD4718CAD74D4DD9BAD /* Pods */, 101 | 4171DB8BA7702C7774AD36BA /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 97C146EF1CF9000F007C117D /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146EE1CF9000F007C117D /* Runner.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 97C146F01CF9000F007C117D /* Runner */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 117 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 118 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 119 | 97C147021CF9000F007C117D /* Info.plist */, 120 | 97C146F11CF9000F007C117D /* Supporting Files */, 121 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 122 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 123 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 124 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 125 | ); 126 | path = Runner; 127 | sourceTree = ""; 128 | }; 129 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | 97C146ED1CF9000F007C117D /* Runner */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 142 | buildPhases = ( 143 | 37F5080659B87EE11E9C1D31 /* [CP] Check Pods Manifest.lock */, 144 | 9740EEB61CF901F6004384FC /* Run Script */, 145 | 97C146EA1CF9000F007C117D /* Sources */, 146 | 97C146EB1CF9000F007C117D /* Frameworks */, 147 | 97C146EC1CF9000F007C117D /* Resources */, 148 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 149 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 150 | 7D32622F11CC528EE362395E /* [CP] Embed Pods Frameworks */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = Runner; 157 | productName = Runner; 158 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | /* End PBXNativeTarget section */ 162 | 163 | /* Begin PBXProject section */ 164 | 97C146E61CF9000F007C117D /* Project object */ = { 165 | isa = PBXProject; 166 | attributes = { 167 | LastUpgradeCheck = 1020; 168 | ORGANIZATIONNAME = "The Chromium Authors"; 169 | TargetAttributes = { 170 | 97C146ED1CF9000F007C117D = { 171 | CreatedOnToolsVersion = 7.3.1; 172 | LastSwiftMigration = 1100; 173 | }; 174 | }; 175 | }; 176 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 177 | compatibilityVersion = "Xcode 3.2"; 178 | developmentRegion = en; 179 | hasScannedForEncodings = 0; 180 | knownRegions = ( 181 | en, 182 | Base, 183 | ); 184 | mainGroup = 97C146E51CF9000F007C117D; 185 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 186 | projectDirPath = ""; 187 | projectRoot = ""; 188 | targets = ( 189 | 97C146ED1CF9000F007C117D /* Runner */, 190 | ); 191 | }; 192 | /* End PBXProject section */ 193 | 194 | /* Begin PBXResourcesBuildPhase section */ 195 | 97C146EC1CF9000F007C117D /* Resources */ = { 196 | isa = PBXResourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 200 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 201 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 202 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXResourcesBuildPhase section */ 207 | 208 | /* Begin PBXShellScriptBuildPhase section */ 209 | 37F5080659B87EE11E9C1D31 /* [CP] Check Pods Manifest.lock */ = { 210 | isa = PBXShellScriptBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | ); 214 | inputFileListPaths = ( 215 | ); 216 | inputPaths = ( 217 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 218 | "${PODS_ROOT}/Manifest.lock", 219 | ); 220 | name = "[CP] Check Pods Manifest.lock"; 221 | outputFileListPaths = ( 222 | ); 223 | outputPaths = ( 224 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | shellPath = /bin/sh; 228 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 229 | showEnvVarsInLog = 0; 230 | }; 231 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 232 | isa = PBXShellScriptBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | ); 236 | inputPaths = ( 237 | ); 238 | name = "Thin Binary"; 239 | outputPaths = ( 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | shellPath = /bin/sh; 243 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 244 | }; 245 | 7D32622F11CC528EE362395E /* [CP] Embed Pods Frameworks */ = { 246 | isa = PBXShellScriptBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | inputPaths = ( 251 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 252 | "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", 253 | ); 254 | name = "[CP] Embed Pods Frameworks"; 255 | outputPaths = ( 256 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | shellPath = /bin/sh; 260 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 261 | showEnvVarsInLog = 0; 262 | }; 263 | 9740EEB61CF901F6004384FC /* Run Script */ = { 264 | isa = PBXShellScriptBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | ); 268 | inputPaths = ( 269 | ); 270 | name = "Run Script"; 271 | outputPaths = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | shellPath = /bin/sh; 275 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 276 | }; 277 | /* End PBXShellScriptBuildPhase section */ 278 | 279 | /* Begin PBXSourcesBuildPhase section */ 280 | 97C146EA1CF9000F007C117D /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 285 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | /* End PBXSourcesBuildPhase section */ 290 | 291 | /* Begin PBXVariantGroup section */ 292 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 293 | isa = PBXVariantGroup; 294 | children = ( 295 | 97C146FB1CF9000F007C117D /* Base */, 296 | ); 297 | name = Main.storyboard; 298 | sourceTree = ""; 299 | }; 300 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 301 | isa = PBXVariantGroup; 302 | children = ( 303 | 97C147001CF9000F007C117D /* Base */, 304 | ); 305 | name = LaunchScreen.storyboard; 306 | sourceTree = ""; 307 | }; 308 | /* End PBXVariantGroup section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_COMMA = YES; 323 | CLANG_WARN_CONSTANT_CONVERSION = YES; 324 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INFINITE_RECURSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 331 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 332 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 335 | CLANG_WARN_STRICT_PROTOTYPES = YES; 336 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | ENABLE_NS_ASSERTIONS = NO; 343 | ENABLE_STRICT_OBJC_MSGSEND = YES; 344 | GCC_C_LANGUAGE_STANDARD = gnu99; 345 | GCC_NO_COMMON_BLOCKS = YES; 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 353 | MTL_ENABLE_DEBUG_INFO = NO; 354 | SDKROOT = iphoneos; 355 | SUPPORTED_PLATFORMS = iphoneos; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | VALIDATE_PRODUCT = YES; 358 | }; 359 | name = Profile; 360 | }; 361 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 362 | isa = XCBuildConfiguration; 363 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | CLANG_ENABLE_MODULES = YES; 367 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 368 | ENABLE_BITCODE = NO; 369 | FRAMEWORK_SEARCH_PATHS = ( 370 | "$(inherited)", 371 | "$(PROJECT_DIR)/Flutter", 372 | ); 373 | INFOPLIST_FILE = Runner/Info.plist; 374 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 375 | LIBRARY_SEARCH_PATHS = ( 376 | "$(inherited)", 377 | "$(PROJECT_DIR)/Flutter", 378 | ); 379 | PRODUCT_BUNDLE_IDENTIFIER = com.example.themeModeHandlerExample; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 382 | SWIFT_VERSION = 5.0; 383 | VERSIONING_SYSTEM = "apple-generic"; 384 | }; 385 | name = Profile; 386 | }; 387 | 97C147031CF9000F007C117D /* Debug */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 402 | CLANG_WARN_EMPTY_BODY = YES; 403 | CLANG_WARN_ENUM_CONVERSION = YES; 404 | CLANG_WARN_INFINITE_RECURSION = YES; 405 | CLANG_WARN_INT_CONVERSION = YES; 406 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 408 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 410 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 411 | CLANG_WARN_STRICT_PROTOTYPES = YES; 412 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 413 | CLANG_WARN_UNREACHABLE_CODE = YES; 414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 415 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 416 | COPY_PHASE_STRIP = NO; 417 | DEBUG_INFORMATION_FORMAT = dwarf; 418 | ENABLE_STRICT_OBJC_MSGSEND = YES; 419 | ENABLE_TESTABILITY = YES; 420 | GCC_C_LANGUAGE_STANDARD = gnu99; 421 | GCC_DYNAMIC_NO_PIC = NO; 422 | GCC_NO_COMMON_BLOCKS = YES; 423 | GCC_OPTIMIZATION_LEVEL = 0; 424 | GCC_PREPROCESSOR_DEFINITIONS = ( 425 | "DEBUG=1", 426 | "$(inherited)", 427 | ); 428 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 429 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 430 | GCC_WARN_UNDECLARED_SELECTOR = YES; 431 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 432 | GCC_WARN_UNUSED_FUNCTION = YES; 433 | GCC_WARN_UNUSED_VARIABLE = YES; 434 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 435 | MTL_ENABLE_DEBUG_INFO = YES; 436 | ONLY_ACTIVE_ARCH = YES; 437 | SDKROOT = iphoneos; 438 | TARGETED_DEVICE_FAMILY = "1,2"; 439 | }; 440 | name = Debug; 441 | }; 442 | 97C147041CF9000F007C117D /* Release */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | ALWAYS_SEARCH_USER_PATHS = NO; 446 | CLANG_ANALYZER_NONNULL = YES; 447 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 448 | CLANG_CXX_LIBRARY = "libc++"; 449 | CLANG_ENABLE_MODULES = YES; 450 | CLANG_ENABLE_OBJC_ARC = YES; 451 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 452 | CLANG_WARN_BOOL_CONVERSION = YES; 453 | CLANG_WARN_COMMA = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 456 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 457 | CLANG_WARN_EMPTY_BODY = YES; 458 | CLANG_WARN_ENUM_CONVERSION = YES; 459 | CLANG_WARN_INFINITE_RECURSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 462 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 463 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 464 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 465 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 466 | CLANG_WARN_STRICT_PROTOTYPES = YES; 467 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 468 | CLANG_WARN_UNREACHABLE_CODE = YES; 469 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 470 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 471 | COPY_PHASE_STRIP = NO; 472 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 473 | ENABLE_NS_ASSERTIONS = NO; 474 | ENABLE_STRICT_OBJC_MSGSEND = YES; 475 | GCC_C_LANGUAGE_STANDARD = gnu99; 476 | GCC_NO_COMMON_BLOCKS = YES; 477 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 478 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 479 | GCC_WARN_UNDECLARED_SELECTOR = YES; 480 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 481 | GCC_WARN_UNUSED_FUNCTION = YES; 482 | GCC_WARN_UNUSED_VARIABLE = YES; 483 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 484 | MTL_ENABLE_DEBUG_INFO = NO; 485 | SDKROOT = iphoneos; 486 | SUPPORTED_PLATFORMS = iphoneos; 487 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 488 | TARGETED_DEVICE_FAMILY = "1,2"; 489 | VALIDATE_PRODUCT = YES; 490 | }; 491 | name = Release; 492 | }; 493 | 97C147061CF9000F007C117D /* Debug */ = { 494 | isa = XCBuildConfiguration; 495 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 496 | buildSettings = { 497 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 498 | CLANG_ENABLE_MODULES = YES; 499 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 500 | ENABLE_BITCODE = NO; 501 | FRAMEWORK_SEARCH_PATHS = ( 502 | "$(inherited)", 503 | "$(PROJECT_DIR)/Flutter", 504 | ); 505 | INFOPLIST_FILE = Runner/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 507 | LIBRARY_SEARCH_PATHS = ( 508 | "$(inherited)", 509 | "$(PROJECT_DIR)/Flutter", 510 | ); 511 | PRODUCT_BUNDLE_IDENTIFIER = com.example.themeModeHandlerExample; 512 | PRODUCT_NAME = "$(TARGET_NAME)"; 513 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 514 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 515 | SWIFT_VERSION = 5.0; 516 | VERSIONING_SYSTEM = "apple-generic"; 517 | }; 518 | name = Debug; 519 | }; 520 | 97C147071CF9000F007C117D /* Release */ = { 521 | isa = XCBuildConfiguration; 522 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 523 | buildSettings = { 524 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 525 | CLANG_ENABLE_MODULES = YES; 526 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 527 | ENABLE_BITCODE = NO; 528 | FRAMEWORK_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "$(PROJECT_DIR)/Flutter", 531 | ); 532 | INFOPLIST_FILE = Runner/Info.plist; 533 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 534 | LIBRARY_SEARCH_PATHS = ( 535 | "$(inherited)", 536 | "$(PROJECT_DIR)/Flutter", 537 | ); 538 | PRODUCT_BUNDLE_IDENTIFIER = com.example.themeModeHandlerExample; 539 | PRODUCT_NAME = "$(TARGET_NAME)"; 540 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 541 | SWIFT_VERSION = 5.0; 542 | VERSIONING_SYSTEM = "apple-generic"; 543 | }; 544 | name = Release; 545 | }; 546 | /* End XCBuildConfiguration section */ 547 | 548 | /* Begin XCConfigurationList section */ 549 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 550 | isa = XCConfigurationList; 551 | buildConfigurations = ( 552 | 97C147031CF9000F007C117D /* Debug */, 553 | 97C147041CF9000F007C117D /* Release */, 554 | 249021D3217E4FDB00AE95B9 /* Profile */, 555 | ); 556 | defaultConfigurationIsVisible = 0; 557 | defaultConfigurationName = Release; 558 | }; 559 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 97C147061CF9000F007C117D /* Debug */, 563 | 97C147071CF9000F007C117D /* Release */, 564 | 249021D4217E4FDB00AE95B9 /* Profile */, 565 | ); 566 | defaultConfigurationIsVisible = 0; 567 | defaultConfigurationName = Release; 568 | }; 569 | /* End XCConfigurationList section */ 570 | }; 571 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 572 | } 573 | --------------------------------------------------------------------------------