Skip to content

Commit c1dace1

Browse files
authored
Merge pull request #236 from floodoo/add-measurement-unit-to-entry-form
Add measurement unit to entry form
2 parents 7bd4089 + f3fe617 commit c1dace1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Marko Milosevic - <https://github.com/TaarnStar>
1414
- Karthik Reddy (Axel) - <https://github.com/AxelBlaz3>
1515
- Ogundoyin Toluwani - <https://github.com/Tolu007>
16+
- Florian Schmitz - <https://github.com/floodoo>
1617

1718
## Translators
1819

lib/widgets/measurements/forms.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ class MeasurementEntryForm extends StatelessWidget {
156156

157157
@override
158158
Widget build(BuildContext context) {
159+
final measurementProvider = Provider.of<MeasurementProvider>(context, listen: false);
160+
final measurementCategory = measurementProvider.categories.firstWhere(
161+
(category) => category.id == _categoryId,
162+
);
163+
159164
return Form(
160165
key: _form,
161166
child: Column(
@@ -199,7 +204,11 @@ class MeasurementEntryForm extends StatelessWidget {
199204
),
200205
// Value
201206
TextFormField(
202-
decoration: InputDecoration(labelText: AppLocalizations.of(context).value),
207+
decoration: InputDecoration(
208+
labelText: AppLocalizations.of(context).value,
209+
suffixIcon: Text(measurementCategory.unit),
210+
suffixIconConstraints: const BoxConstraints(minWidth: 0, minHeight: 0),
211+
),
203212
controller: _valueController,
204213
keyboardType: TextInputType.number,
205214
validator: (value) {

0 commit comments

Comments
 (0)