mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-03 02:24:30 +01:00
Move workout detail switcher to toggle buttons
This makes it more obvious that the page is part of the current workout
This commit is contained in:
@@ -34,7 +34,6 @@ enum WorkoutScreenMode {
|
||||
enum WorkoutOptions {
|
||||
edit,
|
||||
delete,
|
||||
toggleMode,
|
||||
}
|
||||
|
||||
class WorkoutPlanScreen extends StatefulWidget {
|
||||
@@ -108,22 +107,10 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
// Toggle Mode
|
||||
} else if (value == WorkoutOptions.toggleMode) {
|
||||
if (_mode == WorkoutScreenMode.workout) {
|
||||
_changeMode(WorkoutScreenMode.log);
|
||||
} else {
|
||||
_changeMode(WorkoutScreenMode.workout);
|
||||
}
|
||||
}
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
return [
|
||||
PopupMenuItem<WorkoutOptions>(
|
||||
child: _mode == WorkoutScreenMode.log
|
||||
? Text(AppLocalizations.of(context).labelWorkoutPlan)
|
||||
: Text(AppLocalizations.of(context).labelWorkoutLogs),
|
||||
value: WorkoutOptions.toggleMode,
|
||||
),
|
||||
PopupMenuItem<WorkoutOptions>(
|
||||
value: WorkoutOptions.edit,
|
||||
child: Text(AppLocalizations.of(context).edit),
|
||||
|
||||
@@ -137,9 +137,10 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(3),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 12),
|
||||
child: Card(
|
||||
margin: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
DayHeaderDismissible(
|
||||
|
||||
@@ -43,6 +43,23 @@ class _WorkoutLogsState extends State<WorkoutLogs> {
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
ToggleButtons(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.table_chart_outlined,
|
||||
),
|
||||
Icon(
|
||||
Icons.show_chart,
|
||||
),
|
||||
],
|
||||
renderBorder: false,
|
||||
onPressed: (int index) {
|
||||
if (index == 0) {
|
||||
widget._changeMode(WorkoutScreenMode.workout);
|
||||
}
|
||||
},
|
||||
isSelected: [false, true],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
@@ -64,12 +81,6 @@ class _WorkoutLogsState extends State<WorkoutLogs> {
|
||||
textAlign: TextAlign.justify,
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context).labelWorkoutPlan),
|
||||
onPressed: () {
|
||||
widget._changeMode(WorkoutScreenMode.workout);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: WorkoutLogCalendar(widget._workoutPlan),
|
||||
|
||||
@@ -38,6 +38,20 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
if (widget._workoutPlan.days.length > 0)
|
||||
ToggleButtons(
|
||||
children: <Widget>[
|
||||
Icon(Icons.table_chart_outlined),
|
||||
Icon(Icons.show_chart),
|
||||
],
|
||||
renderBorder: false,
|
||||
onPressed: (int index) {
|
||||
if (index == 1) {
|
||||
widget._changeMode(WorkoutScreenMode.log);
|
||||
}
|
||||
},
|
||||
isSelected: [true, false],
|
||||
),
|
||||
if (widget._workoutPlan.description != '')
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
@@ -60,13 +74,6 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
);
|
||||
},
|
||||
),
|
||||
if (widget._workoutPlan.days.length > 0)
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context).labelWorkoutLogs),
|
||||
onPressed: () {
|
||||
widget._changeMode(WorkoutScreenMode.log);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user