mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-05 23:44:02 +01:00
Don't check AppLocalizations for null values
This is not needed in flutter 2.2 anymore
This commit is contained in:
@@ -31,7 +31,9 @@ Alternatively, you can use one of our test servers, just ask us for access.
|
||||
|
||||
### 2
|
||||
Install Flutter, all its dependencies and create a new virtual device:
|
||||
<https://flutter.dev/docs/get-started/install>
|
||||
<https://flutter.dev/docs/get-started/install>.
|
||||
|
||||
The app currently uses flutter 2.2
|
||||
|
||||
### 3
|
||||
Create a new file ``wger.properties`` in ``android/fastlane/envfiles``:
|
||||
|
||||
@@ -30,7 +30,7 @@ void showErrorDialog(dynamic exception, BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.anErrorOccurred),
|
||||
title: Text(AppLocalizations.of(context).anErrorOccurred),
|
||||
content: Text(exception.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
@@ -67,7 +67,7 @@ void showHttpExceptionErrorDialog(WgerHttpException exception, BuildContext cont
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.anErrorOccurred),
|
||||
title: Text(AppLocalizations.of(context).anErrorOccurred),
|
||||
content: Container(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -182,14 +182,14 @@ class _AuthCardState extends State<AuthCard> {
|
||||
children: <Widget>[
|
||||
TextFormField(
|
||||
key: Key('inputUsername'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.username),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).username),
|
||||
autofillHints: [AutofillHints.username],
|
||||
controller: _usernameController,
|
||||
textInputAction: TextInputAction.next,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return AppLocalizations.of(context)!.invalidUsername;
|
||||
return AppLocalizations.of(context).invalidUsername;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -200,7 +200,7 @@ class _AuthCardState extends State<AuthCard> {
|
||||
if (_authMode == AuthMode.Signup)
|
||||
TextFormField(
|
||||
key: Key('inputEmail'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.email),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).email),
|
||||
autofillHints: [AutofillHints.email],
|
||||
controller: _emailController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
@@ -209,7 +209,7 @@ class _AuthCardState extends State<AuthCard> {
|
||||
// Email is not required
|
||||
validator: (value) {
|
||||
if (value!.isNotEmpty && !value.contains('@')) {
|
||||
return AppLocalizations.of(context)!.invalidEmail;
|
||||
return AppLocalizations.of(context).invalidEmail;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -219,14 +219,14 @@ class _AuthCardState extends State<AuthCard> {
|
||||
),
|
||||
TextFormField(
|
||||
key: Key('inputPassword'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.password),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).password),
|
||||
autofillHints: [AutofillHints.password],
|
||||
obscureText: true,
|
||||
controller: _passwordController,
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty || value.length < 8) {
|
||||
return AppLocalizations.of(context)!.passwordTooShort;
|
||||
return AppLocalizations.of(context).passwordTooShort;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -238,14 +238,14 @@ class _AuthCardState extends State<AuthCard> {
|
||||
TextFormField(
|
||||
key: Key('inputPassword2'),
|
||||
decoration:
|
||||
InputDecoration(labelText: AppLocalizations.of(context)!.confirmPassword),
|
||||
InputDecoration(labelText: AppLocalizations.of(context).confirmPassword),
|
||||
controller: _password2Controller,
|
||||
enabled: _authMode == AuthMode.Signup,
|
||||
obscureText: true,
|
||||
validator: _authMode == AuthMode.Signup
|
||||
? (value) {
|
||||
if (value != _passwordController.text) {
|
||||
return AppLocalizations.of(context)!.passwordsDontMatch;
|
||||
return AppLocalizations.of(context).passwordsDontMatch;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -262,17 +262,17 @@ class _AuthCardState extends State<AuthCard> {
|
||||
child: TextFormField(
|
||||
key: Key('inputServer'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.customServerUrl,
|
||||
helperText: AppLocalizations.of(context)!.customServerHint,
|
||||
labelText: AppLocalizations.of(context).customServerUrl,
|
||||
helperText: AppLocalizations.of(context).customServerHint,
|
||||
helperMaxLines: 4),
|
||||
controller: _serverUrlController,
|
||||
validator: (value) {
|
||||
if (Uri.tryParse(value!) == null) {
|
||||
return AppLocalizations.of(context)!.invalidUrl;
|
||||
return AppLocalizations.of(context).invalidUrl;
|
||||
}
|
||||
|
||||
if (value.isEmpty || !value.contains('http')) {
|
||||
return AppLocalizations.of(context)!.invalidUrl;
|
||||
return AppLocalizations.of(context).invalidUrl;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -293,7 +293,7 @@ class _AuthCardState extends State<AuthCard> {
|
||||
_serverUrlController.text = DEFAULT_SERVER;
|
||||
},
|
||||
),
|
||||
Text(AppLocalizations.of(context)!.reset)
|
||||
Text(AppLocalizations.of(context).reset)
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -308,8 +308,8 @@ class _AuthCardState extends State<AuthCard> {
|
||||
ElevatedButton(
|
||||
key: Key('actionButton'),
|
||||
child: Text(_authMode == AuthMode.Login
|
||||
? AppLocalizations.of(context)!.login
|
||||
: AppLocalizations.of(context)!.register),
|
||||
? AppLocalizations.of(context).login
|
||||
: AppLocalizations.of(context).register),
|
||||
onPressed: () {
|
||||
return _submit(context);
|
||||
},
|
||||
@@ -318,15 +318,15 @@ class _AuthCardState extends State<AuthCard> {
|
||||
key: Key('toggleActionButton'),
|
||||
child: Text(
|
||||
_authMode == AuthMode.Login
|
||||
? AppLocalizations.of(context)!.registerInstead.toUpperCase()
|
||||
: AppLocalizations.of(context)!.loginInstead.toUpperCase(),
|
||||
? AppLocalizations.of(context).registerInstead.toUpperCase()
|
||||
: AppLocalizations.of(context).loginInstead.toUpperCase(),
|
||||
),
|
||||
onPressed: _switchAuthMode,
|
||||
),
|
||||
TextButton(
|
||||
child: Text(_hideCustomServer
|
||||
? AppLocalizations.of(context)!.useCustomServer
|
||||
: AppLocalizations.of(context)!.useDefaultServer),
|
||||
? AppLocalizations.of(context).useCustomServer
|
||||
: AppLocalizations.of(context).useDefaultServer),
|
||||
key: Key('toggleCustomServerButton'),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
|
||||
@@ -94,7 +94,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: WgerAppBar(AppLocalizations.of(context)!.labelDashboard),
|
||||
appBar: WgerAppBar(AppLocalizations.of(context).labelDashboard),
|
||||
body: FutureBuilder(
|
||||
future: _initialData,
|
||||
builder: (ctx, authResultSnapshot) =>
|
||||
@@ -103,7 +103,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.loadingText,
|
||||
AppLocalizations.of(context).loadingText,
|
||||
style: Theme.of(context).textTheme.headline5,
|
||||
),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 8)),
|
||||
|
||||
@@ -35,7 +35,7 @@ class GalleryScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: WgerAppBar(AppLocalizations.of(context)!.gallery),
|
||||
appBar: WgerAppBar(AppLocalizations.of(context).gallery),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: Icon(Icons.add),
|
||||
onPressed: () {
|
||||
@@ -43,7 +43,7 @@ class GalleryScreen extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.addImage,
|
||||
AppLocalizations.of(context).addImage,
|
||||
ImageForm(),
|
||||
hasListView: true,
|
||||
),
|
||||
|
||||
@@ -58,26 +58,26 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.dashboard),
|
||||
label: AppLocalizations.of(context)!.labelDashboard,
|
||||
label: AppLocalizations.of(context).labelDashboard,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.fitness_center),
|
||||
label: AppLocalizations.of(context)!.labelBottomNavWorkout,
|
||||
label: AppLocalizations.of(context).labelBottomNavWorkout,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.restaurant),
|
||||
label: AppLocalizations.of(context)!.labelBottomNavNutrition,
|
||||
label: AppLocalizations.of(context).labelBottomNavNutrition,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.weight,
|
||||
size: 20,
|
||||
),
|
||||
label: AppLocalizations.of(context)!.weight,
|
||||
label: AppLocalizations.of(context).weight,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.photo_library),
|
||||
label: AppLocalizations.of(context)!.gallery,
|
||||
label: AppLocalizations.of(context).gallery,
|
||||
),
|
||||
],
|
||||
type: BottomNavigationBarType.fixed,
|
||||
|
||||
@@ -61,7 +61,7 @@ class NutritionalPlanScreen extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.edit,
|
||||
AppLocalizations.of(context).edit,
|
||||
PlanForm(_nutritionalPlan),
|
||||
),
|
||||
);
|
||||
@@ -77,12 +77,12 @@ class NutritionalPlanScreen extends StatelessWidget {
|
||||
return [
|
||||
PopupMenuItem<NutritionalPlanOptions>(
|
||||
value: NutritionalPlanOptions.edit,
|
||||
child: Text(AppLocalizations.of(context)!.edit),
|
||||
child: Text(AppLocalizations.of(context).edit),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem<NutritionalPlanOptions>(
|
||||
value: NutritionalPlanOptions.delete,
|
||||
child: Text(AppLocalizations.of(context)!.delete),
|
||||
child: Text(AppLocalizations.of(context).delete),
|
||||
),
|
||||
];
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@ class NutritionScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: WgerAppBar(AppLocalizations.of(context)!.nutritionalPlans),
|
||||
appBar: WgerAppBar(AppLocalizations.of(context).nutritionalPlans),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add),
|
||||
onPressed: () async {
|
||||
@@ -39,7 +39,7 @@ class NutritionScreen extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.newNutritionalPlan,
|
||||
AppLocalizations.of(context).newNutritionalPlan,
|
||||
PlanForm(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ class WeightScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: WgerAppBar(AppLocalizations.of(context)!.weight),
|
||||
appBar: WgerAppBar(AppLocalizations.of(context).weight),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add),
|
||||
onPressed: () async {
|
||||
@@ -37,7 +37,7 @@ class WeightScreen extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.newEntry,
|
||||
AppLocalizations.of(context).newEntry,
|
||||
WeightForm(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -96,7 +96,7 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.edit,
|
||||
AppLocalizations.of(context).edit,
|
||||
WorkoutForm(workoutPlan),
|
||||
),
|
||||
);
|
||||
@@ -120,18 +120,18 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
return [
|
||||
PopupMenuItem<WorkoutOptions>(
|
||||
child: _mode == WorkoutScreenMode.log
|
||||
? Text(AppLocalizations.of(context)!.labelWorkoutPlan)
|
||||
: Text(AppLocalizations.of(context)!.labelWorkoutLogs),
|
||||
? Text(AppLocalizations.of(context).labelWorkoutPlan)
|
||||
: Text(AppLocalizations.of(context).labelWorkoutLogs),
|
||||
value: WorkoutOptions.toggleMode,
|
||||
),
|
||||
PopupMenuItem<WorkoutOptions>(
|
||||
value: WorkoutOptions.edit,
|
||||
child: Text(AppLocalizations.of(context)!.edit),
|
||||
child: Text(AppLocalizations.of(context).edit),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem<WorkoutOptions>(
|
||||
value: WorkoutOptions.delete,
|
||||
child: Text(AppLocalizations.of(context)!.delete),
|
||||
child: Text(AppLocalizations.of(context).delete),
|
||||
),
|
||||
];
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ class WorkoutPlansScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: WgerAppBar(
|
||||
AppLocalizations.of(context)!.labelWorkoutPlans,
|
||||
AppLocalizations.of(context).labelWorkoutPlans,
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add),
|
||||
@@ -43,7 +43,7 @@ class WorkoutPlansScreen extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.newWorkout,
|
||||
AppLocalizations.of(context).newWorkout,
|
||||
WorkoutForm(WorkoutPlan.empty()),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ class AppDrawer extends StatelessWidget {
|
||||
ListTile(
|
||||
//dense: true,
|
||||
leading: Icon(Icons.exit_to_app),
|
||||
title: Text(AppLocalizations.of(context)!.logout),
|
||||
title: Text(AppLocalizations.of(context).logout),
|
||||
onTap: () {
|
||||
Provider.of<AuthProvider>(context, listen: false).logout();
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).clear();
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:wger/providers/auth.dart';
|
||||
|
||||
class WgerAboutListTile extends StatelessWidget {
|
||||
@@ -52,15 +52,15 @@ class WgerAboutListTile extends StatelessWidget {
|
||||
|
||||
aboutBoxChildren: [
|
||||
SizedBox(height: 10),
|
||||
Text(AppLocalizations.of(context)!.aboutDescription),
|
||||
Text(AppLocalizations.of(context).aboutDescription),
|
||||
SizedBox(height: 20),
|
||||
ListTile(
|
||||
leading: Icon(Icons.code),
|
||||
title: Text(AppLocalizations.of(context)!.aboutSourceTitle),
|
||||
title: Text(AppLocalizations.of(context).aboutSourceTitle),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.aboutSourceText),
|
||||
Text(AppLocalizations.of(context).aboutSourceText),
|
||||
Text(
|
||||
'https://github.com/wger-project',
|
||||
style: TextStyle(color: Colors.blue),
|
||||
@@ -73,11 +73,11 @@ class WgerAboutListTile extends StatelessWidget {
|
||||
SizedBox(height: 10),
|
||||
ListTile(
|
||||
leading: Icon(Icons.bug_report),
|
||||
title: Text(AppLocalizations.of(context)!.aboutBugsTitle),
|
||||
title: Text(AppLocalizations.of(context).aboutBugsTitle),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.aboutBugsText),
|
||||
Text(AppLocalizations.of(context).aboutBugsText),
|
||||
Text(
|
||||
'https://github.com/wger-project/flutter/issues/new/choose',
|
||||
style: TextStyle(color: Colors.blue),
|
||||
@@ -91,11 +91,11 @@ class WgerAboutListTile extends StatelessWidget {
|
||||
SizedBox(height: 10),
|
||||
ListTile(
|
||||
leading: Icon(Icons.chat),
|
||||
title: Text(AppLocalizations.of(context)!.aboutContactUsTitle),
|
||||
title: Text(AppLocalizations.of(context).aboutContactUsTitle),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.aboutContactUsText),
|
||||
Text(AppLocalizations.of(context).aboutContactUsText),
|
||||
Text(
|
||||
'https://discord.gg/rPWFv6W',
|
||||
style: TextStyle(color: Colors.blue),
|
||||
@@ -108,11 +108,11 @@ class WgerAboutListTile extends StatelessWidget {
|
||||
SizedBox(height: 10),
|
||||
ListTile(
|
||||
leading: Icon(Icons.translate),
|
||||
title: Text(AppLocalizations.of(context)!.aboutTranslationTitle),
|
||||
title: Text(AppLocalizations.of(context).aboutTranslationTitle),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.aboutTranslationText),
|
||||
Text(AppLocalizations.of(context).aboutTranslationText),
|
||||
Text(
|
||||
'https://hosted.weblate.org/engage/wger/',
|
||||
style: TextStyle(color: Colors.blue),
|
||||
|
||||
@@ -44,7 +44,7 @@ class WgerAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.optionsLabel),
|
||||
title: Text(AppLocalizations.of(context).optionsLabel),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text(MaterialLocalizations.of(context).closeButtonLabel),
|
||||
@@ -61,7 +61,7 @@ class WgerAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
ListTile(
|
||||
//dense: true,
|
||||
leading: Icon(Icons.exit_to_app),
|
||||
title: Text(AppLocalizations.of(context)!.logout),
|
||||
title: Text(AppLocalizations.of(context).logout),
|
||||
onTap: () {
|
||||
Provider.of<AuthProvider>(context, listen: false).logout();
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).clear();
|
||||
|
||||
@@ -111,7 +111,7 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
|
||||
// Add events to lists
|
||||
_events[date]!.add(Event(
|
||||
EventType.session,
|
||||
'${AppLocalizations.of(context)!.impression}: ${session.impressionAsString} $time',
|
||||
'${AppLocalizations.of(context).impression}: ${session.impressionAsString} $time',
|
||||
));
|
||||
}
|
||||
});
|
||||
@@ -193,7 +193,7 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.calendar,
|
||||
AppLocalizations.of(context).calendar,
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
),
|
||||
leading: Icon(
|
||||
@@ -235,13 +235,13 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
|
||||
title: Text((() {
|
||||
switch (event.type) {
|
||||
case EventType.caloriesDiary:
|
||||
return AppLocalizations.of(context)!.nutritionalDiary;
|
||||
return AppLocalizations.of(context).nutritionalDiary;
|
||||
|
||||
case EventType.session:
|
||||
return AppLocalizations.of(context)!.workoutSession;
|
||||
return AppLocalizations.of(context).workoutSession;
|
||||
|
||||
case EventType.weight:
|
||||
return AppLocalizations.of(context)!.weight;
|
||||
return AppLocalizations.of(context).weight;
|
||||
}
|
||||
return event.description.toString();
|
||||
})()),
|
||||
|
||||
@@ -79,16 +79,16 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
MutedText(
|
||||
'${meal.nutritionalValues.energy.toStringAsFixed(0)}${AppLocalizations.of(context)!.kcal}'),
|
||||
'${meal.nutritionalValues.energy.toStringAsFixed(0)}${AppLocalizations.of(context).kcal}'),
|
||||
MutedText(' / '),
|
||||
MutedText(
|
||||
'${meal.nutritionalValues.protein.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}'),
|
||||
'${meal.nutritionalValues.protein.toStringAsFixed(0)}${AppLocalizations.of(context).g}'),
|
||||
MutedText(' / '),
|
||||
MutedText(
|
||||
'${meal.nutritionalValues.carbohydrates.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}'),
|
||||
'${meal.nutritionalValues.carbohydrates.toStringAsFixed(0)}${AppLocalizations.of(context).g}'),
|
||||
MutedText(' / '),
|
||||
MutedText(
|
||||
'${meal.nutritionalValues.fat.toStringAsFixed(0)}${AppLocalizations.of(context)!.g} '),
|
||||
'${meal.nutritionalValues.fat.toStringAsFixed(0)}${AppLocalizations.of(context).g} '),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
@@ -99,7 +99,7 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.mealLogged,
|
||||
AppLocalizations.of(context).mealLogged,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -126,7 +126,7 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text('${item.amount.toStringAsFixed(0)} ${AppLocalizations.of(context)!.g}'),
|
||||
Text('${item.amount.toStringAsFixed(0)} ${AppLocalizations.of(context).g}'),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -156,7 +156,7 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
_hasContent ? _plan!.description : AppLocalizations.of(context)!.labelWorkoutPlan,
|
||||
_hasContent ? _plan!.description : AppLocalizations.of(context).labelWorkoutPlan,
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
),
|
||||
subtitle: Text(
|
||||
@@ -191,8 +191,8 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
),
|
||||
)
|
||||
: NothingFound(
|
||||
AppLocalizations.of(context)!.noNutritionalPlans,
|
||||
AppLocalizations.of(context)!.newNutritionalPlan,
|
||||
AppLocalizations.of(context).noNutritionalPlans,
|
||||
AppLocalizations.of(context).newNutritionalPlan,
|
||||
PlanForm(),
|
||||
),
|
||||
if (_hasContent)
|
||||
@@ -200,7 +200,7 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: Text(AppLocalizations.of(context)!.goToDetailPage),
|
||||
child: Text(AppLocalizations.of(context).goToDetailPage),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.pushNamed(NutritionalPlanScreen.routeName, arguments: _plan);
|
||||
@@ -231,7 +231,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.weight,
|
||||
AppLocalizations.of(context).weight,
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
),
|
||||
leading: FaIcon(
|
||||
@@ -245,7 +245,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.newEntry,
|
||||
AppLocalizations.of(context).newEntry,
|
||||
WeightForm(),
|
||||
),
|
||||
);
|
||||
@@ -261,8 +261,8 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
child: WeightChartWidget(weightEntriesData.items),
|
||||
)
|
||||
: NothingFound(
|
||||
AppLocalizations.of(context)!.noWeightEntries,
|
||||
AppLocalizations.of(context)!.newEntry,
|
||||
AppLocalizations.of(context).noWeightEntries,
|
||||
AppLocalizations.of(context).newEntry,
|
||||
WeightForm(),
|
||||
),
|
||||
],
|
||||
@@ -373,7 +373,7 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
_hasContent ? _workoutPlan!.name : AppLocalizations.of(context)!.labelWorkoutPlan,
|
||||
_hasContent ? _workoutPlan!.name : AppLocalizations.of(context).labelWorkoutPlan,
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
),
|
||||
subtitle: Text(
|
||||
@@ -403,8 +403,8 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
|
||||
),
|
||||
)
|
||||
: NothingFound(
|
||||
AppLocalizations.of(context)!.noWorkoutPlans,
|
||||
AppLocalizations.of(context)!.newWorkout,
|
||||
AppLocalizations.of(context).noWorkoutPlans,
|
||||
AppLocalizations.of(context).newWorkout,
|
||||
WorkoutForm(WorkoutPlan.empty()),
|
||||
),
|
||||
if (_hasContent)
|
||||
@@ -412,7 +412,7 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: Text(AppLocalizations.of(context)!.goToDetailPage),
|
||||
child: Text(AppLocalizations.of(context).goToDetailPage),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.pushNamed(WorkoutPlanScreen.routeName, arguments: _workoutPlan);
|
||||
|
||||
@@ -35,7 +35,7 @@ class ExerciseDetail extends StatelessWidget {
|
||||
children: [
|
||||
// Category
|
||||
Text(
|
||||
AppLocalizations.of(context)!.category,
|
||||
AppLocalizations.of(context).category,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
Text(_exercise.categoryObj.name),
|
||||
@@ -43,7 +43,7 @@ class ExerciseDetail extends StatelessWidget {
|
||||
|
||||
// Equipment
|
||||
Text(
|
||||
AppLocalizations.of(context)!.equipment,
|
||||
AppLocalizations.of(context).equipment,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
if (_exercise.equipment.length > 0)
|
||||
@@ -53,7 +53,7 @@ class ExerciseDetail extends StatelessWidget {
|
||||
|
||||
// Muscles
|
||||
Text(
|
||||
AppLocalizations.of(context)!.muscles,
|
||||
AppLocalizations.of(context).muscles,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
if (_exercise.muscles.length > 0)
|
||||
@@ -63,7 +63,7 @@ class ExerciseDetail extends StatelessWidget {
|
||||
|
||||
// Muscles secondary
|
||||
Text(
|
||||
AppLocalizations.of(context)!.musclesSecondary,
|
||||
AppLocalizations.of(context).musclesSecondary,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
if (_exercise.musclesSecondary.length > 0)
|
||||
@@ -73,7 +73,7 @@ class ExerciseDetail extends StatelessWidget {
|
||||
|
||||
// Description
|
||||
Text(
|
||||
AppLocalizations.of(context)!.description,
|
||||
AppLocalizations.of(context).description,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
Html(data: _exercise.description),
|
||||
|
||||
@@ -83,7 +83,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.selectImage),
|
||||
Text(AppLocalizations.of(context).selectImage),
|
||||
SizedBox(height: 8),
|
||||
Icon(Icons.photo_camera),
|
||||
],
|
||||
@@ -113,7 +113,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
_showPicker(ImageSource.camera);
|
||||
},
|
||||
leading: Icon(Icons.photo_camera),
|
||||
title: Text(AppLocalizations.of(context)!.takePicture),
|
||||
title: Text(AppLocalizations.of(context).takePicture),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
@@ -121,7 +121,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
_showPicker(ImageSource.gallery);
|
||||
},
|
||||
leading: Icon(Icons.photo_library),
|
||||
title: Text(AppLocalizations.of(context)!.chooseFromLibrary))
|
||||
title: Text(AppLocalizations.of(context).chooseFromLibrary))
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -133,7 +133,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
),
|
||||
TextFormField(
|
||||
key: Key('field-date'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.date),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).date),
|
||||
controller: dateController,
|
||||
onTap: () async {
|
||||
// Stop keyboard from appearing
|
||||
@@ -154,7 +154,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
},
|
||||
validator: (value) {
|
||||
if (widget._image.id == null && _file == null) {
|
||||
return AppLocalizations.of(context)!.selectImage;
|
||||
return AppLocalizations.of(context).selectImage;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -162,7 +162,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
),
|
||||
TextFormField(
|
||||
key: Key('field-description'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.description),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).description),
|
||||
minLines: 3,
|
||||
maxLines: 10,
|
||||
controller: descriptionController,
|
||||
@@ -172,7 +172,7 @@ class _ImageFormState extends State<ImageForm> {
|
||||
),
|
||||
ElevatedButton(
|
||||
key: Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save
|
||||
final isValid = _form.currentState!.validate();
|
||||
|
||||
@@ -81,7 +81,7 @@ class Gallery extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.edit,
|
||||
AppLocalizations.of(context).edit,
|
||||
ImageForm(currentImage),
|
||||
hasListView: true,
|
||||
),
|
||||
|
||||
@@ -45,12 +45,12 @@ class NutritionalPlanPieChartWidget extends StatelessWidget {
|
||||
domainFn: (datum, index) => datum[0],
|
||||
measureFn: (datum, index) => datum[1],
|
||||
data: [
|
||||
[AppLocalizations.of(context)!.protein, _nutritionalValues.protein],
|
||||
[AppLocalizations.of(context)!.fat, _nutritionalValues.fat],
|
||||
[AppLocalizations.of(context)!.carbohydrates, _nutritionalValues.carbohydrates],
|
||||
[AppLocalizations.of(context).protein, _nutritionalValues.protein],
|
||||
[AppLocalizations.of(context).fat, _nutritionalValues.fat],
|
||||
[AppLocalizations.of(context).carbohydrates, _nutritionalValues.carbohydrates],
|
||||
],
|
||||
labelAccessorFn: (List<dynamic> row, _) =>
|
||||
'${row[0]}\n${row[1].toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
'${row[0]}\n${row[1].toStringAsFixed(0)}${AppLocalizations.of(context).g}',
|
||||
)
|
||||
],
|
||||
defaultRenderer: new charts.ArcRendererConfig(
|
||||
@@ -67,7 +67,7 @@ class NutritionalDiaryChartWidget extends StatelessWidget {
|
||||
NutritionalDiaryChartWidget({
|
||||
Key? key,
|
||||
required NutritionalPlan nutritionalPlan,
|
||||
}) : _nutritionalPlan = nutritionalPlan,
|
||||
}) : _nutritionalPlan = nutritionalPlan,
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@@ -52,7 +52,7 @@ class MealForm extends StatelessWidget {
|
||||
children: [
|
||||
TextFormField(
|
||||
key: Key('field-time'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.time),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).time),
|
||||
controller: _timeController,
|
||||
onTap: () async {
|
||||
// Stop keyboard from appearing
|
||||
@@ -73,7 +73,7 @@ class MealForm extends StatelessWidget {
|
||||
),
|
||||
ElevatedButton(
|
||||
key: Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
@@ -124,7 +124,7 @@ class MealItemForm extends StatelessWidget {
|
||||
TypeAheadFormField(
|
||||
textFieldConfiguration: TextFieldConfiguration(
|
||||
controller: this._ingredientController,
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.ingredient),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).ingredient),
|
||||
),
|
||||
suggestionsCallback: (pattern) async {
|
||||
return await Provider.of<NutritionPlansProvider>(context, listen: false)
|
||||
@@ -148,13 +148,13 @@ class MealItemForm extends StatelessWidget {
|
||||
},
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return AppLocalizations.of(context)!.selectIngredient;
|
||||
return AppLocalizations.of(context).selectIngredient;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).weight),
|
||||
controller: _amountController,
|
||||
keyboardType: TextInputType.number,
|
||||
onFieldSubmitted: (_) {},
|
||||
@@ -165,13 +165,13 @@ class MealItemForm extends StatelessWidget {
|
||||
try {
|
||||
double.parse(value!);
|
||||
} catch (error) {
|
||||
return AppLocalizations.of(context)!.enterValidNumber;
|
||||
return AppLocalizations.of(context).enterValidNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
@@ -215,7 +215,7 @@ class PlanForm extends StatelessWidget {
|
||||
// Description
|
||||
TextFormField(
|
||||
key: Key('field-description'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.description),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).description),
|
||||
controller: _descriptionController,
|
||||
onFieldSubmitted: (_) {},
|
||||
onSaved: (newValue) {
|
||||
@@ -224,7 +224,7 @@ class PlanForm extends StatelessWidget {
|
||||
),
|
||||
ElevatedButton(
|
||||
key: Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save the current values to the weightEntry
|
||||
final isValid = _form.currentState!.validate();
|
||||
|
||||
@@ -62,25 +62,25 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.energy,
|
||||
AppLocalizations.of(context).energy,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.protein,
|
||||
AppLocalizations.of(context).protein,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.carbohydrates,
|
||||
AppLocalizations.of(context).carbohydrates,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.fat,
|
||||
AppLocalizations.of(context).fat,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -89,13 +89,13 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
),
|
||||
...widget._meal.mealItems.map((item) => MealItemWidget(item, _expanded)).toList(),
|
||||
OutlinedButton(
|
||||
child: Text(AppLocalizations.of(context)!.addIngredient),
|
||||
child: Text(AppLocalizations.of(context).addIngredient),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.addIngredient,
|
||||
AppLocalizations.of(context).addIngredient,
|
||||
MealItemForm(widget._meal),
|
||||
hasListView: true,
|
||||
),
|
||||
@@ -120,11 +120,11 @@ class MealItemWidget extends StatelessWidget {
|
||||
// TODO: add real support for weight units
|
||||
/*
|
||||
String unit = _item.weightUnitId == null
|
||||
? AppLocalizations.of(context)!.g
|
||||
? AppLocalizations.of(context).g
|
||||
: _item.weightUnitObj!.weightUnit.name;
|
||||
|
||||
*/
|
||||
String unit = AppLocalizations.of(context)!.g;
|
||||
String unit = AppLocalizations.of(context).g;
|
||||
final values = _item.nutritionalValues;
|
||||
|
||||
return Container(
|
||||
@@ -155,7 +155,7 @@ class MealItemWidget extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.successfullyDeleted,
|
||||
AppLocalizations.of(context).successfullyDeleted,
|
||||
textAlign: TextAlign.center,
|
||||
)),
|
||||
);
|
||||
@@ -169,25 +169,25 @@ class MealItemWidget extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.energy.toStringAsFixed(0)} ${AppLocalizations.of(context)!.kcal}',
|
||||
'${values.energy.toStringAsFixed(0)} ${AppLocalizations.of(context).kcal}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.protein.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
'${values.protein.toStringAsFixed(0)}${AppLocalizations.of(context).g}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.carbohydrates.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
'${values.carbohydrates.toStringAsFixed(0)}${AppLocalizations.of(context).g}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.fat.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
'${values.fat.toStringAsFixed(0)}${AppLocalizations.of(context).g}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -219,7 +219,7 @@ class DismissibleMealHeader extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.edit,
|
||||
AppLocalizations.of(context).edit,
|
||||
MealForm(_meal.planId, _meal),
|
||||
),
|
||||
);
|
||||
@@ -273,7 +273,7 @@ class DismissibleMealHeader extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.logMeal,
|
||||
AppLocalizations.of(context).logMeal,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
Icon(
|
||||
@@ -293,7 +293,7 @@ class DismissibleMealHeader extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.successfullyDeleted,
|
||||
AppLocalizations.of(context).successfullyDeleted,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -305,7 +305,7 @@ class DismissibleMealHeader extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.mealLogged,
|
||||
AppLocalizations.of(context).mealLogged,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -42,13 +42,13 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.addMeal),
|
||||
child: Text(AppLocalizations.of(context).addMeal),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.addMeal,
|
||||
AppLocalizations.of(context).addMeal,
|
||||
MealForm(_nutritionalPlan.id!),
|
||||
),
|
||||
);
|
||||
@@ -70,14 +70,14 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.energy),
|
||||
Text(AppLocalizations.of(context)!.protein),
|
||||
Text(AppLocalizations.of(context)!.carbohydrates),
|
||||
Text(AppLocalizations.of(context)!.sugars),
|
||||
Text(AppLocalizations.of(context)!.fat),
|
||||
Text(AppLocalizations.of(context)!.saturatedFat),
|
||||
Text(AppLocalizations.of(context)!.fibres),
|
||||
Text(AppLocalizations.of(context)!.sodium),
|
||||
Text(AppLocalizations.of(context).energy),
|
||||
Text(AppLocalizations.of(context).protein),
|
||||
Text(AppLocalizations.of(context).carbohydrates),
|
||||
Text(AppLocalizations.of(context).sugars),
|
||||
Text(AppLocalizations.of(context).fat),
|
||||
Text(AppLocalizations.of(context).saturatedFat),
|
||||
Text(AppLocalizations.of(context).fibres),
|
||||
Text(AppLocalizations.of(context).sodium),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -100,14 +100,14 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.kcal),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context)!.g),
|
||||
Text(AppLocalizations.of(context).kcal),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
Text(AppLocalizations.of(context).g),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -115,7 +115,7 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
|
||||
),
|
||||
Padding(padding: const EdgeInsets.all(8.0)),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.nutritionalDiary,
|
||||
AppLocalizations.of(context).nutritionalDiary,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
Container(
|
||||
@@ -135,17 +135,17 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
|
||||
children: [
|
||||
Text(''),
|
||||
Text(
|
||||
'${AppLocalizations.of(context)!.energy} (${AppLocalizations.of(context)!.kcal})'),
|
||||
'${AppLocalizations.of(context).energy} (${AppLocalizations.of(context).kcal})'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context)!.protein} (${AppLocalizations.of(context)!.g})'),
|
||||
'${AppLocalizations.of(context).protein} (${AppLocalizations.of(context).g})'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context)!.carbohydrates} (${AppLocalizations.of(context)!.g})'),
|
||||
'${AppLocalizations.of(context).carbohydrates} (${AppLocalizations.of(context).g})'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context)!.sugars} (${AppLocalizations.of(context)!.g})'),
|
||||
'${AppLocalizations.of(context).sugars} (${AppLocalizations.of(context).g})'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context)!.fat} (${AppLocalizations.of(context)!.g})'),
|
||||
'${AppLocalizations.of(context).fat} (${AppLocalizations.of(context).g})'),
|
||||
Text(
|
||||
'${AppLocalizations.of(context)!.saturatedFat} (${AppLocalizations.of(context)!.g})'),
|
||||
'${AppLocalizations.of(context).saturatedFat} (${AppLocalizations.of(context).g})'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -42,7 +42,7 @@ class NutritionalPlansList extends StatelessWidget {
|
||||
builder: (BuildContext contextDialog) {
|
||||
return AlertDialog(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.confirmDelete(currentPlan.description),
|
||||
AppLocalizations.of(context).confirmDelete(currentPlan.description),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
@@ -51,7 +51,7 @@ class NutritionalPlansList extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.delete,
|
||||
AppLocalizations.of(context).delete,
|
||||
style: TextStyle(color: Theme.of(context).errorColor),
|
||||
),
|
||||
onPressed: () {
|
||||
@@ -65,7 +65,7 @@ class NutritionalPlansList extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.successfullyDeleted,
|
||||
AppLocalizations.of(context).successfullyDeleted,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -55,7 +55,7 @@ class WeightEntriesList extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.successfullyDeleted,
|
||||
AppLocalizations.of(context).successfullyDeleted,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -69,7 +69,7 @@ class WeightEntriesList extends StatelessWidget {
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.edit,
|
||||
AppLocalizations.of(context).edit,
|
||||
WeightForm(currentEntry),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -47,7 +47,7 @@ class WeightForm extends StatelessWidget {
|
||||
children: [
|
||||
// Weight date
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.date),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).date),
|
||||
controller: dateController,
|
||||
onTap: () async {
|
||||
// Stop keyboard from appearing
|
||||
@@ -82,7 +82,7 @@ class WeightForm extends StatelessWidget {
|
||||
|
||||
// Weight
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).weight),
|
||||
controller: weightController,
|
||||
keyboardType: TextInputType.number,
|
||||
onSaved: (newValue) {
|
||||
@@ -90,18 +90,18 @@ class WeightForm extends StatelessWidget {
|
||||
},
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return AppLocalizations.of(context)!.enterValue;
|
||||
return AppLocalizations.of(context).enterValue;
|
||||
}
|
||||
try {
|
||||
double.parse(value);
|
||||
} catch (error) {
|
||||
return AppLocalizations.of(context)!.enterValidNumber;
|
||||
return AppLocalizations.of(context).enterValidNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save the current values to the weightEntry
|
||||
final isValid = _form.currentState!.validate();
|
||||
|
||||
@@ -41,7 +41,7 @@ class LogChartWidget extends StatelessWidget {
|
||||
[
|
||||
..._data['chart_data'].map((e) {
|
||||
return charts.Series<TimeSeriesLog, DateTime>(
|
||||
id: '${e.first['reps']} ${AppLocalizations.of(context)!.reps}',
|
||||
id: '${e.first['reps']} ${AppLocalizations.of(context).reps}',
|
||||
domainFn: (datum, index) => datum.time,
|
||||
measureFn: (datum, index) => datum.weight,
|
||||
data: [
|
||||
|
||||
@@ -153,13 +153,13 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
|
||||
)
|
||||
.toList(),
|
||||
OutlinedButton(
|
||||
child: Text(AppLocalizations.of(context)!.addSet),
|
||||
child: Text(AppLocalizations.of(context).addSet),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.newSet,
|
||||
AppLocalizations.of(context).newSet,
|
||||
SetFormWidget(widget._day),
|
||||
hasListView: true,
|
||||
backgroundColor: wgerBackground,
|
||||
@@ -184,7 +184,7 @@ class DayHeaderDismissible extends StatelessWidget {
|
||||
required Day day,
|
||||
required bool expanded,
|
||||
required Function toggle,
|
||||
}) : _day = day,
|
||||
}) : _day = day,
|
||||
_expanded = expanded,
|
||||
_toggle = toggle;
|
||||
|
||||
@@ -247,7 +247,7 @@ class DayHeaderDismissible extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.gymMode,
|
||||
AppLocalizations.of(context).gymMode,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
Icon(
|
||||
|
||||
@@ -56,13 +56,13 @@ class WorkoutForm extends StatelessWidget {
|
||||
children: [
|
||||
TextFormField(
|
||||
key: Key('field-name'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.name),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).name),
|
||||
controller: workoutNameController,
|
||||
validator: (value) {
|
||||
const minLength = 5;
|
||||
const maxLength = 100;
|
||||
if (value!.isEmpty || value.length < minLength || value.length > maxLength) {
|
||||
return AppLocalizations.of(context)!.enterCharacters(minLength, maxLength);
|
||||
return AppLocalizations.of(context).enterCharacters(minLength, maxLength);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -73,7 +73,7 @@ class WorkoutForm extends StatelessWidget {
|
||||
),
|
||||
TextFormField(
|
||||
key: Key('field-description'),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.description),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).description),
|
||||
minLines: 3,
|
||||
maxLines: 10,
|
||||
controller: workoutDescriptionController,
|
||||
@@ -81,7 +81,7 @@ class WorkoutForm extends StatelessWidget {
|
||||
const minLength = 0;
|
||||
const maxLength = 1000;
|
||||
if (value!.length > maxLength) {
|
||||
return AppLocalizations.of(context)!.enterCharacters(minLength, maxLength);
|
||||
return AppLocalizations.of(context).enterCharacters(minLength, maxLength);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -92,7 +92,7 @@ class WorkoutForm extends StatelessWidget {
|
||||
),
|
||||
ElevatedButton(
|
||||
key: Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save
|
||||
final isValid = _form.currentState!.validate();
|
||||
@@ -182,8 +182,8 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
TextFormField(
|
||||
key: Key('field-description'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.description,
|
||||
helperText: AppLocalizations.of(context)!.dayDescriptionHelp,
|
||||
labelText: AppLocalizations.of(context).description,
|
||||
helperText: AppLocalizations.of(context).dayDescriptionHelp,
|
||||
helperMaxLines: 3,
|
||||
),
|
||||
controller: widget.dayController,
|
||||
@@ -194,7 +194,7 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
const minLength = 5;
|
||||
const maxLength = 100;
|
||||
if (value!.isEmpty || value.length < minLength || value.length > maxLength) {
|
||||
return AppLocalizations.of(context)!.enterCharacters(minLength, maxLength);
|
||||
return AppLocalizations.of(context).enterCharacters(minLength, maxLength);
|
||||
}
|
||||
|
||||
if (widget._day.daysOfWeek.length == 0) {
|
||||
@@ -207,7 +207,7 @@ class _DayFormWidgetState extends State<DayFormWidget> {
|
||||
...Day.weekdays.keys.map((dayNr) => DayCheckbox(dayNr, widget._day)).toList(),
|
||||
ElevatedButton(
|
||||
key: Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
@@ -314,7 +314,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
child: Column(
|
||||
//crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.nrOfSets(_currentSetSliderValue.round())),
|
||||
Text(AppLocalizations.of(context).nrOfSets(_currentSetSliderValue.round())),
|
||||
Slider(
|
||||
value: _currentSetSliderValue,
|
||||
min: 1,
|
||||
@@ -331,7 +331,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
),
|
||||
if (widget._set.settings.length > 0)
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.setUnitsAndRir),
|
||||
title: Text(AppLocalizations.of(context).setUnitsAndRir),
|
||||
value: _detailed,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
@@ -352,7 +352,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
textFieldConfiguration: TextFieldConfiguration(
|
||||
controller: this._exercisesController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.searchExercise,
|
||||
labelText: AppLocalizations.of(context).searchExercise,
|
||||
prefixIcon: Icon(Icons.search),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.help),
|
||||
@@ -363,9 +363,9 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.selectExercises),
|
||||
Text(AppLocalizations.of(context).selectExercises),
|
||||
SizedBox(height: 10),
|
||||
Text(AppLocalizations.of(context)!.sameRepetitions)
|
||||
Text(AppLocalizations.of(context).sameRepetitions)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@@ -418,7 +418,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
validator: (value) {
|
||||
// At least one exercise must be selected
|
||||
if (widget._set.exercisesIds.length == 0) {
|
||||
return AppLocalizations.of(context)!.selectExercise;
|
||||
return AppLocalizations.of(context).selectExercise;
|
||||
}
|
||||
|
||||
// At least one setting has to be filled in
|
||||
@@ -426,7 +426,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
.where((s) => s.weight == null && s.reps == null)
|
||||
.length ==
|
||||
widget._set.settings.length) {
|
||||
return AppLocalizations.of(context)!.enterRepetitionsOrWeight;
|
||||
return AppLocalizations.of(context).enterRepetitionsOrWeight;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -447,7 +447,7 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
}).toList(),
|
||||
ElevatedButton(
|
||||
key: Key(SUBMIT_BUTTON_KEY_NAME),
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
final isValid = _formKey.currentState!.validate();
|
||||
if (!isValid) {
|
||||
@@ -519,7 +519,7 @@ class ExerciseSetting extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.setNr(i + 1),
|
||||
AppLocalizations.of(context).setNr(i + 1),
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
Row(
|
||||
@@ -566,7 +566,7 @@ class ExerciseSetting extends StatelessWidget {
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.setNr(i + 1),
|
||||
AppLocalizations.of(context).setNr(i + 1),
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
@@ -611,8 +611,8 @@ class ExerciseSetting extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.repetitions),
|
||||
Text(AppLocalizations.of(context)!.weight),
|
||||
Text(AppLocalizations.of(context).repetitions),
|
||||
Text(AppLocalizations.of(context).weight),
|
||||
],
|
||||
),
|
||||
getRows(context),
|
||||
@@ -634,7 +634,7 @@ class RepsInputWidget extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: _detailed ? AppLocalizations.of(context)!.repetitions : '',
|
||||
labelText: _detailed ? AppLocalizations.of(context).repetitions : '',
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
controller: _repsController,
|
||||
@@ -645,7 +645,7 @@ class RepsInputWidget extends StatelessWidget {
|
||||
double.parse(value!);
|
||||
}
|
||||
} catch (error) {
|
||||
return AppLocalizations.of(context)!.enterValidNumber;
|
||||
return AppLocalizations.of(context).enterValidNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -671,7 +671,7 @@ class WeightInputWidget extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: _detailed ? AppLocalizations.of(context)!.weight : '',
|
||||
labelText: _detailed ? AppLocalizations.of(context).weight : '',
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
controller: _weightController,
|
||||
@@ -682,7 +682,7 @@ class WeightInputWidget extends StatelessWidget {
|
||||
double.parse(value!);
|
||||
}
|
||||
} catch (error) {
|
||||
return AppLocalizations.of(context)!.enterValidNumber;
|
||||
return AppLocalizations.of(context).enterValidNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -715,7 +715,7 @@ class _RiRInputWidgetState extends State<RiRInputWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButtonFormField(
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.rir),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).rir),
|
||||
value: widget.dropdownValue,
|
||||
onSaved: (String? newValue) {
|
||||
widget._setting.setRir(newValue!);
|
||||
@@ -754,7 +754,7 @@ class _WeightUnitInputWidgetState extends State<WeightUnitInputWidget> {
|
||||
|
||||
return DropdownButtonFormField(
|
||||
value: selectedWeightUnit,
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weightUnit),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).weightUnit),
|
||||
onChanged: (WeightUnit? newValue) {
|
||||
setState(() {
|
||||
selectedWeightUnit = newValue!;
|
||||
@@ -791,7 +791,7 @@ class _RepetitionUnitInputWidgetState extends State<RepetitionUnitInputWidget> {
|
||||
|
||||
return DropdownButtonFormField(
|
||||
value: selectedWeightUnit,
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.repetitionUnit),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).repetitionUnit),
|
||||
isDense: true,
|
||||
onChanged: (RepetitionUnit? newValue) {
|
||||
setState(() {
|
||||
|
||||
@@ -138,7 +138,7 @@ class StartPage extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.todaysWorkout,
|
||||
AppLocalizations.of(context).todaysWorkout,
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
),
|
||||
),
|
||||
@@ -170,7 +170,7 @@ class StartPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.start),
|
||||
child: Text(AppLocalizations.of(context).start),
|
||||
onPressed: () {
|
||||
_controller.nextPage(duration: Duration(milliseconds: 200), curve: Curves.bounceIn);
|
||||
},
|
||||
@@ -240,7 +240,7 @@ class _LogPageState extends State<LogPage> {
|
||||
Widget getRepsWidget() {
|
||||
return TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.repetitions,
|
||||
labelText: AppLocalizations.of(context).repetitions,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.add,
|
||||
@@ -279,7 +279,7 @@ class _LogPageState extends State<LogPage> {
|
||||
try {
|
||||
int.parse(value!);
|
||||
} catch (error) {
|
||||
return AppLocalizations.of(context)!.enterValidNumber;
|
||||
return AppLocalizations.of(context).enterValidNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -289,7 +289,7 @@ class _LogPageState extends State<LogPage> {
|
||||
Widget getWeightWidget() {
|
||||
return TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.weight,
|
||||
labelText: AppLocalizations.of(context).weight,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.add,
|
||||
@@ -327,7 +327,7 @@ class _LogPageState extends State<LogPage> {
|
||||
try {
|
||||
double.parse(value!);
|
||||
} catch (error) {
|
||||
return AppLocalizations.of(context)!.enterValidNumber;
|
||||
return AppLocalizations.of(context).enterValidNumber;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -361,7 +361,7 @@ class _LogPageState extends State<LogPage> {
|
||||
? ListView(
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.labelWorkoutLogs,
|
||||
AppLocalizations.of(context).labelWorkoutLogs,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -369,12 +369,10 @@ class _LogPageState extends State<LogPage> {
|
||||
.filterLogsByExercise(widget._exercise, unique: true)
|
||||
.map((log) {
|
||||
return ListTile(
|
||||
//title: Text(log.id.toString()),
|
||||
title: Text(log.singleLogRepText.replaceAll('\n', '')),
|
||||
subtitle: Text(
|
||||
DateFormat.yMd(Localizations.localeOf(context).languageCode)
|
||||
.format(log.date)),
|
||||
|
||||
trailing: Icon(Icons.copy),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
@@ -429,7 +427,7 @@ class _LogPageState extends State<LogPage> {
|
||||
if (_detailed) RiRInputWidget(widget._log),
|
||||
/*
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context)!.comment),
|
||||
decoration: InputDecoration(labelText: AppLocalizations.of(context).comment),
|
||||
controller: _commentController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: 3,
|
||||
@@ -449,7 +447,7 @@ class _LogPageState extends State<LogPage> {
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save the current values to the weightEntry
|
||||
final isValid = _form.currentState!.validate();
|
||||
@@ -466,7 +464,7 @@ class _LogPageState extends State<LogPage> {
|
||||
SnackBar(
|
||||
duration: Duration(seconds: 2), // default is 4
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.successfullySaved,
|
||||
AppLocalizations.of(context).successfullySaved,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -593,7 +591,7 @@ class _SessionPageState extends State<SessionPage> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.workoutSession,
|
||||
AppLocalizations.of(context).workoutSession,
|
||||
style: Theme.of(context).textTheme.headline5,
|
||||
),
|
||||
),
|
||||
@@ -636,7 +634,7 @@ class _SessionPageState extends State<SessionPage> {
|
||||
),
|
||||
TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.notes,
|
||||
labelText: AppLocalizations.of(context).notes,
|
||||
),
|
||||
maxLines: 3,
|
||||
controller: notesController,
|
||||
@@ -651,7 +649,7 @@ class _SessionPageState extends State<SessionPage> {
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration:
|
||||
InputDecoration(labelText: AppLocalizations.of(context)!.timeStart),
|
||||
InputDecoration(labelText: AppLocalizations.of(context).timeStart),
|
||||
controller: timeStartController,
|
||||
onFieldSubmitted: (_) {},
|
||||
onTap: () async {
|
||||
@@ -675,7 +673,7 @@ class _SessionPageState extends State<SessionPage> {
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration:
|
||||
InputDecoration(labelText: AppLocalizations.of(context)!.timeEnd),
|
||||
InputDecoration(labelText: AppLocalizations.of(context).timeEnd),
|
||||
controller: timeEndController,
|
||||
onFieldSubmitted: (_) {},
|
||||
onTap: () async {
|
||||
@@ -698,7 +696,7 @@ class _SessionPageState extends State<SessionPage> {
|
||||
],
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.save),
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save the current values to the weightEntry
|
||||
final isValid = _form.currentState!.validate();
|
||||
|
||||
@@ -49,26 +49,26 @@ class _WorkoutLogsState extends State<WorkoutLogs> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.labelWorkoutLogs,
|
||||
AppLocalizations.of(context).labelWorkoutLogs,
|
||||
style: Theme.of(context).textTheme.headline5,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.logHelpEntries,
|
||||
AppLocalizations.of(context).logHelpEntries,
|
||||
textAlign: TextAlign.justify,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.logHelpEntriesUnits,
|
||||
AppLocalizations.of(context).logHelpEntriesUnits,
|
||||
textAlign: TextAlign.justify,
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.labelWorkoutPlan),
|
||||
child: Text(AppLocalizations.of(context).labelWorkoutPlan),
|
||||
onPressed: () {
|
||||
widget._changeMode(WorkoutScreenMode.workout);
|
||||
},
|
||||
|
||||
@@ -52,13 +52,13 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.newDay),
|
||||
child: Text(AppLocalizations.of(context).newDay),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context)!.newDay,
|
||||
AppLocalizations.of(context).newDay,
|
||||
DayFormWidget(widget._workoutPlan),
|
||||
hasListView: true,
|
||||
),
|
||||
@@ -67,7 +67,7 @@ class _WorkoutPlanDetailState extends State<WorkoutPlanDetail> {
|
||||
),
|
||||
if (widget._workoutPlan.days.length > 0)
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.labelWorkoutLogs),
|
||||
child: Text(AppLocalizations.of(context).labelWorkoutLogs),
|
||||
onPressed: () {
|
||||
widget._changeMode(WorkoutScreenMode.log);
|
||||
},
|
||||
|
||||
@@ -44,7 +44,7 @@ class WorkoutPlansList extends StatelessWidget {
|
||||
builder: (BuildContext contextDialog) {
|
||||
return AlertDialog(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.confirmDelete(currentWorkout.name),
|
||||
AppLocalizations.of(context).confirmDelete(currentWorkout.name),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
@@ -53,7 +53,7 @@ class WorkoutPlansList extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.delete,
|
||||
AppLocalizations.of(context).delete,
|
||||
style: TextStyle(color: Theme.of(context).errorColor),
|
||||
),
|
||||
onPressed: () {
|
||||
@@ -68,7 +68,7 @@ class WorkoutPlansList extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.successfullyDeleted,
|
||||
AppLocalizations.of(context).successfullyDeleted,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
||||
12
pubspec.lock
12
pubspec.lock
@@ -42,7 +42,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.6.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -259,7 +259,7 @@ packages:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
version: "6.1.1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -433,7 +433,7 @@ packages:
|
||||
name: image_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.7.5"
|
||||
version: "0.7.5+2"
|
||||
image_picker_for_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -739,7 +739,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -788,7 +788,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19"
|
||||
version: "0.3.0"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -928,7 +928,7 @@ packages:
|
||||
name: webview_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.4"
|
||||
version: "2.0.6"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user