From 08bf42f0612ad4feb47b00f199145e8321341668 Mon Sep 17 00:00:00 2001 From: a-mabe Date: Wed, 29 Nov 2023 18:50:20 -0500 Subject: [PATCH 1/3] Fix status bar test color on iOS. --- lib/main.dart | 79 ++++---- lib/start_workout/view_workout.dart | 18 +- lib/start_workout/workout.dart | 293 ++++++++++++++-------------- pubspec.lock | 100 +++++----- 4 files changed, 246 insertions(+), 244 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index ff5cff09..1c728a49 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -212,46 +212,47 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - return Scaffold( - /// Pushes to [CreateWorkout()] - floatingActionButton: FloatingActionButton( - onPressed: pushSelectTimerPage, - tooltip: 'Create workout', - child: const Icon(Icons.add), - ), - appBar: AppBar( - toolbarHeight: 0, - ), - body: SafeArea( - child: Container( - padding: const EdgeInsets.all(8.0), - child: SizedBox( - height: MediaQuery.of(context).size.height * 0.882, - child: FutureBuilder( - future: workouts, - builder: (BuildContext context, AsyncSnapshot snapshot) { - /// When [workouts] has successfully loaded. - if (snapshot.hasData) { - if (snapshot.data!.isEmpty) { - return workoutEmpty(); - } else { - reorderableWorkoutList = snapshot.data; - reorderableWorkoutList.sort((a, b) => - a.workoutIndex.compareTo(b.workoutIndex)); - return workoutListView(snapshot); - } - } + return Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: SafeArea( + child: Scaffold( - /// When there was an error loading [workouts]. - else if (snapshot.hasError) { - return workoutFetchError(snapshot); - } + /// Pushes to [CreateWorkout()] + floatingActionButton: FloatingActionButton( + onPressed: pushSelectTimerPage, + tooltip: 'Create workout', + child: const Icon(Icons.add), + ), + body: Container( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.882, + child: FutureBuilder( + future: workouts, + builder: + (BuildContext context, AsyncSnapshot snapshot) { + /// When [workouts] has successfully loaded. + if (snapshot.hasData) { + if (snapshot.data!.isEmpty) { + return workoutEmpty(); + } else { + reorderableWorkoutList = snapshot.data; + reorderableWorkoutList.sort((a, b) => + a.workoutIndex.compareTo(b.workoutIndex)); + return workoutListView(snapshot); + } + } - /// While still waiting to load [workouts]. - else { - return workoutLoading(); - } - })))), - ); + /// When there was an error loading [workouts]. + else if (snapshot.hasError) { + return workoutFetchError(snapshot); + } + + /// While still waiting to load [workouts]. + else { + return workoutLoading(); + } + })))), + )); } } diff --git a/lib/start_workout/view_workout.dart b/lib/start_workout/view_workout.dart index adf88596..bd5938dd 100644 --- a/lib/start_workout/view_workout.dart +++ b/lib/start_workout/view_workout.dart @@ -132,6 +132,16 @@ class ViewWorkoutState extends State { }); } + Color iconColor() { + final darkMode = + WidgetsBinding.instance.platformDispatcher.platformBrightness; + if (darkMode == Brightness.dark) { + return Colors.white; + } else { + return Colors.black; + } + } + @override Widget build(BuildContext context) { Workout workoutArgument = @@ -164,12 +174,8 @@ class ViewWorkoutState extends State { backgroundColor: Color(workoutArgument.colorInt), actions: [ IconButton( - icon: const Icon(Icons.delete), + icon: Icon(Icons.delete, color: iconColor()), tooltip: 'Show Snackbar', - // onPressed: () async { - // await deleteList(workoutArgument, database) - // .then((value) => Navigator.pop(context)); - // }, onPressed: () { showDialog( context: context, @@ -206,7 +212,7 @@ class ViewWorkoutState extends State { }, ), IconButton( - icon: const Icon(Icons.edit), + icon: Icon(Icons.edit, color: iconColor()), onPressed: () { if (exercises.isEmpty) { pushCreateTimer(workoutArgument); diff --git a/lib/start_workout/workout.dart b/lib/start_workout/workout.dart index f31c1568..3ebd34f2 100644 --- a/lib/start_workout/workout.dart +++ b/lib/start_workout/workout.dart @@ -209,6 +209,7 @@ class CountDownTimerState extends State final GlobalKey listKey = GlobalKey(); + // ignore: unused_local_variable String backgroundColorStatus = "start"; setState(() { @@ -336,162 +337,156 @@ class CountDownTimerState extends State )); } - return Scaffold( - body: Countdown( - controller: _workoutController, - workSeconds: workoutArgument.exerciseTime, - restSeconds: workoutArgument.restTime, - workSound: workoutArgument.workSound, - restSound: workoutArgument.restSound, - endSound: workoutArgument.completeSound, - countdownSound: workoutArgument.countdownSound, - halfwaySound: workoutArgument.halfwaySound, - numberOfWorkIntervals: workoutArgument.numExercises, - onFinished: () { - WidgetsBinding.instance.addPostFrameCallback((_) { - if (intervalInfo.length == 1) { - intervalInfo.removeAt(0); - - Future.delayed(const Duration(microseconds: 500000), () { - setState(() { - doneVisible = true; - _controllerCenter.play(); - }); + return Countdown( + controller: _workoutController, + workSeconds: workoutArgument.exerciseTime, + restSeconds: workoutArgument.restTime, + workSound: workoutArgument.workSound, + restSound: workoutArgument.restSound, + endSound: workoutArgument.completeSound, + countdownSound: workoutArgument.countdownSound, + halfwaySound: workoutArgument.halfwaySound, + numberOfWorkIntervals: workoutArgument.numExercises, + onFinished: () { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (intervalInfo.length == 1) { + intervalInfo.removeAt(0); + + Future.delayed(const Duration(microseconds: 500000), () { + setState(() { + doneVisible = true; + _controllerCenter.play(); }); - } - }); - }, - build: (_, BackgroundTimerData timerData) { - backgroundColorStatus = timerData.status; - - if (timerData.status == "complete" && restart == false) { - done = true; - } else if (timerData.status == "start") { - currentWorkInterval = 0; - ListModel intervalList = ListModel( - listKey: listKey, - initialItems: listItems(exercises, workoutArgument), - removedItemBuilder: _buildRemovedItem, - ); - - int count = 0; - while (intervalInfo.length < intervalTotal) { - intervalInfo.insert(count, intervalList[count]); - count++; - } - } else { - done = false; - restart = true; + }); } + }); + }, + build: (_, BackgroundTimerData timerData) { + backgroundColorStatus = timerData.status; + + if (timerData.status == "complete" && restart == false) { + done = true; + } else if (timerData.status == "start") { + currentWorkInterval = 0; + ListModel intervalList = ListModel( + listKey: listKey, + initialItems: listItems(exercises, workoutArgument), + removedItemBuilder: _buildRemovedItem, + ); - while ((intervalInfo.length + timerData.numberOfIntervals) > - intervalTotal) { - if (intervalInfo.length > 0 && doneVisible == false) { - intervalInfo.removeAt(0); - } + int count = 0; + while (intervalInfo.length < intervalTotal) { + intervalInfo.insert(count, intervalList[count]); + count++; } + } else { + done = false; + restart = true; + } - return Scaffold( - appBar: AppBar( - toolbarHeight: 5, - backgroundColor: backgroundColor(backgroundColorStatus), - shadowColor: Colors.transparent, - ), - body: Stack(children: [ - Container( - color: backgroundColor(timerData.status), - child: Column( - children: [ - Padding( - padding: - const EdgeInsets.fromLTRB(0.0, 0.0, 15.0, 0.0), - child: Row(children: [ - IconButton( - onPressed: () { - Navigator.pop(context); - }, - icon: const Icon(size: 50.0, Icons.arrow_back), - color: Colors.white), - const Spacer(), - IconButton( - onPressed: () { - if (!timerData.paused) { - _workoutController.pause(); - } else { - _workoutController.resume(); - } - }, - icon: Icon( - size: 50.0, - timerData.paused - ? Icons.play_arrow - : Icons.pause), - color: Colors.white), - ]), - ), - Container( - alignment: Alignment.center, - child: Align( - alignment: Alignment.topCenter, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.fromLTRB( - 0.0, 20.0, 0.0, 0.0), - child: Text( - timerScreenText( - currentWorkInterval, - timerData.status, - exercises, - workoutArgument), - style: const TextStyle( - fontSize: 30, color: Colors.white), - ), + while ((intervalInfo.length + timerData.numberOfIntervals) > + intervalTotal) { + if (intervalInfo.length > 0 && doneVisible == false) { + intervalInfo.removeAt(0); + } + } + + return Container( + color: backgroundColor(timerData.status), + child: SafeArea( + child: Scaffold( + body: Stack(children: [ + Container( + color: backgroundColor(timerData.status), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0.0, 0.0, 15.0, 0.0), + child: Row(children: [ + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon(size: 50.0, Icons.arrow_back), + color: Colors.white), + const Spacer(), + IconButton( + onPressed: () { + if (!timerData.paused) { + _workoutController.pause(); + } else { + _workoutController.resume(); + } + }, + icon: Icon( + size: 50.0, + timerData.paused + ? Icons.play_arrow + : Icons.pause), + color: Colors.white), + ]), + ), + Container( + alignment: Alignment.center, + child: Align( + alignment: Alignment.topCenter, + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB( + 0.0, 20.0, 0.0, 0.0), + child: Text( + timerScreenText( + currentWorkInterval, + timerData.status, + exercises, + workoutArgument), + style: const TextStyle( + fontSize: 30, color: Colors.white), ), - Padding( - padding: const EdgeInsets.fromLTRB( - 0.0, 0.0, 0.0, 0.0), - child: Text( - timerData.currentMicroSeconds - .toString(), - style: const TextStyle( - fontSize: 160, color: Colors.white), - ), - ) - ], - ))), - ], - ), + ), + Padding( + padding: const EdgeInsets.fromLTRB( + 0.0, 0.0, 0.0, 0.0), + child: Text( + timerData.currentMicroSeconds.toString(), + style: const TextStyle( + fontSize: 160, color: Colors.white), + ), + ) + ], + ))), + ], ), - Align( - alignment: Alignment.bottomCenter, - child: FractionallySizedBox( - widthFactor: 1.0, - heightFactor: 0.5, - child: Container( - alignment: AlignmentDirectional.bottomCenter, - color: const Color.fromARGB(22, 0, 0, 0), - child: AnimatedList( - key: listKey, - initialItemCount: intervalInfo.length, - itemBuilder: (context, index, animation) { - return CardItemAnimated( - animation: animation, - item: intervalInfo[index], - fontColor: index == 0 - ? Colors.white - : const Color.fromARGB( - 153, 255, 255, 255), - fontWeight: index == 0 - ? FontWeight.bold - : FontWeight.normal, - ); - }, - )))), - complete() - ])); - }), - ); + ), + Align( + alignment: Alignment.bottomCenter, + child: FractionallySizedBox( + widthFactor: 1.0, + heightFactor: 0.5, + child: Container( + alignment: AlignmentDirectional.bottomCenter, + color: const Color.fromARGB(22, 0, 0, 0), + child: AnimatedList( + key: listKey, + initialItemCount: intervalInfo.length, + itemBuilder: (context, index, animation) { + return CardItemAnimated( + animation: animation, + item: intervalInfo[index], + fontColor: index == 0 + ? Colors.white + : const Color.fromARGB( + 153, 255, 255, 255), + fontWeight: index == 0 + ? FontWeight.bold + : FontWeight.normal, + ); + }, + )))), + complete() + ])))); + }); } Color backgroundColor(String status) { diff --git a/pubspec.lock b/pubspec.lock index 26f86338..2fa51adb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: archive - sha256: "7e0d52067d05f2e0324268097ba723b71cb41ac8a6a2b24d1edf9c536b987b03" + sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" url: "https://pub.dev" source: hosted - version: "3.4.6" + version: "3.4.9" args: dependency: transitive description: @@ -29,26 +29,26 @@ packages: dependency: "direct main" description: name: audio_session - sha256: "8a2bc5e30520e18f3fb0e366793d78057fb64cd5287862c76af0c8771f2a52ad" + sha256: "6fdf255ed3af86535c96452c33ecff1245990bb25a605bfb1958661ccc3d467f" url: "https://pub.dev" source: hosted - version: "0.1.16" + version: "0.1.18" audioplayers: dependency: "direct main" description: name: audioplayers - sha256: d9f6ca8e9b3e5af5e73d4c814404566f72698ee7ba35487bdf2baa6749e7503f + sha256: c05c6147124cd63e725e861335a8b4d57300b80e6e92cea7c145c739223bbaef url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.2.1" audioplayers_android: dependency: transitive description: name: audioplayers_android - sha256: fb01b9481f431fe04ac60f1f97ce8158383f2dc754558820592f795d81ca9d53 + sha256: b00e1a0e11365d88576320ec2d8c192bc21f1afb6c0e5995d1c57ae63156acb5 url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.3" audioplayers_darwin: dependency: transitive description: @@ -142,10 +142,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" confetti: dependency: "direct main" description: @@ -166,10 +166,10 @@ packages: dependency: "direct main" description: name: coverage - sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + sha256: ac86d3abab0f165e4b8f561280ff4e066bceaac83c424dd19f1ae2c2fcd12ca9 url: "https://pub.dev" source: hosted - version: "1.6.4" + version: "1.7.1" crypto: dependency: transitive description: @@ -190,10 +190,10 @@ packages: dependency: transitive description: name: dbus - sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.10" device_info_plus: dependency: transitive description: @@ -343,10 +343,10 @@ packages: dependency: transitive description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.2" http_parser: dependency: transitive description: @@ -391,26 +391,26 @@ packages: dependency: "direct main" description: name: just_audio - sha256: "5ed0cd723e17dfd8cd4b0253726221e67f6546841ea4553635cf895061fc335b" + sha256: b607cd1a43bac03d85c3aaee00448ff4a589ef2a77104e3d409889ff079bf823 url: "https://pub.dev" source: hosted - version: "0.9.35" + version: "0.9.36" just_audio_platform_interface: dependency: transitive description: name: just_audio_platform_interface - sha256: d8409da198bbc59426cd45d4c92fca522a2ec269b576ce29459d6d6fcaeb44df + sha256: c3dee0014248c97c91fe6299edb73dc4d6c6930a2f4f713579cd692d9e47f4a1 url: "https://pub.dev" source: hosted - version: "4.2.1" + version: "4.2.2" just_audio_web: dependency: transitive description: name: just_audio_web - sha256: ff62f733f437b25a0ff590f0e295fa5441dcb465f1edbdb33b3dea264705bc13 + sha256: "134356b0fe3d898293102b33b5fd618831ffdc72bb7a1b726140abdf22772b70" url: "https://pub.dev" source: hosted - version: "0.4.8" + version: "0.4.9" lints: dependency: transitive description: @@ -447,10 +447,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" numberpicker: dependency: "direct main" description: @@ -487,10 +487,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.1" path_provider_foundation: dependency: transitive description: @@ -527,10 +527,10 @@ packages: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.1" platform: dependency: transitive description: @@ -543,10 +543,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.7" pointycastle: dependency: transitive description: @@ -607,10 +607,10 @@ packages: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: @@ -684,18 +684,18 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" + sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.5.0+2" sqflite_common_ffi: dependency: "direct main" description: name: sqflite_common_ffi - sha256: "0d5cc1be2eb18400ac6701c31211d44164393aa75886093002ecdd947be04f93" + sha256: "35d2fce1e971707c227cc4775cc017d5eafe06c2654c3435ebd5c3ad6c170f5f" url: "https://pub.dev" source: hosted - version: "2.3.0+2" + version: "2.3.0+4" sqlite3: dependency: transitive description: @@ -708,18 +708,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -748,10 +748,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" timer_count_down: dependency: "direct main" description: @@ -796,10 +796,10 @@ packages: dependency: transitive description: name: vm_service - sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "12.0.0" + version: "13.0.0" wakelock: dependency: "direct main" description: @@ -844,10 +844,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" win32: dependency: transitive description: @@ -868,10 +868,10 @@ packages: dependency: transitive description: name: xml - sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + sha256: af5e77e9b83f2f4adc5d3f0a4ece1c7f45a2467b695c2540381bac793e34e556 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.4.2" yaml: dependency: transitive description: @@ -881,5 +881,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.0 <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" From b7cc6bd9bb2e0eabc0afb84c209e66131ebf2b04 Mon Sep 17 00:00:00 2001 From: a-mabe Date: Wed, 29 Nov 2023 18:52:12 -0500 Subject: [PATCH 2/3] Increment version --- VERSION | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 8cfbc905..8428158d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 \ No newline at end of file +1.1.2 \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 84b496ce..d0a95fd3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.1.1+13 +version: 1.1.2+14 environment: sdk: '>=2.19.6 <3.0.0' From d8131873e35d0417b0231f8eee92b2cfc410fad8 Mon Sep 17 00:00:00 2001 From: a-mabe Date: Fri, 1 Dec 2023 19:06:02 -0500 Subject: [PATCH 3/3] Set statusbar color based on current view --- ios/Runner/Info.plist | 2 +- lib/main.dart | 7 +++++++ lib/start_workout/view_workout.dart | 17 ++++++++++++++++- lib/start_workout/workout.dart | 8 ++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 2a0bc37b..67dd4892 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -56,6 +56,6 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + diff --git a/lib/main.dart b/lib/main.dart index 1c728a49..25741949 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -212,6 +212,13 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { + WidgetsBinding.instance.renderViews.first.automaticSystemUiAdjustment = + false; + + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + statusBarBrightness: Theme.of(context).brightness, + )); + return Container( color: Theme.of(context).scaffoldBackgroundColor, child: SafeArea( diff --git a/lib/start_workout/view_workout.dart b/lib/start_workout/view_workout.dart index bd5938dd..83c28041 100644 --- a/lib/start_workout/view_workout.dart +++ b/lib/start_workout/view_workout.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:sqflite/sqflite.dart'; import '../create_workout/create_timer.dart'; import '../create_workout/create_workout.dart'; @@ -144,6 +145,13 @@ class ViewWorkoutState extends State { @override Widget build(BuildContext context) { + WidgetsBinding.instance.renderViews.first.automaticSystemUiAdjustment = + false; + + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + statusBarBrightness: Theme.of(context).brightness, + )); + Workout workoutArgument = ModalRoute.of(context)!.settings.arguments as Workout; @@ -238,7 +246,14 @@ class ViewWorkoutState extends State { arguments: workoutArgument, ), ), - ); + ).then((value) { + WidgetsBinding.instance.renderViews.first + .automaticSystemUiAdjustment = false; + + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + statusBarBrightness: Theme.of(context).brightness, + )); + }); }, child: Ink( height: 80.0, diff --git a/lib/start_workout/workout.dart b/lib/start_workout/workout.dart index 3ebd34f2..d875cd15 100644 --- a/lib/start_workout/workout.dart +++ b/lib/start_workout/workout.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:wakelock/wakelock.dart'; import 'package:background_timer/background_timer_controller.dart'; import 'package:audio_session/audio_session.dart'; @@ -200,6 +201,13 @@ class CountDownTimerState extends State @override Widget build(BuildContext context) { + WidgetsBinding.instance.renderViews.first.automaticSystemUiAdjustment = + false; + + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + statusBarBrightness: Brightness.dark, + )); + Workout workoutArgument = ModalRoute.of(context)!.settings.arguments as Workout;