More work with workout and nutritional plans detail page

This commit is contained in:
Roland Geider
2021-03-17 00:13:26 +01:00
parent 9397b90870
commit 0cc240bebc
4 changed files with 71 additions and 50 deletions

View File

@@ -24,6 +24,7 @@ const Color wgerPrimaryButtonColor = Color(0xff266dd3);
const Color wgerPrimaryColorLight = Color(0xff94B2DB);
const Color wgerSecondaryColor = Color(0xffe63946);
const Color wgerTextMuted = Colors.black38;
const Color wgerBackground = Color(0xfff4f4f6);
// Chart colors
const charts.Color wgerChartPrimaryColor = charts.Color(r: 0x2a, g: 0x4c, b: 0x7d);
@@ -35,6 +36,7 @@ final ThemeData wgerTheme = ThemeData(
*/
primaryColor: wgerPrimaryColor,
accentColor: wgerSecondaryColor,
scaffoldBackgroundColor: wgerBackground,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and

View File

@@ -169,22 +169,27 @@ class DismissibleMealHeader extends StatelessWidget {
child: Dismissible(
key: Key(_meal.id.toString()),
child: Container(
width: double.infinity,
decoration: BoxDecoration(color: Colors.black12),
padding: const EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_meal.time != null ? Text(_meal.time.format(context)) : Text('aaaa'),
IconButton(
visualDensity: VisualDensity.compact,
icon: _expanded ? Icon(Icons.expand_less) : Icon(Icons.expand_more),
onPressed: () {
_toggle();
},
),
],
)),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_meal.time != null
? Text(
_meal.time.format(context),
style: Theme.of(context).textTheme.headline5,
)
: Text(''),
IconButton(
visualDensity: VisualDensity.compact,
icon: _expanded ? Icon(Icons.expand_less) : Icon(Icons.expand_more),
onPressed: () {
_toggle();
},
),
],
),
),
secondaryBackground: Container(
color: Theme.of(context).accentColor,
padding: EdgeInsets.only(right: 10),

View File

@@ -90,30 +90,30 @@ class WorkoutDayWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
child: Column(
children: [
DayHeaderDismissible(day: _day),
..._day.sets
.map(
(set) => getSetRow(set),
)
.toList(),
OutlinedButton(
child: Text(AppLocalizations.of(context).addExercise),
onPressed: () {
showFormBottomSheet(
context,
AppLocalizations.of(context).newSet,
SetFormWidget(_day),
scrollControlled: true,
);
},
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
)
],
return Container(
padding: EdgeInsets.all(3),
child: Card(
child: Column(
children: [
DayHeaderDismissible(day: _day),
..._day.sets
.map(
(set) => getSetRow(set),
)
.toList(),
OutlinedButton(
child: Text(AppLocalizations.of(context).addExercise),
onPressed: () {
showFormBottomSheet(
context,
AppLocalizations.of(context).newSet,
SetFormWidget(_day),
scrollControlled: true,
);
},
),
],
),
),
);
}
@@ -134,22 +134,34 @@ class DayHeaderDismissible extends StatelessWidget {
key: Key(_day.id.toString()),
direction: DismissDirection.startToEnd,
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(color: Colors.white),
padding: const EdgeInsets.symmetric(vertical: 10),
width: double.infinity,
child: Column(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_day.description,
style: Theme.of(context).textTheme.headline6,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_day.description,
style: Theme.of(context).textTheme.headline5,
),
Text(_day.getDaysText),
],
),
Text(_day.getDaysText),
/*
IconButton(
visualDensity: VisualDensity.compact,
icon: Icon(Icons.expand_less),
onPressed: () {},
),
*/
],
),
),
/*
secondaryBackground: Container(
color: Theme.of(context).primaryColor,
color: Theme.of(context).accentColor,
padding: EdgeInsets.only(right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -167,7 +179,7 @@ class DayHeaderDismissible extends StatelessWidget {
),
*/
background: Container(
color: Theme.of(context).accentColor,
color: Theme.of(context).primaryColor,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 10),
child: Row(

View File

@@ -18,7 +18,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
import 'package:wger/models/workouts/workout_plan.dart';
import 'package:wger/screens/workout_plan_screen.dart';
import 'package:wger/widgets/core/bottom_sheet.dart';
@@ -42,6 +41,7 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
[
Column(
children: [
/*
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Text(
@@ -49,6 +49,8 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
style: Theme.of(context).textTheme.headline6,
),
),
*/
...widget._workoutPlan.days
.map((workoutDay) => WorkoutDayWidget(workoutDay))
.toList(),