├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── assets
├── dialogs.png
└── theme.png
├── dynamic_theme.iml
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── yourcompany
│ │ │ │ └── example
│ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── 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
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── settings.gradle
│ └── settings_aar.gradle
├── example.iml
├── example_android.iml
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── 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-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── main.m
├── lib
│ └── main.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── widget_test.dart
├── lib
├── dynamic_theme.dart
└── theme_switcher_widgets.dart
├── pubspec.lock
├── pubspec.yaml
└── test
├── easy_theme_test.dart
└── easy_theme_test_change.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 | ios/.generated/
9 | ios/Flutter/Generated.xcconfig
10 | ios/Runner/GeneratedPluginRegistrant.*
11 |
12 | .idea/*
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # CHANGE LOG
2 |
3 | ## 1.0.1
4 |
5 | - Update local_storage dependency to latest 0.5.0
6 | - Added and fixed linter rules
7 | - Fixed default Dark mode problem from PRs
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Norbert Kozsir
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # dynamic_theme
2 | ## Dynamically changing your theme without hassle
3 |
4 | 
5 |
6 | This packages manages changing your theme during runtime and persiting that theme.
7 |
8 | ### I wrote a medium post about this, check it out [here](https://proandroiddev.com/how-to-dynamically-change-the-theme-in-flutter-698bd022d0f0)!
9 |
10 | ## Include in your project
11 | ```
12 | dependencies:
13 | dynamic_theme: ^1.0.1
14 | ```
15 | run packages get and import it
16 | ```
17 | import 'package:dynamic_theme/dynamic_theme.dart';
18 | ```
19 | if you want the dialog:
20 | ```
21 | import 'package:dynamic_theme/theme_switcher_widgets.dart';
22 | ```
23 |
24 | ## Usage
25 | Wrap your material app like this:
26 | ```dart
27 |
28 | class MyApp extends StatelessWidget {
29 | @override
30 | Widget build(BuildContext context) {
31 | return new DynamicTheme(
32 | defaultBrightness: Brightness.light,
33 | data: (brightness) => new ThemeData(
34 | primarySwatch: Colors.indigo,
35 | brightness: brightness,
36 | ),
37 | themedWidgetBuilder: (context, theme) {
38 | return new MaterialApp(
39 | title: 'Flutter Demo',
40 | theme: theme,
41 | home: new MyHomePage(title: 'Flutter Demo Home Page'),
42 | );
43 | }
44 | );
45 | }
46 | }
47 |
48 | ```
49 |
50 | Change the theme like this:
51 | ```dart
52 | void changeBrightness() {
53 | DynamicTheme.of(context).setBrightness(Theme.of(context).brightness == Brightness.dark? Brightness.light: Brightness.dark);
54 | }
55 |
56 | void changeColor() {
57 | DynamicTheme.of(context).setThemeData(new ThemeData(
58 | primaryColor: Theme.of(context).primaryColor == Colors.indigo? Colors.red: Colors.indigo
59 | ));
60 | }
61 |
62 | ```
63 |
64 | When changing the brightness with `setBrightness`, it is additionally stored in the shared preferences.
65 |
66 | ## Also included
67 |
68 | ### A dialog widget to change the brightness!
69 | 
70 |
71 | ## Getting Started
72 |
73 | For help getting started with Flutter, view our online [documentation](https://flutter.io/).
74 |
75 | For help on editing package code, view the [documentation](https://flutter.io/developing-packages/).
76 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # Specify analysis options.
2 | #
3 | # Until there are meta linter rules, each desired lint must be explicitly enabled.
4 | # See: https://github.com/dart-lang/linter/issues/288
5 | #
6 | # For a list of lints, see: http://dart-lang.github.io/linter/lints/
7 | # See the configuration guide for more
8 | # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
9 | #
10 | # There are other similar analysis options files in the flutter repos,
11 | # which should be kept in sync with this file:
12 | #
13 | # - analysis_options.yaml (this file)
14 | # - packages/flutter/lib/analysis_options_user.yaml
15 | # - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
16 | # - https://github.com/flutter/engine/blob/master/analysis_options.yaml
17 | #
18 | # This file contains the analysis options used by Flutter tools, such as IntelliJ,
19 | # Android Studio, and the `flutter analyze` command.
20 |
21 | analyzer:
22 | strong-mode:
23 | implicit-dynamic: false
24 | errors:
25 | # treat missing required parameters as a warning (not a hint)
26 | missing_required_param: warning
27 | # treat missing returns as a warning (not a hint)
28 | missing_return: warning
29 | # allow having TODOs in the code
30 | todo: ignore
31 | exclude:
32 | - 'bin/cache/**'
33 | # the following two are relative to the stocks example and the flutter package respectively
34 | # see https://github.com/dart-lang/sdk/issues/28463
35 | - 'lib/i18n/stock_messages_*.dart'
36 | - 'lib/src/http/**'
37 |
38 | linter:
39 | rules:
40 | # these rules are documented on and in the same order as
41 | # the Dart Lint rules page to make maintenance easier
42 | # https://github.com/dart-lang/linter/blob/master/example/all.yaml
43 | - always_declare_return_types
44 | - always_put_control_body_on_new_line
45 | # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
46 | - always_require_non_null_named_parameters
47 | - always_specify_types
48 | - annotate_overrides
49 | # - avoid_annotating_with_dynamic # conflicts with always_specify_types
50 | - avoid_as
51 | # - avoid_bool_literals_in_conditional_expressions # not yet tested
52 | # - avoid_catches_without_on_clauses # we do this commonly
53 | # - avoid_catching_errors # we do this commonly
54 | - avoid_classes_with_only_static_members
55 | # - avoid_double_and_int_checks # only useful when targeting JS runtime
56 | - avoid_empty_else
57 | - avoid_field_initializers_in_const_classes
58 | - avoid_function_literals_in_foreach_calls
59 | # - avoid_implementing_value_types # not yet tested
60 | - avoid_init_to_null
61 | # - avoid_js_rounded_ints # only useful when targeting JS runtime
62 | - avoid_null_checks_in_equality_operators
63 | # - avoid_positional_boolean_parameters # not yet tested
64 | # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
65 | - avoid_relative_lib_imports
66 | - avoid_renaming_method_parameters
67 | - avoid_return_types_on_setters
68 | # - avoid_returning_null # there are plenty of valid reasons to return null
69 | - avoid_returning_null_for_void
70 | # - avoid_returning_this # there are plenty of valid reasons to return this
71 | # - avoid_setters_without_getters # not yet tested
72 | # - avoid_single_cascade_in_expression_statements # not yet tested
73 | - avoid_slow_async_io
74 | - avoid_types_as_parameter_names
75 | # - avoid_types_on_closure_parameters # conflicts with always_specify_types
76 | - avoid_unused_constructor_parameters
77 | - avoid_void_async
78 | - await_only_futures
79 | - camel_case_types
80 | - cancel_subscriptions
81 | # - cascade_invocations # not yet tested
82 | # - close_sinks # not reliable enough
83 | # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
84 | # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
85 | - control_flow_in_finally
86 | # - curly_braces_in_flow_control_structures # not yet tested
87 | - directives_ordering
88 | - empty_catches
89 | - empty_constructor_bodies
90 | - empty_statements
91 | # - file_names # not yet tested
92 | - flutter_style_todos
93 | - hash_and_equals
94 | - implementation_imports
95 | # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
96 | - iterable_contains_unrelated_type
97 | # - join_return_with_assignment # not yet tested
98 | - library_names
99 | - library_prefixes
100 | # - lines_longer_than_80_chars # not yet tested
101 | - list_remove_unrelated_type
102 | # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
103 | - no_adjacent_strings_in_list
104 | - no_duplicate_case_values
105 | - non_constant_identifier_names
106 | # - null_closures # not yet tested
107 | # - omit_local_variable_types # opposite of always_specify_types
108 | # - one_member_abstracts # too many false positives
109 | # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
110 | - overridden_fields
111 | - package_api_docs
112 | - package_names
113 | - package_prefixed_library_names
114 | # - parameter_assignments # we do this commonly
115 | - prefer_adjacent_string_concatenation
116 | - prefer_asserts_in_initializer_lists
117 | - prefer_collection_literals
118 | - prefer_conditional_assignment
119 | - prefer_const_constructors
120 | - prefer_const_constructors_in_immutables
121 | - prefer_const_declarations
122 | - prefer_const_literals_to_create_immutables
123 | # - prefer_constructors_over_static_methods # not yet tested
124 | - prefer_contains
125 | - prefer_equal_for_default_values
126 | # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
127 | - prefer_final_fields
128 | - prefer_final_locals
129 | - prefer_foreach
130 | # - prefer_function_declarations_over_variables # not yet tested
131 | - prefer_generic_function_type_aliases
132 | - prefer_initializing_formals
133 | # - prefer_int_literals # not yet tested
134 | # - prefer_interpolation_to_compose_strings # not yet tested
135 | - prefer_is_empty
136 | - prefer_is_not_empty
137 | - prefer_iterable_whereType
138 | # - prefer_mixin # https://github.com/dart-lang/language/issues/32
139 | - prefer_single_quotes
140 | - prefer_typing_uninitialized_variables
141 | - prefer_void_to_null
142 | # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
143 | - recursive_getters
144 | - slash_for_doc_comments
145 | - sort_constructors_first
146 | - sort_pub_dependencies
147 | - sort_unnamed_constructors_first
148 | - test_types_in_equals
149 | - throw_in_finally
150 | # - type_annotate_public_apis # subset of always_specify_types
151 | - type_init_formals
152 | # - unawaited_futures # too many false positives
153 | - unnecessary_brace_in_string_interps
154 | - unnecessary_const
155 | - unnecessary_getters_setters
156 | # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
157 | - unnecessary_new
158 | - unnecessary_null_aware_assignments
159 | - unnecessary_null_in_if_null_operators
160 | - unnecessary_overrides
161 | - unnecessary_parenthesis
162 | - unnecessary_statements
163 | - unnecessary_this
164 | - unrelated_type_equality_checks
165 | - use_rethrow_when_possible
166 | # - use_setters_to_change_properties # not yet tested
167 | # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
168 | # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
169 | - valid_regexps
170 | # - void_checks # not yet tested
171 |
--------------------------------------------------------------------------------
/assets/dialogs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/assets/dialogs.png
--------------------------------------------------------------------------------
/assets/theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/assets/theme.png
--------------------------------------------------------------------------------
/dynamic_theme.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 | .flutter-plugins
40 | .flutter-plugins-dependencies
41 | ios/Flutter/flutter_export_environment.sh
42 |
43 | # Obfuscation related
44 | app.*.map.json
45 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 44b7e7d3f42f050a79712daab253af06e9daf530
8 | channel: beta
9 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | A new Flutter example.
4 |
5 | ## Getting Started
6 |
7 | For help getting started with Flutter, view our online
8 | [documentation](https://flutter.io/).
9 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | apply plugin: 'com.android.application'
15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
16 |
17 | android {
18 | compileSdkVersion 29
19 |
20 | lintOptions {
21 | disable 'InvalidPackage'
22 | }
23 |
24 | defaultConfig {
25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
26 | applicationId "com.yourcompany.example"
27 | minSdkVersion 16
28 | targetSdkVersion 29
29 | versionCode 1
30 | versionName "1.0"
31 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
32 | }
33 |
34 | buildTypes {
35 | release {
36 | // TODO: Add your own signing config for the release build.
37 | // Signing with the debug keys for now, so `flutter run --release` works.
38 | signingConfig signingConfigs.debug
39 | }
40 | }
41 | }
42 |
43 | flutter {
44 | source '../..'
45 | }
46 |
47 | dependencies {
48 | testImplementation 'junit:junit:4.12'
49 | androidTestImplementation 'androidx.test:runner:1.2.0'
50 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
51 | }
52 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
15 |
18 |
25 |
26 |
27 |
30 |
31 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/yourcompany/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.yourcompany.example;
2 |
3 | import io.flutter.embedding.android.FlutterActivity;
4 |
5 | public class MainActivity extends FlutterActivity {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.5.3'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/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.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/android/settings_aar.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/example/example.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/example/example_android.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | UIRequiredDeviceCapabilities
24 |
25 | arm64
26 |
27 | MinimumOSVersion
28 | 8.0
29 |
30 |
31 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/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 parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | pods_ary = []
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) { |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | pods_ary.push({:name => podname, :path => podpath});
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | }
32 | return pods_ary
33 | end
34 |
35 | target 'Runner' do
36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
37 | # referring to absolute paths on developers' machines.
38 | system('rm -rf .symlinks')
39 | system('mkdir -p .symlinks/plugins')
40 |
41 | # Flutter Pods
42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
43 | if generated_xcode_build_settings.empty?
44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
45 | end
46 | generated_xcode_build_settings.map { |p|
47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
48 | symlink = File.join('.symlinks', 'flutter')
49 | File.symlink(File.dirname(p[:path]), symlink)
50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
51 | end
52 | }
53 |
54 | # Plugin Pods
55 | plugin_pods = parse_KV_file('../.flutter-plugins')
56 | plugin_pods.map { |p|
57 | symlink = File.join('.symlinks', 'plugins', p[:name])
58 | File.symlink(p[:path], symlink)
59 | pod p[:name], :path => File.join(symlink, 'ios')
60 | }
61 | end
62 |
63 | post_install do |installer|
64 | installer.pods_project.targets.each do |target|
65 | target.build_configurations.each do |config|
66 | config.build_settings['ENABLE_BITCODE'] = 'NO'
67 | end
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
18 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
19 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
20 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
21 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
22 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
23 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXCopyFilesBuildPhase section */
27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
28 | isa = PBXCopyFilesBuildPhase;
29 | buildActionMask = 2147483647;
30 | dstPath = "";
31 | dstSubfolderSpec = 10;
32 | files = (
33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
35 | );
36 | name = "Embed Frameworks";
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXCopyFilesBuildPhase section */
40 |
41 | /* Begin PBXFileReference section */
42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
48 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
49 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
50 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
51 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
52 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
53 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
54 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
55 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
56 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
57 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
58 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
67 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | /* End PBXFrameworksBuildPhase section */
72 |
73 | /* Begin PBXGroup section */
74 | 9740EEB11CF90186004384FC /* Flutter */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
78 | 3B80C3931E831B6300D905FE /* App.framework */,
79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
80 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
81 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
82 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
84 | );
85 | name = Flutter;
86 | sourceTree = "";
87 | };
88 | 97C146E51CF9000F007C117D = {
89 | isa = PBXGroup;
90 | children = (
91 | 9740EEB11CF90186004384FC /* Flutter */,
92 | 97C146F01CF9000F007C117D /* Runner */,
93 | 97C146EF1CF9000F007C117D /* Products */,
94 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
95 | );
96 | sourceTree = "";
97 | };
98 | 97C146EF1CF9000F007C117D /* Products */ = {
99 | isa = PBXGroup;
100 | children = (
101 | 97C146EE1CF9000F007C117D /* Runner.app */,
102 | );
103 | name = Products;
104 | sourceTree = "";
105 | };
106 | 97C146F01CF9000F007C117D /* Runner */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
110 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
111 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
112 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
113 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
114 | 97C147021CF9000F007C117D /* Info.plist */,
115 | 97C146F11CF9000F007C117D /* Supporting Files */,
116 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
117 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
118 | );
119 | path = Runner;
120 | sourceTree = "";
121 | };
122 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 97C146F21CF9000F007C117D /* main.m */,
126 | );
127 | name = "Supporting Files";
128 | sourceTree = "";
129 | };
130 | /* End PBXGroup section */
131 |
132 | /* Begin PBXNativeTarget section */
133 | 97C146ED1CF9000F007C117D /* Runner */ = {
134 | isa = PBXNativeTarget;
135 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
136 | buildPhases = (
137 | 9740EEB61CF901F6004384FC /* Run Script */,
138 | 97C146EA1CF9000F007C117D /* Sources */,
139 | 97C146EB1CF9000F007C117D /* Frameworks */,
140 | 97C146EC1CF9000F007C117D /* Resources */,
141 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
142 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
143 | );
144 | buildRules = (
145 | );
146 | dependencies = (
147 | );
148 | name = Runner;
149 | productName = Runner;
150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
151 | productType = "com.apple.product-type.application";
152 | };
153 | /* End PBXNativeTarget section */
154 |
155 | /* Begin PBXProject section */
156 | 97C146E61CF9000F007C117D /* Project object */ = {
157 | isa = PBXProject;
158 | attributes = {
159 | LastUpgradeCheck = 0910;
160 | ORGANIZATIONNAME = "The Chromium Authors";
161 | TargetAttributes = {
162 | 97C146ED1CF9000F007C117D = {
163 | CreatedOnToolsVersion = 7.3.1;
164 | };
165 | };
166 | };
167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
168 | compatibilityVersion = "Xcode 3.2";
169 | developmentRegion = English;
170 | hasScannedForEncodings = 0;
171 | knownRegions = (
172 | en,
173 | Base,
174 | );
175 | mainGroup = 97C146E51CF9000F007C117D;
176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
177 | projectDirPath = "";
178 | projectRoot = "";
179 | targets = (
180 | 97C146ED1CF9000F007C117D /* Runner */,
181 | );
182 | };
183 | /* End PBXProject section */
184 |
185 | /* Begin PBXResourcesBuildPhase section */
186 | 97C146EC1CF9000F007C117D /* Resources */ = {
187 | isa = PBXResourcesBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
191 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
193 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
194 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
195 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
196 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
197 | );
198 | runOnlyForDeploymentPostprocessing = 0;
199 | };
200 | /* End PBXResourcesBuildPhase section */
201 |
202 | /* Begin PBXShellScriptBuildPhase section */
203 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
204 | isa = PBXShellScriptBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | );
208 | inputPaths = (
209 | );
210 | name = "Thin Binary";
211 | outputPaths = (
212 | );
213 | runOnlyForDeploymentPostprocessing = 0;
214 | shellPath = /bin/sh;
215 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
216 | };
217 | 9740EEB61CF901F6004384FC /* Run Script */ = {
218 | isa = PBXShellScriptBuildPhase;
219 | buildActionMask = 2147483647;
220 | files = (
221 | );
222 | inputPaths = (
223 | );
224 | name = "Run Script";
225 | outputPaths = (
226 | );
227 | runOnlyForDeploymentPostprocessing = 0;
228 | shellPath = /bin/sh;
229 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
230 | };
231 | /* End PBXShellScriptBuildPhase section */
232 |
233 | /* Begin PBXSourcesBuildPhase section */
234 | 97C146EA1CF9000F007C117D /* Sources */ = {
235 | isa = PBXSourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
239 | 97C146F31CF9000F007C117D /* main.m in Sources */,
240 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | /* End PBXSourcesBuildPhase section */
245 |
246 | /* Begin PBXVariantGroup section */
247 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
248 | isa = PBXVariantGroup;
249 | children = (
250 | 97C146FB1CF9000F007C117D /* Base */,
251 | );
252 | name = Main.storyboard;
253 | sourceTree = "";
254 | };
255 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
256 | isa = PBXVariantGroup;
257 | children = (
258 | 97C147001CF9000F007C117D /* Base */,
259 | );
260 | name = LaunchScreen.storyboard;
261 | sourceTree = "";
262 | };
263 | /* End PBXVariantGroup section */
264 |
265 | /* Begin XCBuildConfiguration section */
266 | 97C147031CF9000F007C117D /* Debug */ = {
267 | isa = XCBuildConfiguration;
268 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
269 | buildSettings = {
270 | ALWAYS_SEARCH_USER_PATHS = NO;
271 | CLANG_ANALYZER_NONNULL = YES;
272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
273 | CLANG_CXX_LIBRARY = "libc++";
274 | CLANG_ENABLE_MODULES = YES;
275 | CLANG_ENABLE_OBJC_ARC = YES;
276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
277 | CLANG_WARN_BOOL_CONVERSION = YES;
278 | CLANG_WARN_COMMA = YES;
279 | CLANG_WARN_CONSTANT_CONVERSION = YES;
280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
281 | CLANG_WARN_EMPTY_BODY = YES;
282 | CLANG_WARN_ENUM_CONVERSION = YES;
283 | CLANG_WARN_INFINITE_RECURSION = YES;
284 | CLANG_WARN_INT_CONVERSION = YES;
285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
286 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
288 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
289 | CLANG_WARN_STRICT_PROTOTYPES = YES;
290 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
291 | CLANG_WARN_UNREACHABLE_CODE = YES;
292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
294 | COPY_PHASE_STRIP = NO;
295 | DEBUG_INFORMATION_FORMAT = dwarf;
296 | ENABLE_STRICT_OBJC_MSGSEND = YES;
297 | ENABLE_TESTABILITY = YES;
298 | GCC_C_LANGUAGE_STANDARD = gnu99;
299 | GCC_DYNAMIC_NO_PIC = NO;
300 | GCC_NO_COMMON_BLOCKS = YES;
301 | GCC_OPTIMIZATION_LEVEL = 0;
302 | GCC_PREPROCESSOR_DEFINITIONS = (
303 | "DEBUG=1",
304 | "$(inherited)",
305 | );
306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
308 | GCC_WARN_UNDECLARED_SELECTOR = YES;
309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
310 | GCC_WARN_UNUSED_FUNCTION = YES;
311 | GCC_WARN_UNUSED_VARIABLE = YES;
312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
313 | MTL_ENABLE_DEBUG_INFO = YES;
314 | ONLY_ACTIVE_ARCH = YES;
315 | SDKROOT = iphoneos;
316 | TARGETED_DEVICE_FAMILY = "1,2";
317 | };
318 | name = Debug;
319 | };
320 | 97C147041CF9000F007C117D /* Release */ = {
321 | isa = XCBuildConfiguration;
322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
323 | buildSettings = {
324 | ALWAYS_SEARCH_USER_PATHS = NO;
325 | CLANG_ANALYZER_NONNULL = YES;
326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
327 | CLANG_CXX_LIBRARY = "libc++";
328 | CLANG_ENABLE_MODULES = YES;
329 | CLANG_ENABLE_OBJC_ARC = YES;
330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
331 | CLANG_WARN_BOOL_CONVERSION = YES;
332 | CLANG_WARN_COMMA = YES;
333 | CLANG_WARN_CONSTANT_CONVERSION = YES;
334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
335 | CLANG_WARN_EMPTY_BODY = YES;
336 | CLANG_WARN_ENUM_CONVERSION = YES;
337 | CLANG_WARN_INFINITE_RECURSION = YES;
338 | CLANG_WARN_INT_CONVERSION = YES;
339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
343 | CLANG_WARN_STRICT_PROTOTYPES = YES;
344 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
345 | CLANG_WARN_UNREACHABLE_CODE = YES;
346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
348 | COPY_PHASE_STRIP = NO;
349 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
350 | ENABLE_NS_ASSERTIONS = NO;
351 | ENABLE_STRICT_OBJC_MSGSEND = YES;
352 | GCC_C_LANGUAGE_STANDARD = gnu99;
353 | GCC_NO_COMMON_BLOCKS = YES;
354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
356 | GCC_WARN_UNDECLARED_SELECTOR = YES;
357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
358 | GCC_WARN_UNUSED_FUNCTION = YES;
359 | GCC_WARN_UNUSED_VARIABLE = YES;
360 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
361 | MTL_ENABLE_DEBUG_INFO = NO;
362 | SDKROOT = iphoneos;
363 | TARGETED_DEVICE_FAMILY = "1,2";
364 | VALIDATE_PRODUCT = YES;
365 | };
366 | name = Release;
367 | };
368 | 97C147061CF9000F007C117D /* Debug */ = {
369 | isa = XCBuildConfiguration;
370 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
371 | buildSettings = {
372 | ARCHS = arm64;
373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
374 | CURRENT_PROJECT_VERSION = 1;
375 | ENABLE_BITCODE = NO;
376 | FRAMEWORK_SEARCH_PATHS = (
377 | "$(inherited)",
378 | "$(PROJECT_DIR)/Flutter",
379 | );
380 | INFOPLIST_FILE = Runner/Info.plist;
381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
382 | LIBRARY_SEARCH_PATHS = (
383 | "$(inherited)",
384 | "$(PROJECT_DIR)/Flutter",
385 | );
386 | PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.example;
387 | PRODUCT_NAME = "$(TARGET_NAME)";
388 | VERSIONING_SYSTEM = "apple-generic";
389 | };
390 | name = Debug;
391 | };
392 | 97C147071CF9000F007C117D /* Release */ = {
393 | isa = XCBuildConfiguration;
394 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
395 | buildSettings = {
396 | ARCHS = arm64;
397 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
398 | CURRENT_PROJECT_VERSION = 1;
399 | ENABLE_BITCODE = NO;
400 | FRAMEWORK_SEARCH_PATHS = (
401 | "$(inherited)",
402 | "$(PROJECT_DIR)/Flutter",
403 | );
404 | INFOPLIST_FILE = Runner/Info.plist;
405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
406 | LIBRARY_SEARCH_PATHS = (
407 | "$(inherited)",
408 | "$(PROJECT_DIR)/Flutter",
409 | );
410 | PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.example;
411 | PRODUCT_NAME = "$(TARGET_NAME)";
412 | VERSIONING_SYSTEM = "apple-generic";
413 | };
414 | name = Release;
415 | };
416 | /* End XCBuildConfiguration section */
417 |
418 | /* Begin XCConfigurationList section */
419 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
420 | isa = XCConfigurationList;
421 | buildConfigurations = (
422 | 97C147031CF9000F007C117D /* Debug */,
423 | 97C147041CF9000F007C117D /* Release */,
424 | );
425 | defaultConfigurationIsVisible = 0;
426 | defaultConfigurationName = Release;
427 | };
428 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
429 | isa = XCConfigurationList;
430 | buildConfigurations = (
431 | 97C147061CF9000F007C117D /* Debug */,
432 | 97C147071CF9000F007C117D /* Release */,
433 | );
434 | defaultConfigurationIsVisible = 0;
435 | defaultConfigurationName = Release;
436 | };
437 | /* End XCConfigurationList section */
438 | };
439 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
440 | }
441 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
7 | [GeneratedPluginRegistrant registerWithRegistry:self];
8 | // Override point for customization after application launch.
9 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
10 | }
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/example/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/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/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/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Norbert515/dynamic_theme/a57c7bd3f386531f094121344f63852c441359aa/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/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 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | arm64
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char * argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:dynamic_theme/dynamic_theme.dart';
2 | import 'package:dynamic_theme/theme_switcher_widgets.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | void main() => runApp(MyApp());
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return DynamicTheme(
11 | defaultBrightness: Brightness.light,
12 | data: (Brightness brightness) => ThemeData(
13 | primarySwatch: Colors.indigo,
14 | brightness: brightness,
15 | ),
16 | loadBrightnessOnStart: true,
17 | themedWidgetBuilder: (BuildContext context, ThemeData theme) {
18 | return MaterialApp(
19 | title: 'Flutter Demo',
20 | theme: theme,
21 | home: const MyHomePage(title: 'Flutter Demo Home Page'),
22 | );
23 | },
24 | );
25 | }
26 | }
27 |
28 | class MyHomePage extends StatefulWidget {
29 | const MyHomePage({Key key, this.title}) : super(key: key);
30 | final String title;
31 |
32 | @override
33 | _MyHomePageState createState() => _MyHomePageState();
34 | }
35 |
36 | class _MyHomePageState extends State {
37 | @override
38 | Widget build(BuildContext context) {
39 | return Scaffold(
40 | appBar: AppBar(
41 | title: const Text('Easy Theme'),
42 | ),
43 | body: Center(
44 | child: Column(
45 | mainAxisAlignment: MainAxisAlignment.center,
46 | children: [
47 | ElevatedButton(
48 | onPressed: DynamicTheme.of(context).toggleBrightness,
49 | child: const Text('Toggle brightness'),
50 | ),
51 | ElevatedButton(
52 | onPressed: changeColor,
53 | child: const Text('Change color'),
54 | ),
55 | ],
56 | ),
57 | ),
58 | floatingActionButton: FloatingActionButton(
59 | onPressed: showChooser,
60 | child: const Icon(Icons.add),
61 | ),
62 | bottomNavigationBar: BottomNavigationBar(
63 | items: const [
64 | BottomNavigationBarItem(
65 | icon: Icon(Icons.insert_drive_file),
66 | label: 'Tab 1',
67 | ),
68 | BottomNavigationBarItem(
69 | icon: Icon(Icons.show_chart),
70 | label: 'Tab 2',
71 | ),
72 | ],
73 | ),
74 | );
75 | }
76 |
77 | void showChooser() {
78 | showDialog(
79 | context: context,
80 | builder: (BuildContext context) {
81 | return BrightnessSwitcherDialog(
82 | onSelectedTheme: (Brightness brightness) {
83 | DynamicTheme.of(context).setBrightness(brightness);
84 | },
85 | );
86 | },
87 | );
88 | }
89 |
90 | void changeColor() {
91 | DynamicTheme.of(context).setThemeData(
92 | ThemeData(
93 | primaryColor: Theme.of(context).primaryColor == Colors.indigo
94 | ? Colors.red
95 | : Colors.indigo,
96 | ),
97 | );
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/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: "0.1.2"
53 | dynamic_theme:
54 | dependency: "direct dev"
55 | description:
56 | path: ".."
57 | relative: true
58 | source: path
59 | version: "2.0.0-nullsafety"
60 | fake_async:
61 | dependency: transitive
62 | description:
63 | name: fake_async
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "1.2.0"
67 | ffi:
68 | dependency: transitive
69 | description:
70 | name: ffi
71 | url: "https://pub.dartlang.org"
72 | source: hosted
73 | version: "1.0.0"
74 | file:
75 | dependency: transitive
76 | description:
77 | name: file
78 | url: "https://pub.dartlang.org"
79 | source: hosted
80 | version: "6.1.0"
81 | flutter:
82 | dependency: "direct main"
83 | description: flutter
84 | source: sdk
85 | version: "0.0.0"
86 | flutter_test:
87 | dependency: "direct dev"
88 | description: flutter
89 | source: sdk
90 | version: "0.0.0"
91 | flutter_web_plugins:
92 | dependency: transitive
93 | description: flutter
94 | source: sdk
95 | version: "0.0.0"
96 | js:
97 | dependency: transitive
98 | description:
99 | name: js
100 | url: "https://pub.dartlang.org"
101 | source: hosted
102 | version: "0.6.3"
103 | matcher:
104 | dependency: transitive
105 | description:
106 | name: matcher
107 | url: "https://pub.dartlang.org"
108 | source: hosted
109 | version: "0.12.10"
110 | meta:
111 | dependency: transitive
112 | description:
113 | name: meta
114 | url: "https://pub.dartlang.org"
115 | source: hosted
116 | version: "1.3.0"
117 | path:
118 | dependency: transitive
119 | description:
120 | name: path
121 | url: "https://pub.dartlang.org"
122 | source: hosted
123 | version: "1.8.0"
124 | path_provider_linux:
125 | dependency: transitive
126 | description:
127 | name: path_provider_linux
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "2.0.0"
131 | path_provider_platform_interface:
132 | dependency: transitive
133 | description:
134 | name: path_provider_platform_interface
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "2.0.1"
138 | path_provider_windows:
139 | dependency: transitive
140 | description:
141 | name: path_provider_windows
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "2.0.0"
145 | platform:
146 | dependency: transitive
147 | description:
148 | name: platform
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "3.0.0"
152 | plugin_platform_interface:
153 | dependency: transitive
154 | description:
155 | name: plugin_platform_interface
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "2.0.0"
159 | process:
160 | dependency: transitive
161 | description:
162 | name: process
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "4.1.0"
166 | shared_preferences:
167 | dependency: transitive
168 | description:
169 | name: shared_preferences
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "2.0.5"
173 | shared_preferences_linux:
174 | dependency: transitive
175 | description:
176 | name: shared_preferences_linux
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "2.0.0"
180 | shared_preferences_macos:
181 | dependency: transitive
182 | description:
183 | name: shared_preferences_macos
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "2.0.0"
187 | shared_preferences_platform_interface:
188 | dependency: transitive
189 | description:
190 | name: shared_preferences_platform_interface
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "2.0.0"
194 | shared_preferences_web:
195 | dependency: transitive
196 | description:
197 | name: shared_preferences_web
198 | url: "https://pub.dartlang.org"
199 | source: hosted
200 | version: "2.0.0"
201 | shared_preferences_windows:
202 | dependency: transitive
203 | description:
204 | name: shared_preferences_windows
205 | url: "https://pub.dartlang.org"
206 | source: hosted
207 | version: "2.0.0"
208 | sky_engine:
209 | dependency: transitive
210 | description: flutter
211 | source: sdk
212 | version: "0.0.99"
213 | source_span:
214 | dependency: transitive
215 | description:
216 | name: source_span
217 | url: "https://pub.dartlang.org"
218 | source: hosted
219 | version: "1.8.0"
220 | stack_trace:
221 | dependency: transitive
222 | description:
223 | name: stack_trace
224 | url: "https://pub.dartlang.org"
225 | source: hosted
226 | version: "1.10.0"
227 | stream_channel:
228 | dependency: transitive
229 | description:
230 | name: stream_channel
231 | url: "https://pub.dartlang.org"
232 | source: hosted
233 | version: "2.1.0"
234 | string_scanner:
235 | dependency: transitive
236 | description:
237 | name: string_scanner
238 | url: "https://pub.dartlang.org"
239 | source: hosted
240 | version: "1.1.0"
241 | term_glyph:
242 | dependency: transitive
243 | description:
244 | name: term_glyph
245 | url: "https://pub.dartlang.org"
246 | source: hosted
247 | version: "1.2.0"
248 | test_api:
249 | dependency: transitive
250 | description:
251 | name: test_api
252 | url: "https://pub.dartlang.org"
253 | source: hosted
254 | version: "0.2.19"
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.4"
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 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter example.
3 | version: 1.0.1
4 | author: 'Norbert Kozsir '
5 | homepage: 'https://github.com/Norbert515/dynamic_theme'
6 |
7 | environment:
8 | # Works in Dart 1 (starting with 1.20.1), and works in Dart 2.
9 | sdk: '>=1.20.1 <3.0.0'
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | # The following adds the Cupertino Icons font to your application.
16 | # Use with the CupertinoIcons class for iOS style icons.
17 | cupertino_icons: ^0.1.0
18 |
19 | dev_dependencies:
20 | flutter_test:
21 | sdk: flutter
22 | dynamic_theme:
23 | path: ../
24 |
25 |
26 | # For information on the generic Dart part of this file, see the
27 | # following page: https://www.dartlang.org/tools/pub/pubspec
28 |
29 | # The following section is specific to Flutter.
30 | flutter:
31 |
32 | # The following line ensures that the Material Icons font is
33 | # included with your application, so that you can use the icons in
34 | # the material Icons class.
35 | uses-material-design: true
36 |
37 | # To add assets to your application, add an assets section, like this:
38 | # assets:
39 | # - images/a_dot_burr.jpeg
40 | # - images/a_dot_ham.jpeg
41 |
42 | # An image asset can refer to one or more resolution-specific "variants", see
43 | # https://flutter.io/assets-and-images/#resolution-aware.
44 |
45 | # For details regarding adding assets from package dependencies, see
46 | # https://flutter.io/assets-and-images/#from-packages
47 |
48 | # To add custom fonts to your application, add a fonts section here,
49 | # in this "flutter" section. Each entry in this list should have a
50 | # "family" key with the font family name, and a "fonts" key with a
51 | # list giving the asset and other descriptors for the font. For
52 | # example:
53 | # fonts:
54 | # - family: Schyler
55 | # fonts:
56 | # - asset: fonts/Schyler-Regular.ttf
57 | # - asset: fonts/Schyler-Italic.ttf
58 | # style: italic
59 | # - family: Trajan Pro
60 | # fonts:
61 | # - asset: fonts/TrajanPro.ttf
62 | # - asset: fonts/TrajanPro_Bold.ttf
63 | # weight: 700
64 | #
65 | # For details regarding fonts from package dependencies,
66 | # see https://flutter.io/custom-fonts/#from-packages
67 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties
5 | // are correct.
6 |
7 | import 'package:flutter/material.dart';
8 | import 'package:flutter_test/flutter_test.dart';
9 |
10 | import 'package:example/main.dart';
11 |
12 | void main() {
13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
14 | // Build our app and trigger a frame.
15 | await tester.pumpWidget(MyApp());
16 |
17 | // Verify that our counter starts at 0.
18 | expect(find.text('0'), findsOneWidget);
19 | expect(find.text('1'), findsNothing);
20 |
21 | // Tap the '+' icon and trigger a frame.
22 | await tester.tap(find.byIcon(Icons.add));
23 | await tester.pump();
24 |
25 | // Verify that our counter has incremented.
26 | expect(find.text('0'), findsNothing);
27 | expect(find.text('1'), findsOneWidget);
28 | });
29 | }
30 |
--------------------------------------------------------------------------------
/lib/dynamic_theme.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:shared_preferences/shared_preferences.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | typedef ThemedWidgetBuilder = Widget Function(BuildContext context, ThemeData data);
7 |
8 | typedef ThemeDataWithBrightnessBuilder = ThemeData Function(Brightness brightness);
9 |
10 | class DynamicTheme extends StatefulWidget {
11 | const DynamicTheme({
12 | Key? key,
13 | required this.data,
14 | required this.themedWidgetBuilder,
15 | this.defaultBrightness = Brightness.light,
16 | this.loadBrightnessOnStart = true,
17 | }) : super(key: key);
18 |
19 | /// Builder that gets called when the brightness or theme changes
20 | final ThemedWidgetBuilder themedWidgetBuilder;
21 |
22 | /// Callback that returns the latest brightness
23 | final ThemeDataWithBrightnessBuilder data;
24 |
25 | /// The default brightness on start
26 | ///
27 | /// Defaults to `Brightness.light`
28 | final Brightness defaultBrightness;
29 |
30 | /// Whether or not to load the brightness on start
31 | ///
32 | /// Defaults to `true`
33 | final bool loadBrightnessOnStart;
34 |
35 | @override
36 | DynamicThemeState createState() => DynamicThemeState();
37 |
38 | static DynamicThemeState? of(BuildContext context) {
39 | return context.findAncestorStateOfType();
40 | }
41 | }
42 |
43 | class DynamicThemeState extends State {
44 | late ThemeData _themeData;
45 |
46 | Brightness _brightness = Brightness.light;
47 |
48 | bool _shouldLoadBrightness = true;
49 |
50 | static const String _sharedPreferencesKey = 'isDark';
51 |
52 | /// Get the current `ThemeData`
53 | ThemeData get themeData => _themeData;
54 |
55 | /// Get the current `Brightness`
56 | Brightness get brightness => _brightness;
57 |
58 | @override
59 | void initState() {
60 | super.initState();
61 | _initVariables();
62 | _loadBrightness();
63 | }
64 |
65 | /// Loads the brightness depending on the `loadBrightnessOnStart` value
66 | Future _loadBrightness() async {
67 | if (!_shouldLoadBrightness) {
68 | return;
69 | }
70 | final bool isDark = await _getBrightnessBool();
71 | _brightness = isDark ? Brightness.dark : Brightness.light;
72 | _themeData = widget.data(_brightness);
73 | if (mounted) {
74 | setState(() {});
75 | }
76 | }
77 |
78 | /// Initializes the variables
79 | void _initVariables() {
80 | _brightness = widget.defaultBrightness;
81 | _themeData = widget.data(_brightness);
82 | _shouldLoadBrightness = widget.loadBrightnessOnStart;
83 | }
84 |
85 | @override
86 | void didChangeDependencies() {
87 | super.didChangeDependencies();
88 | _themeData = widget.data(_brightness);
89 | }
90 |
91 | @override
92 | void didUpdateWidget(DynamicTheme oldWidget) {
93 | super.didUpdateWidget(oldWidget);
94 | _themeData = widget.data(_brightness);
95 | }
96 |
97 | /// Sets the new brightness
98 | /// Rebuilds the tree
99 | Future setBrightness(Brightness brightness) async {
100 | // Update state with new values
101 | setState(() {
102 | _themeData = widget.data(brightness);
103 | _brightness = brightness;
104 | });
105 | // Save the brightness
106 | await _saveBrightness(brightness);
107 | }
108 |
109 | /// Toggles the brightness from dark to light
110 | Future toggleBrightness() async {
111 | // If brightness is dark, set it to light
112 | // If it's not dark, set it to dark
113 | if (_brightness == Brightness.dark)
114 | await setBrightness(Brightness.light);
115 | else
116 | await setBrightness(Brightness.dark);
117 | }
118 |
119 | /// Changes the theme using the provided `ThemeData`
120 | void setThemeData(ThemeData data) {
121 | setState(() {
122 | _themeData = data;
123 | });
124 | }
125 |
126 | /// Saves the provided brightness in `SharedPreferences`
127 | Future _saveBrightness(Brightness brightness) async {
128 | //! Shouldn't save the brightness if you don't want to load it
129 | if (!_shouldLoadBrightness) {
130 | return;
131 | }
132 | final SharedPreferences prefs = await SharedPreferences.getInstance();
133 | // Saves whether or not the provided brightness is dark
134 | await prefs.setBool(
135 | _sharedPreferencesKey, brightness == Brightness.dark ? true : false);
136 | }
137 |
138 | /// Returns a boolean that gives you the latest brightness
139 | Future _getBrightnessBool() async {
140 | final SharedPreferences prefs = await SharedPreferences.getInstance();
141 | // Gets the bool stored in prefs
142 | // Or returns whether or not the `defaultBrightness` is dark
143 | return prefs.getBool(_sharedPreferencesKey) ??
144 | widget.defaultBrightness == Brightness.dark;
145 | }
146 |
147 | @override
148 | Widget build(BuildContext context) {
149 | return widget.themedWidgetBuilder(context, _themeData);
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/lib/theme_switcher_widgets.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class BrightnessSwitcherDialog extends StatelessWidget {
4 | const BrightnessSwitcherDialog({Key? key, required this.onSelectedTheme})
5 | : super(key: key);
6 |
7 | final ValueChanged onSelectedTheme;
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return SimpleDialog(
12 | title: const Text('Select Theme'),
13 | children: [
14 | RadioListTile(
15 | value: Brightness.light,
16 | groupValue: Theme.of(context).brightness,
17 | onChanged: (Brightness? value) {
18 | onSelectedTheme(Brightness.light);
19 | },
20 | title: const Text('Light'),
21 | ),
22 | RadioListTile(
23 | value: Brightness.dark,
24 | groupValue: Theme.of(context).brightness,
25 | onChanged: (Brightness? value) {
26 | onSelectedTheme(Brightness.dark);
27 | },
28 | title: const Text('Spooky 👻'),
29 | ),
30 | ],
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/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 | fake_async:
47 | dependency: transitive
48 | description:
49 | name: fake_async
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "1.2.0"
53 | ffi:
54 | dependency: transitive
55 | description:
56 | name: ffi
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "1.0.0"
60 | file:
61 | dependency: transitive
62 | description:
63 | name: file
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "6.1.0"
67 | flutter:
68 | dependency: "direct main"
69 | description: flutter
70 | source: sdk
71 | version: "0.0.0"
72 | flutter_test:
73 | dependency: "direct dev"
74 | description: flutter
75 | source: sdk
76 | version: "0.0.0"
77 | flutter_web_plugins:
78 | dependency: transitive
79 | description: flutter
80 | source: sdk
81 | version: "0.0.0"
82 | js:
83 | dependency: transitive
84 | description:
85 | name: js
86 | url: "https://pub.dartlang.org"
87 | source: hosted
88 | version: "0.6.3"
89 | matcher:
90 | dependency: transitive
91 | description:
92 | name: matcher
93 | url: "https://pub.dartlang.org"
94 | source: hosted
95 | version: "0.12.10"
96 | meta:
97 | dependency: transitive
98 | description:
99 | name: meta
100 | url: "https://pub.dartlang.org"
101 | source: hosted
102 | version: "1.3.0"
103 | path:
104 | dependency: transitive
105 | description:
106 | name: path
107 | url: "https://pub.dartlang.org"
108 | source: hosted
109 | version: "1.8.0"
110 | path_provider_linux:
111 | dependency: transitive
112 | description:
113 | name: path_provider_linux
114 | url: "https://pub.dartlang.org"
115 | source: hosted
116 | version: "2.0.0"
117 | path_provider_platform_interface:
118 | dependency: transitive
119 | description:
120 | name: path_provider_platform_interface
121 | url: "https://pub.dartlang.org"
122 | source: hosted
123 | version: "2.0.1"
124 | path_provider_windows:
125 | dependency: transitive
126 | description:
127 | name: path_provider_windows
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "2.0.0"
131 | platform:
132 | dependency: transitive
133 | description:
134 | name: platform
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "3.0.0"
138 | plugin_platform_interface:
139 | dependency: transitive
140 | description:
141 | name: plugin_platform_interface
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "2.0.0"
145 | process:
146 | dependency: transitive
147 | description:
148 | name: process
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "4.1.0"
152 | shared_preferences:
153 | dependency: "direct main"
154 | description:
155 | name: shared_preferences
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "2.0.5"
159 | shared_preferences_linux:
160 | dependency: transitive
161 | description:
162 | name: shared_preferences_linux
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "2.0.0"
166 | shared_preferences_macos:
167 | dependency: transitive
168 | description:
169 | name: shared_preferences_macos
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "2.0.0"
173 | shared_preferences_platform_interface:
174 | dependency: transitive
175 | description:
176 | name: shared_preferences_platform_interface
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "2.0.0"
180 | shared_preferences_web:
181 | dependency: transitive
182 | description:
183 | name: shared_preferences_web
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "2.0.0"
187 | shared_preferences_windows:
188 | dependency: transitive
189 | description:
190 | name: shared_preferences_windows
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "2.0.0"
194 | sky_engine:
195 | dependency: transitive
196 | description: flutter
197 | source: sdk
198 | version: "0.0.99"
199 | source_span:
200 | dependency: transitive
201 | description:
202 | name: source_span
203 | url: "https://pub.dartlang.org"
204 | source: hosted
205 | version: "1.8.0"
206 | stack_trace:
207 | dependency: transitive
208 | description:
209 | name: stack_trace
210 | url: "https://pub.dartlang.org"
211 | source: hosted
212 | version: "1.10.0"
213 | stream_channel:
214 | dependency: transitive
215 | description:
216 | name: stream_channel
217 | url: "https://pub.dartlang.org"
218 | source: hosted
219 | version: "2.1.0"
220 | string_scanner:
221 | dependency: transitive
222 | description:
223 | name: string_scanner
224 | url: "https://pub.dartlang.org"
225 | source: hosted
226 | version: "1.1.0"
227 | term_glyph:
228 | dependency: transitive
229 | description:
230 | name: term_glyph
231 | url: "https://pub.dartlang.org"
232 | source: hosted
233 | version: "1.2.0"
234 | test_api:
235 | dependency: transitive
236 | description:
237 | name: test_api
238 | url: "https://pub.dartlang.org"
239 | source: hosted
240 | version: "0.2.19"
241 | typed_data:
242 | dependency: transitive
243 | description:
244 | name: typed_data
245 | url: "https://pub.dartlang.org"
246 | source: hosted
247 | version: "1.3.0"
248 | vector_math:
249 | dependency: transitive
250 | description:
251 | name: vector_math
252 | url: "https://pub.dartlang.org"
253 | source: hosted
254 | version: "2.1.0"
255 | win32:
256 | dependency: transitive
257 | description:
258 | name: win32
259 | url: "https://pub.dartlang.org"
260 | source: hosted
261 | version: "2.0.4"
262 | xdg_directories:
263 | dependency: transitive
264 | description:
265 | name: xdg_directories
266 | url: "https://pub.dartlang.org"
267 | source: hosted
268 | version: "0.2.0"
269 | sdks:
270 | dart: ">=2.12.0 <3.0.0"
271 | flutter: ">=1.20.0"
272 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: dynamic_theme
2 | description: Changes the theme during runtime, also presists brightness settings across restarts
3 | version: 2.0.0-nullsafety
4 | author: 'Norbert Kozsir '
5 | homepage: 'https://github.com/Norbert515/dynamic_theme'
6 |
7 | environment:
8 | sdk: '>=2.12.0 <3.0.0'
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 | shared_preferences: ^2.0.5
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 |
--------------------------------------------------------------------------------
/test/easy_theme_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:dynamic_theme/dynamic_theme.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_test/flutter_test.dart';
4 |
5 | ValueKey key = const ValueKey('ok');
6 | DynamicThemeState? state;
7 | GlobalKey easyThemeKey = GlobalKey();
8 |
9 | void main() {
10 | testWidgets('test finds state', (WidgetTester tester) async {
11 | await tester.pumpWidget(MyApp());
12 |
13 | expect(state, equals(null));
14 |
15 | await tester.tap(find.byKey(key));
16 | await tester.pump();
17 |
18 | expect(state, isNotNull);
19 | });
20 | }
21 |
22 | class MyApp extends StatelessWidget {
23 | @override
24 | Widget build(BuildContext context) {
25 | return DynamicTheme(
26 | key: easyThemeKey,
27 | defaultBrightness: Brightness.light,
28 | data: (Brightness brightness) {
29 | return ThemeData(
30 | primarySwatch: Colors.indigo,
31 | brightness: brightness,
32 | );
33 | },
34 | themedWidgetBuilder: (BuildContext context, ThemeData theme) {
35 | return MaterialApp(
36 | title: 'Flutter Demo',
37 | theme: theme,
38 | home: ButtonPage(),
39 | );
40 | });
41 | }
42 | }
43 |
44 | class ButtonPage extends StatelessWidget {
45 | @override
46 | Widget build(BuildContext context) {
47 | return ElevatedButton(
48 | onPressed: () {
49 | state = DynamicTheme.of(context);
50 | },
51 | key: key,
52 | child: Container(),
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/test/easy_theme_test_change.dart:
--------------------------------------------------------------------------------
1 | import 'package:dynamic_theme/dynamic_theme.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_test/flutter_test.dart';
4 |
5 | ValueKey key = const ValueKey('ok');
6 |
7 | GlobalKey easyThemeKey = GlobalKey();
8 |
9 | void main() {
10 | testWidgets('change brightness', (WidgetTester tester) async {
11 | await tester.pumpWidget(MyApp());
12 |
13 | MaterialApp app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
14 | expect(app.theme?.brightness, equals(Brightness.dark));
15 |
16 | await tester.tap(find.byKey(key));
17 | await tester.pumpAndSettle();
18 |
19 | app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
20 | expect(app.theme?.brightness, equals(Brightness.light));
21 |
22 | await tester.tap(find.byKey(key));
23 | await tester.pumpAndSettle();
24 |
25 | app = find.byType(MaterialApp).evaluate().first.widget as MaterialApp;
26 | expect(app.theme?.brightness, equals(Brightness.dark));
27 | });
28 | }
29 |
30 | class MyApp extends StatelessWidget {
31 | @override
32 | Widget build(BuildContext context) {
33 | return DynamicTheme(
34 | key: easyThemeKey,
35 | defaultBrightness: Brightness.dark,
36 | data: (Brightness brightness) {
37 | return ThemeData(
38 | primarySwatch: Colors.indigo,
39 | brightness: brightness,
40 | );
41 | },
42 | themedWidgetBuilder: (BuildContext context, ThemeData theme) {
43 | return MaterialApp(
44 | title: 'Flutter Demo',
45 | theme: theme,
46 | home: ButtonPage(),
47 | );
48 | });
49 | }
50 | }
51 |
52 | class ButtonPage extends StatelessWidget {
53 | @override
54 | Widget build(BuildContext context) {
55 | return ElevatedButton(
56 | onPressed: () {
57 | DynamicTheme.of(context)?.setBrightness(
58 | Theme.of(context).brightness == Brightness.dark
59 | ? Brightness.light
60 | : Brightness.dark);
61 | },
62 | key: key,
63 | child: Container(),
64 | );
65 | }
66 | }
67 |
--------------------------------------------------------------------------------