diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index 4cbcfc1..334ce10 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_statusbar_manager","path":"/Users/mendieta/Projects/flutter_statusbar_manager/","dependencies":[]}],"android":[{"name":"flutter_statusbar_manager","path":"/Users/mendieta/Projects/flutter_statusbar_manager/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_statusbar_manager","dependencies":[]}],"date_created":"2020-08-27 12:17:36.551472","version":"1.20.2"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_statusbar_manager","path":"/Users/charley/flutter_statusbar_manager/","dependencies":[]}],"android":[{"name":"flutter_statusbar_manager","path":"/Users/charley/flutter_statusbar_manager/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_statusbar_manager","dependencies":[]}],"date_created":"2021-05-28 16:58:20.875849","version":"2.2.0"} \ No newline at end of file diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 2dd17c9..4ccc84b 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,15 +1,15 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/mendieta/SDKs/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/mendieta/Projects/flutter_statusbar_manager/example" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_ROOT=/Users/jsb-hejiamin/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/charley/flutter_statusbar_manager/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=/Users/charley/flutter_statusbar_manager/example/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "OTHER_LDFLAGS=$(inherited) -framework Flutter" -export "FLUTTER_FRAMEWORK_DIR=/Users/mendieta/SDKs/flutter/bin/cache/artifacts/engine/ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=/Users/charley/flutter_statusbar_manager/example/.dart_tool/package_config.json" diff --git a/example/ios/Podfile b/example/ios/Podfile index 7c6cb6f..f7d6a5e 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -4,60 +4,35 @@ # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + target 'Runner' do - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - - # Flutter Pods - generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." - end - generated_xcode_build_settings.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join('.symlinks', 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) - end - } - - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join('.symlinks', 'plugins', p[:name]) - File.symlink(p[:path], symlink) - pod p[:name], :path => File.join(symlink, 'ios') - } + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index def1653..85f1b16 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -4,19 +4,19 @@ PODS: - Flutter DEPENDENCIES: - - Flutter (from `.symlinks/flutter/ios`) + - Flutter (from `Flutter`) - flutter_statusbar_manager (from `.symlinks/plugins/flutter_statusbar_manager/ios`) EXTERNAL SOURCES: Flutter: - :path: ".symlinks/flutter/ios" + :path: Flutter flutter_statusbar_manager: :path: ".symlinks/plugins/flutter_statusbar_manager/ios" SPEC CHECKSUMS: - Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 - flutter_statusbar_manager: eb7538441baef19aa0899dc64565bc5befb1e7e1 + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + flutter_statusbar_manager: 18588ba7dce7a28a538363d2a9989f9ede4a6710 -PODFILE CHECKSUM: 1e5af4103afd21ca5ead147d7b81d06f494f51a2 +PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d -COCOAPODS: 1.5.3 +COCOAPODS: 1.10.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index a0ef84c..4b12880 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -8,13 +8,8 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 8E41749246AAE59C3CFD1E53 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B041264B5BC64CD4260CE3E7 /* libPods-Runner.a */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; @@ -31,8 +26,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -42,15 +35,14 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 58274BDE506F3EEC612542C9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 840617DB0DD7669028D14FBA /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -65,8 +57,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 8E41749246AAE59C3CFD1E53 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -85,6 +75,8 @@ 1FB5CCA5294106232327D15B /* Pods */ = { isa = PBXGroup; children = ( + 58274BDE506F3EEC612542C9 /* Pods-Runner.debug.xcconfig */, + 840617DB0DD7669028D14FBA /* Pods-Runner.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -92,10 +84,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -160,7 +149,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - FA747287C2A3FD77E2130675 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -213,7 +201,6 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -251,7 +238,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -267,24 +254,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - FA747287C2A3FD77E2130675 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -322,7 +291,6 @@ /* Begin XCBuildConfiguration section */ 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -376,7 +344,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/example/lib/main.dart b/example/lib/main.dart index 909ea02..d3df8b6 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -19,20 +19,20 @@ class MyApp extends StatefulWidget { } class _MyAppState extends State { - double _statusBarHeight = 0.0; - bool _statusBarColorAnimated = false; - Color _statusBarColor = Colors.black; + double? _statusBarHeight = 0.0; + bool? _statusBarColorAnimated = false; + Color? _statusBarColor = Colors.black; double _statusBarOpacity = 1.0; bool _statusBarHidden = false; - StatusBarAnimation _statusBarAnimation = StatusBarAnimation.NONE; - StatusBarStyle _statusBarStyle = StatusBarStyle.DEFAULT; + StatusBarAnimation? _statusBarAnimation = StatusBarAnimation.NONE; + StatusBarStyle? _statusBarStyle = StatusBarStyle.DEFAULT; bool _statusBarTranslucent = false; bool _loadingIndicator = false; bool _fullscreenMode = false; bool _navBarColorAnimated = false; - Color _navBarColor = Colors.black; - NavigationBarStyle _navBarStyle = NavigationBarStyle.DEFAULT; + Color? _navBarColor = Colors.black; + NavigationBarStyle? _navBarStyle = NavigationBarStyle.DEFAULT; @override void initState() { @@ -42,7 +42,7 @@ class _MyAppState extends State { // Platform messages are asynchronous, so we initialize in an async method. Future initPlatformState() async { - double statusBarHeight; + double? statusBarHeight; // Platform messages may fail, so we use a try/catch PlatformException. try { statusBarHeight = await FlutterStatusbarManager.getHeight; @@ -61,7 +61,7 @@ class _MyAppState extends State { return Text(text, style: textStyle); } - void colorBarChanged(Color val) { + void colorBarChanged(Color? val) { this.setState(() { _statusBarColor = val; }); @@ -69,25 +69,30 @@ class _MyAppState extends State { } void updateStatusBar() { + Color statusBarColor = + _statusBarColor == null ? Colors.black : _statusBarColor!; FlutterStatusbarManager.setColor( - _statusBarColor.withOpacity(_statusBarOpacity), - animated: _statusBarColorAnimated); + statusBarColor.withOpacity(_statusBarOpacity), + animated: _statusBarColorAnimated ?? false); } - void statusBarAnimationChanged(StatusBarAnimation val) { + void statusBarAnimationChanged(StatusBarAnimation? val) { this.setState(() { _statusBarAnimation = val; }); } - void statusBarStyleChanged(StatusBarStyle val) { + void statusBarStyleChanged(StatusBarStyle? val) { + if (val == null) { + return; + } this.setState(() { _statusBarStyle = val; }); FlutterStatusbarManager.setStyle(val); } - void colorNavBarChanged(Color val) { + void colorNavBarChanged(Color? val) { this.setState(() { _navBarColor = val; }); @@ -95,11 +100,14 @@ class _MyAppState extends State { } void updateNavBar() { - FlutterStatusbarManager.setNavigationBarColor(_navBarColor, + FlutterStatusbarManager.setNavigationBarColor(_navBarColor ?? Colors.black, animated: _navBarColorAnimated); } - void navigationBarStyleChanged(NavigationBarStyle val) { + void navigationBarStyleChanged(NavigationBarStyle? val) { + if (val == null) { + return; + } this.setState(() { _navBarStyle = val; }); @@ -122,9 +130,9 @@ class _MyAppState extends State { Divider(height: 25.0), renderTitle("Status Bar Color:"), SwitchListTile( - value: _statusBarColorAnimated, + value: _statusBarColorAnimated ?? false, title: new Text("Animated:"), - onChanged: (bool value) { + onChanged: (bool? value) { this.setState(() { _statusBarColorAnimated = value; }); @@ -132,11 +140,12 @@ class _MyAppState extends State { ), Text("Color:"), RadioListTile( - value: Colors.black, - title: Text("Black"), - onChanged: colorBarChanged, - dense: true, - groupValue: _statusBarColor), + value: Colors.black, + title: Text("Black"), + onChanged: colorBarChanged, + dense: true, + groupValue: _statusBarColor, + ), RadioListTile( value: Colors.orange, title: Text("Orange"), @@ -177,7 +186,8 @@ class _MyAppState extends State { _statusBarHidden = val; }); FlutterStatusbarManager.setHidden(_statusBarHidden, - animation: _statusBarAnimation); + animation: + _statusBarAnimation ?? StatusBarAnimation.NONE); }, ), Text("Animation:"), @@ -228,8 +238,8 @@ class _MyAppState extends State { this.setState(() { _statusBarTranslucent = val; }); - FlutterStatusbarManager - .setTranslucent(_statusBarTranslucent); + FlutterStatusbarManager.setTranslucent( + _statusBarTranslucent); }, ), Divider(height: 25.0), @@ -241,8 +251,8 @@ class _MyAppState extends State { this.setState(() { _loadingIndicator = val; }); - FlutterStatusbarManager - .setNetworkActivityIndicatorVisible(_loadingIndicator); + FlutterStatusbarManager.setNetworkActivityIndicatorVisible( + _loadingIndicator); }, ), Divider(height: 25.0), diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c172632..360d5f9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,9 @@ name: flutter_statusbar_manager_example description: Demonstrates how to use the flutter_statusbar_manager plugin. +environment: + sdk: ">=2.12.0 <3.0.0" + dependencies: flutter: sdk: flutter diff --git a/lib/flutter_statusbar_manager.dart b/lib/flutter_statusbar_manager.dart index f3b87a8..af6ac89 100644 --- a/lib/flutter_statusbar_manager.dart +++ b/lib/flutter_statusbar_manager.dart @@ -69,17 +69,17 @@ class FlutterStatusbarManager { static const MethodChannel _channel = const MethodChannel('flutter_statusbar_manager'); - static Future setColor(Color color, {bool animated = false}) async { + static Future setColor(Color color, {bool animated = false}) async { return await _channel .invokeMethod("setColor", {'color': color.value, 'animated': animated}); } - static Future setTranslucent(bool translucent) async { + static Future setTranslucent(bool translucent) async { return await _channel .invokeMethod("setTranslucent", {'translucent': translucent}); } - static Future setHidden(bool hidden, + static Future setHidden(bool hidden, {StatusBarAnimation animation = StatusBarAnimation.NONE}) async { return await _channel.invokeMethod("setHidden", { 'hidden': hidden, @@ -87,28 +87,28 @@ class FlutterStatusbarManager { }); } - static Future setStyle(StatusBarStyle style) async { + static Future setStyle(StatusBarStyle style) async { return await _channel .invokeMethod("setStyle", {'style': _StatusBarStyle.getStyle(style)}); } - static Future setNetworkActivityIndicatorVisible(bool visible) async { + static Future setNetworkActivityIndicatorVisible(bool visible) async { return await _channel.invokeMethod( "setNetworkActivityIndicatorVisible", {'visible': visible}); } - static Future setNavigationBarColor(Color color, + static Future setNavigationBarColor(Color color, {bool animated = false}) async { return await _channel.invokeMethod( "setNavigationBarColor", {'color': color.value, 'animated': animated}); } - static Future setNavigationBarStyle(NavigationBarStyle style) async { + static Future setNavigationBarStyle(NavigationBarStyle style) async { return await _channel.invokeMethod("setNavigationBarStyle", {'style': _NavigationBarStyle.getStyle(style)}); } - static Future get getHeight async { + static Future get getHeight async { return await _channel.invokeMethod("getHeight"); } diff --git a/pubspec.yaml b/pubspec.yaml index ee30e55..f4e1cc3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_statusbar_manager description: Flutter Statusbar Manager, lets you control the status bar color, style (theme), visibility, and translucent properties across iOS and Android. -version: 2.0.0 +version: 3.0.0 homepage: https://github.com/FooStudio/flutter_statusbar_manager dependencies: @@ -8,7 +8,7 @@ dependencies: sdk: flutter environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' flutter: ">=1.12.0 <2.0.0" dev_dependencies: