mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Show measurement category name in the top navigation bar
This makes it easier to keep the orientation in the app
This commit is contained in:
@@ -263,10 +263,6 @@
|
||||
"description": "Categories for the measurements such as biceps size, body fat, etc."
|
||||
},
|
||||
"measurementCategoriesHelpText": "Measurement category, such as 'biceps' or 'body fat'",
|
||||
"measurementEntries": "Measurement entries",
|
||||
"@measurementEntries": {
|
||||
"description": "Specific entries for the measurements"
|
||||
},
|
||||
"measurementEntriesHelpText": "The unit used to measure the category such as 'cm' or '%'",
|
||||
"date": "Date",
|
||||
"@date": {
|
||||
|
||||
@@ -29,11 +29,13 @@ class MeasurementEntriesScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final category = ModalRoute.of(context)!.settings.arguments as int;
|
||||
final categoryId = ModalRoute.of(context)!.settings.arguments as int;
|
||||
final category =
|
||||
Provider.of<MeasurementProvider>(context, listen: false).findCategoryById(categoryId);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context).measurementEntries),
|
||||
title: Text(category.name),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add),
|
||||
@@ -43,13 +45,13 @@ class MeasurementEntriesScreen extends StatelessWidget {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).newEntry,
|
||||
MeasurementEntryForm(category),
|
||||
MeasurementEntryForm(categoryId),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
body: Consumer<MeasurementProvider>(
|
||||
builder: (context, provider, child) => EntriesList(),
|
||||
builder: (context, provider, child) => EntriesList(category),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ import 'package:wger/widgets/core/charts.dart';
|
||||
import 'forms.dart';
|
||||
|
||||
class EntriesList extends StatelessWidget {
|
||||
late MeasurementCategory _category;
|
||||
MeasurementCategory _category;
|
||||
|
||||
EntriesList(MeasurementCategory this._category);
|
||||
|
||||
Future<MeasurementCategory> _loadEntries(BuildContext context) async {
|
||||
final provider = Provider.of<MeasurementProvider>(context, listen: false);
|
||||
final int categoryId = ModalRoute.of(context)!.settings.arguments as int;
|
||||
await provider.fetchAndSetCategoryEntries(categoryId);
|
||||
_category = provider.findCategoryById(categoryId);
|
||||
await provider.fetchAndSetCategoryEntries(_category.id!);
|
||||
return _category;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ class EntriesList extends StatelessWidget {
|
||||
: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.all(10),
|
||||
height: 220,
|
||||
child: MeasurementChartWidget(_category.entries
|
||||
.map((e) => MeasurementChartEntry(e.value, e.date))
|
||||
|
||||
Reference in New Issue
Block a user