Skip to content

Commit

Permalink
fix: replace deprecated properties and update example app (#11)
Browse files Browse the repository at this point in the history
* fix: update dependencies
* fix: use platformDispatcher instead of deprecated window
* fix: update example app
  • Loading branch information
ferrarafer committed Jul 4, 2023
1 parent f897064 commit cacc395
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 54 deletions.
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
27 changes: 14 additions & 13 deletions example/ios/Podfile.lock
@@ -1,28 +1,29 @@
PODS:
- Flutter (1.0.0)
- flutter_statusbarcolor (0.0.1):
- flutter_statusbarcolor_ns (0.0.1):
- Flutter
- shared_preferences (0.0.1):
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_statusbarcolor (from `.symlinks/plugins/flutter_statusbarcolor/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- flutter_statusbarcolor_ns (from `.symlinks/plugins/flutter_statusbarcolor_ns/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_statusbarcolor:
:path: ".symlinks/plugins/flutter_statusbarcolor/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
flutter_statusbarcolor_ns:
:path: ".symlinks/plugins/flutter_statusbarcolor_ns/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"

SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_statusbarcolor: 8afb1071ed8c58be929f1e32b36c629771fd2259
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_statusbarcolor_ns: 68a360889d88d7915ae524e422aeab62e4063804
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.9.3
COCOAPODS: 1.11.3
41 changes: 24 additions & 17 deletions example/ios/Runner.xcodeproj/project.pbxproj
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -164,7 +164,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -208,10 +208,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down Expand Up @@ -244,6 +246,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -261,17 +264,12 @@
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/flutter_statusbarcolor/flutter_statusbarcolor.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_statusbarcolor.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -353,7 +351,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -375,7 +373,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down Expand Up @@ -435,7 +436,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -484,7 +485,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -507,7 +508,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand All @@ -534,7 +538,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner/Info.plist
Expand Up @@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
18 changes: 9 additions & 9 deletions example/lib/main.dart
Expand Up @@ -17,21 +17,21 @@ class MyApp extends StatelessWidget {
darkTheme: ThemeData(
brightness: Brightness.dark,
colorScheme: ColorScheme.fromSwatch().copyWith(
secondary: Colors.yellow[700], // Your accent color
background: Colors.blue[700],
brightness: Brightness.dark,
secondary: Colors.yellow[700],
),
),
lightTheme: ThemeData(
brightness: Brightness.light,
colorScheme: ColorScheme.fromSwatch()
.copyWith(
secondary: Colors.yellow[300], // Your accent color
)
.copyWith(background: Colors.blue[300]),
colorScheme: ColorScheme.fromSwatch().copyWith(
background: Colors.blue[300],
brightness: Brightness.light,
secondary: Colors.yellow[300],
),
),
statusBarColorBuilder: (theme) => theme.colorScheme.secondary,
navigationBarColorBuilder: (theme) => theme.colorScheme.secondary,
// themes: getThemes(),
statusBarColorBuilder: (theme) => theme?.colorScheme.secondary,
navigationBarColorBuilder: (theme) => theme?.colorScheme.secondary,
builder: (context, regularTheme, darkTheme, themeMode) => MaterialApp(
title: 'Flutter Demo',
theme: regularTheme,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/ui/dark_light/dark_light_view.dart
Expand Up @@ -5,7 +5,7 @@ import 'package:stacked_themes/stacked_themes.dart';
import 'dark_light_viewmodel.dart';

class DarkLightView extends StatelessWidget {
const DarkLightView({Key key}) : super(key: key);
const DarkLightView({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/ui/multiple_themes/multiple_themes_view.dart
Expand Up @@ -4,7 +4,7 @@ import 'package:stacked/stacked.dart';
import 'multiple_themes_viewmodel.dart';

class MultipleThemesView extends StatelessWidget {
const MultipleThemesView({Key key}) : super(key: key);
const MultipleThemesView({super.key});

@override
Widget build(BuildContext context) {
Expand Down
Expand Up @@ -6,7 +6,7 @@ class ThemeModel {
final int index;
final String title;

ThemeModel({this.index, this.title});
ThemeModel({required this.index, required this.title});
}

class MultipleThemesViewModel extends BaseViewModel {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Expand Up @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=2.19.0 <3.0.0"

dependencies:
flutter:
Expand Down
10 changes: 6 additions & 4 deletions lib/src/theme_manager.dart
Expand Up @@ -118,8 +118,9 @@ You can supply either a list of ThemeData objects to the themes property or a li
}

if (_selectedThemeMode == ThemeMode.system) {
final brightness =
ambiguate(SchedulerBinding.instance)!.window.platformBrightness;
final brightness = ambiguate(SchedulerBinding.instance)!
.platformDispatcher
.platformBrightness;
selectedTheme = brightness == Brightness.dark ? darkTheme : lightTheme;
} else {
selectedTheme =
Expand Down Expand Up @@ -223,8 +224,9 @@ You can supply either a list of ThemeData objects to the themes property or a li
updateOverlayColors(
_selectedThemeMode == ThemeMode.dark ? darkTheme : lightTheme);
} else {
var currentBrightness =
ambiguate(SchedulerBinding.instance)!.window.platformBrightness;
var currentBrightness = ambiguate(SchedulerBinding.instance)!
.platformDispatcher
.platformBrightness;
updateOverlayColors(
currentBrightness == Brightness.dark ? darkTheme : lightTheme);
}
Expand Down
5 changes: 2 additions & 3 deletions pubspec.yaml
Expand Up @@ -6,20 +6,19 @@ repository: https://github.com/Stacked-Org/themes.git
issue_tracker: https://github.com/Stacked-Org/framework/issues

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=2.19.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

stacked_shared: ^1.3.2
stacked_shared:
provider: ^6.0.0
rxdart: ^0.27.1
shared_preferences: ^2.0.6
get_it: ^7.1.3
flutter_statusbarcolor_ns: ^0.5.0

#universal_io
universal_io: ^2.0.4

# dependency_overrides:
Expand Down

0 comments on commit cacc395

Please sign in to comment.