mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 09:42:50 +01:00
Show special tile indicating end of the week
This commit is contained in:
@@ -208,6 +208,7 @@
|
||||
"restDay": "Rest day",
|
||||
"isRestDay": "Is rest day",
|
||||
"isRestDayHelp": "Please note that all sets and exercises will be removed when you mark a day as a rest day.",
|
||||
"tillEndOfWeek": "Till end of the week",
|
||||
"needsLogsToAdvance": "Needs logs to advance",
|
||||
"needsLogsToAdvanceHelp": "Select if you want the routine to progress to the next scheduled day only if you've logged a workout for the day",
|
||||
"routineDays": "Days in routine",
|
||||
|
||||
@@ -384,6 +384,10 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
|
||||
}
|
||||
|
||||
for (final dayData in _routine!.dayDataCurrentIteration) {
|
||||
if (dayData.day == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
out.add(SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
@@ -456,6 +460,22 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
|
||||
out.add(const Divider());
|
||||
}
|
||||
|
||||
if (_routine!.fitInWeek) {
|
||||
out.add(Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).tillEndOfWeek,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const Icon(Icons.hotel),
|
||||
],
|
||||
));
|
||||
out.add(const Divider());
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ class DayHeader extends StatelessWidget {
|
||||
|
||||
if (_dayData.day == null || _dayData.day!.isRest) {
|
||||
return ListTile(
|
||||
// tileColor: Colors.amber,
|
||||
tileColor: Theme.of(context).focusColor,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(
|
||||
@@ -165,12 +164,12 @@ class DayHeader extends StatelessWidget {
|
||||
trailing: _dayData.date.isSameDayAs(DateTime.now()) ? const Icon(Icons.today) : null,
|
||||
minLeadingWidth: 8,
|
||||
onTap: () {
|
||||
_viewMode
|
||||
? null
|
||||
: Navigator.of(context).pushNamed(
|
||||
GymModeScreen.routeName,
|
||||
arguments: GymModeArguments(_routineId, _dayData.day!.id!, _dayData.iteration),
|
||||
);
|
||||
if (!_viewMode) {
|
||||
Navigator.of(context).pushNamed(
|
||||
GymModeScreen.routeName,
|
||||
arguments: GymModeArguments(_routineId, _dayData.day!.id!, _dayData.iteration),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,10 +50,26 @@ class RoutineDetail extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
..._routine.dayDataCurrentIteration
|
||||
// TODO: we should probably add a block at the end of the days telling
|
||||
// the user that there are no more days in the routine till next week
|
||||
// .where((dayData) => dayData.day != null)
|
||||
.where((dayData) => dayData.day != null)
|
||||
.map((dayData) => RoutineDayWidget(dayData, _routine.id!, viewMode)),
|
||||
if (_routine.fitInWeek)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 12),
|
||||
child: Card(
|
||||
margin: EdgeInsets.zero,
|
||||
child: ListTile(
|
||||
tileColor: Theme.of(context).focusColor,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(
|
||||
i18n.tillEndOfWeek,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
leading: const Icon(Icons.hotel),
|
||||
minLeadingWidth: 8,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user