Skip to content

Commit

Permalink
Merge pull request #117 from a-mabe/fix-landscape-workout-screen
Browse files Browse the repository at this point in the history
UI improvements for landscape device orientation
  • Loading branch information
a-mabe authored Dec 21, 2023
2 parents df1002c + 15b3934 commit 8e63afa
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 52 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
15 changes: 11 additions & 4 deletions lib/card_widgets/card_item_animated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ class CardItemAnimated extends StatelessWidget {
final ListTileModel item;
final bool selected;

double calcPadding(context) {
return MediaQuery.of(context).orientation == Orientation.portrait ? 15 : 5;
}

@override
Widget build(BuildContext context) {
double height = 50;
double height = 20;
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(-1, 0),
Expand Down Expand Up @@ -52,7 +56,8 @@ class CardItemAnimated extends StatelessWidget {
Expanded(
flex: 20,
child: Padding(
padding: const EdgeInsets.fromLTRB(10.0, 20.0, 8.0, 20.0),
padding: EdgeInsets.fromLTRB(10.0, calcPadding(context),
8.0, calcPadding(context)),
child: AutoSizeText(
item.intervalString().isEmpty
? " "
Expand All @@ -65,7 +70,8 @@ class CardItemAnimated extends StatelessWidget {
Expanded(
flex: 60,
child: Padding(
padding: const EdgeInsets.fromLTRB(8.0, 20.0, 8.0, 20.0),
padding: EdgeInsets.fromLTRB(
8.0, calcPadding(context), 8.0, calcPadding(context)),
child: AutoSizeText(
item.action.padRight(50, " "),
maxLines: 2,
Expand All @@ -76,7 +82,8 @@ class CardItemAnimated extends StatelessWidget {
Expanded(
flex: 20,
child: Padding(
padding: const EdgeInsets.fromLTRB(8.0, 20.0, 10.0, 20.0),
padding: EdgeInsets.fromLTRB(
8.0, calcPadding(context), 10.0, calcPadding(context)),
child: AutoSizeText(
item.timeString(),
maxLines: 1,
Expand Down
62 changes: 26 additions & 36 deletions lib/start_workout/workout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,6 @@ class CountDownTimerState extends State<CountDownTimer>
WidgetsBinding.instance.renderViews.first.automaticSystemUiAdjustment =
false;

SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarBrightness: Brightness.dark,
));

Workout workoutArgument =
ModalRoute.of(context)!.settings.arguments as Workout;

Expand Down Expand Up @@ -377,6 +373,10 @@ class CountDownTimerState extends State<CountDownTimer>
});
},
build: (_, BackgroundTimerData timerData) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarBrightness: Brightness.dark,
));

backgroundColorStatus = timerData.status;

if (timerData.status == "complete" && restart == false) {
Expand Down Expand Up @@ -423,16 +423,6 @@ class CountDownTimerState extends State<CountDownTimer>
child: Padding(
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Row(children: [
// IconButton(
// padding: EdgeInsets.zero,
// constraints: const BoxConstraints(
// minHeight: 400, minWidth: 80),
// onPressed: () {
// Navigator.pop(context);
// },
// icon:
// const Icon(size: 50.0, Icons.arrow_back),
// color: Colors.white),
GestureDetector(
onTap: () {
Navigator.pop(context);
Expand All @@ -443,15 +433,23 @@ class CountDownTimerState extends State<CountDownTimer>
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(40),
color: const Color.fromARGB(
70, 0, 0, 0)),
color: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? const Color.fromARGB(
70, 0, 0, 0)
: Colors.transparent),
// color: Colors.purple,
width: 50,
height: 50,
child: Icon(
color: Colors.white,
Icons.arrow_back,
size: 50,
size: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? 50
: 30,
),
)),
),
Expand All @@ -470,7 +468,12 @@ class CountDownTimerState extends State<CountDownTimer>
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(40),
color: Color.fromARGB(70, 0, 0, 0)),
color: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? const Color.fromARGB(
70, 0, 0, 0)
: Colors.transparent),
// color: Colors.purple,
width: 50,
height: 50,
Expand All @@ -479,27 +482,14 @@ class CountDownTimerState extends State<CountDownTimer>
timerData.paused
? Icons.play_arrow
: Icons.pause,
size: 50,
size: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? 50
: 30,
),
)),
)
// IconButton(
// padding: EdgeInsets.all(0),
// constraints: const BoxConstraints(
// minHeight: 300, minWidth: 80),
// onPressed: () {
// if (!timerData.paused) {
// _workoutController.pause();
// } else {
// _workoutController.resume();
// }
// },
// icon: Icon(
// size: 40.0,
// timerData.paused
// ? Icons.play_arrow
// : Icons.pause),
// color: Colors.white),
]),
)),
Expanded(
Expand Down
24 changes: 16 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
url: "https://pub.dev"
source: hosted
version: "2.0.3"
version: "3.0.1"
flutter_local_notifications:
dependency: transitive
description:
Expand Down Expand Up @@ -431,10 +431,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "3.0.0"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -688,6 +688,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
sqflite:
dependency: "direct main"
description:
Expand Down Expand Up @@ -716,10 +724,10 @@ packages:
dependency: transitive
description:
name: sqlite3
sha256: "8922805564b78eb7aa9386c10056d377a541ac7270dc6a1589176277ebb4d15d"
sha256: c4a4c5a4b2a32e2d0f6837b33d7c91a67903891a5b7dbe706cf4b1f6b0c798c5
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.3.0"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -796,10 +804,10 @@ packages:
dependency: "direct main"
description:
name: uuid
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f"
url: "https://pub.dev"
source: hosted
version: "3.0.7"
version: "4.2.2"
vector_math:
dependency: transitive
description:
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0+15
version: 1.2.1+16

environment:
sdk: '>=2.19.6 <3.0.0'
Expand All @@ -39,7 +39,7 @@ dependencies:
cupertino_icons: ^1.0.2
numberpicker: ^2.1.2
sqflite: ^2.2.8+2
uuid: ^3.0.7
uuid: ^4.2.2
timer_count_down: ^2.2.2
audioplayers: ^5.1.0
confetti: ^0.7.0
Expand Down Expand Up @@ -89,7 +89,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
flutter_lints: ^3.0.1

# background_timer:
# git:
Expand Down

0 comments on commit 8e63afa

Please sign in to comment.