Commit 6dedc20
Changed files (4)
lib
l10n
screens
lib/l10n/app_en.arb
@@ -32,6 +32,7 @@
},
"errNoFileOpened": "no file opened",
"errNotStarted": "not started'",
+ "errNoValue": "Please enter a value",
"btnCancel": "CANCEL",
"btnSave": "SAVE",
@@ -111,5 +112,19 @@
"type": "String"
}
}
- }
+ },
+
+ "warnValues": "warn values",
+ "warnAboutTxt1": "The warn values are a pure suggestions and no medical advice.",
+ "warnAboutTxt2": "The default age dependent values come from this source.",
+ "warnAboutTxt3": "Feel free to change the values to suit your needs and follow the recommendations of your doctor.",
+
+ "enterTimeFormatTxt1": "A formatter String consists of a mixture of predefined ICU/Skeleton Strings and any other text you want to include.",
+ "enterTimeFormatTxt2": "For a full list of valid formats please look here.",
+ "enterTimeFormatTxt3": "Please note that having longer/shorter format Strings wont magically change the width of the table columns, so it might come to awkward line breaks.",
+ "enterTimeFormatTxt4": "default: \"yy-MM-dd H:mm\"",
+ "enterTimeFormatString": "time-format string",
+
+ "dateFormatting": "Date formatting"
+
}
\ No newline at end of file
lib/screens/subsettings/enter_timeformat.dart
@@ -1,6 +1,7 @@
import 'package:blood_pressure_app/model/settings_store.dart';
import 'package:blood_pressure_app/screens/subsettings/time_formats_explainer.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
class EnterTimeFormatScreen extends StatefulWidget {
@@ -29,28 +30,30 @@ class _EnterTimeFormatScreenState extends State<EnterTimeFormatScreen> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const Text(
- 'A formatter String consists of a mixture of predefined ICU/Skeleton Strings and any other text you want to include.'),
+ Text(AppLocalizations.of(context)!.enterTimeFormatTxt1),
InkWell(
onTap: () async {
- Navigator.push(context, MaterialPageRoute(builder: (context) => const TimeFormattingHelp()));
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) =>
+ const TimeFormattingHelp()));
},
- child: const SizedBox(
+ child: SizedBox(
height: 48,
child: Center(
child: Text(
- 'For a full list of valid formats please look here.',
- style: TextStyle(color: Colors.blue),
+ AppLocalizations.of(context)!.enterTimeFormatTxt2,
+ style: const TextStyle(color: Colors.blue),
),
),
),
),
- const Text(
- 'Please note that having longer/shorter format Strings wont magically change the width of the table columns, so it might come to awkward line breaks.'),
+ Text(AppLocalizations.of(context)!.enterTimeFormatTxt3),
const SizedBox(
height: 7,
),
- const Text('default: "yy-MM-dd H:mm"'),
+ Text(AppLocalizations.of(context)!.enterTimeFormatTxt4),
const SizedBox(
height: 10,
),
@@ -58,10 +61,12 @@ class _EnterTimeFormatScreenState extends State<EnterTimeFormatScreen> {
_newVal = settings.dateFormatString;
return TextFormField(
initialValue: _newVal,
- decoration: const InputDecoration(hintText: 'format string'),
+ decoration: InputDecoration(
+ hintText: AppLocalizations.of(context)!
+ .enterTimeFormatString),
validator: (String? value) {
if (value == null || value.isEmpty) {
- return 'Please enter a value';
+ return AppLocalizations.of(context)!.errNoValue;
} else {
_newVal = value;
}
@@ -78,18 +83,22 @@ class _EnterTimeFormatScreenState extends State<EnterTimeFormatScreen> {
onPressed: () {
Navigator.of(context).pop();
},
- style: ElevatedButton.styleFrom(backgroundColor: Theme.of(context).unselectedWidgetColor),
- child: const Text('CANCEL')),
+ style: ElevatedButton.styleFrom(
+ backgroundColor:
+ Theme.of(context).unselectedWidgetColor),
+ child: Text(AppLocalizations.of(context)!.btnCancel)),
const Spacer(),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
- Provider.of<Settings>(context, listen: false).dateFormatString = _newVal;
+ Provider.of<Settings>(context, listen: false)
+ .dateFormatString = _newVal;
Navigator.of(context).pop();
}
},
- style: ElevatedButton.styleFrom(backgroundColor: Theme.of(context).primaryColor),
- child: const Text('SAVE'))
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Theme.of(context).primaryColor),
+ child: Text(AppLocalizations.of(context)!.btnSave))
],
)
],
lib/screens/subsettings/time_formats_explainer.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class TimeFormattingHelp extends StatelessWidget {
const TimeFormattingHelp({super.key});
@@ -45,14 +46,17 @@ class TimeFormattingHelp extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: const Text('Date formatting'),
+ title: Text(AppLocalizations.of(context)!.dateFormatting),
backgroundColor: Theme.of(context).primaryColor,
),
body: Container(
padding: const EdgeInsets.all(20),
child: SingleChildScrollView(
child: Table(
- columnWidths: const {0: FlexColumnWidth(0.71), 1: FlexColumnWidth(0.29)},
+ columnWidths: const {
+ 0: FlexColumnWidth(0.71),
+ 1: FlexColumnWidth(0.29)
+ },
children: getRows(),
),
),
lib/screens/subsettings/warn_about.dart
@@ -1,5 +1,6 @@
import 'package:blood_pressure_app/model/blood_pressure.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutWarnValuesScreen extends StatelessWidget {
@@ -9,7 +10,7 @@ class AboutWarnValuesScreen extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: const Text('Warn values'),
+ title: Text(AppLocalizations.of(context)!.warnValues),
backgroundColor: Theme.of(context).primaryColor,
),
body: Center(
@@ -19,7 +20,7 @@ class AboutWarnValuesScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const Text('The warn values are a pure suggestions and no medical advice.'),
+ Text(AppLocalizations.of(context)!.warnAboutTxt1),
const SizedBox(
height: 5,
),
@@ -28,17 +29,18 @@ class AboutWarnValuesScreen extends StatelessWidget {
final url = Uri.parse(BloodPressureWarnValues.source);
if (await canLaunchUrl(url)) {
await launchUrl(url, mode: LaunchMode.externalApplication);
- } else {
- ScaffoldMessenger.of(context)
- .showSnackBar(SnackBar(content: Text('Can\'t open URL:\n${BloodPressureWarnValues.source}')));
+ } else if (context.mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(SnackBar(
+ content: Text(AppLocalizations.of(context)!
+ .errCantOpenURL(BloodPressureWarnValues.source))));
}
},
- child: const SizedBox(
+ child: SizedBox(
height: 48,
child: Center(
child: Text(
- "The default age dependent values come from this source.",
- style: TextStyle(color: Colors.blue),
+ AppLocalizations.of(context)!.warnAboutTxt2,
+ style: const TextStyle(color: Colors.blue),
),
),
),
@@ -46,8 +48,7 @@ class AboutWarnValuesScreen extends StatelessWidget {
const SizedBox(
height: 5,
),
- const Text(
- 'Feel free to change the values to suit your needs and follow the recommendations of your doctor.'),
+ Text(AppLocalizations.of(context)!.warnAboutTxt3),
],
),
),