Skip to content

Commit

Permalink
offered explicit actions for start/pause/resume
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Zhdanov committed Jan 2, 2025
1 parent 89ab596 commit cdee088
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/category/widget/category_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void _addCategory(BuildContext context, FileCategories categoriesNotifier) {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(l10n.textCancel),
child: Text(l10n.actionCancel),
),
ValueListenableBuilder(
valueListenable: hasCategoryNameNotifier,
Expand All @@ -162,7 +162,7 @@ void _addCategory(BuildContext context, FileCategories categoriesNotifier) {
Navigator.of(context).pop();
}
: null,
child: Text(l10n.textAdd),
child: Text(l10n.actionAdd),
),
),
],
Expand Down
4 changes: 2 additions & 2 deletions lib/file/widget/selected_file_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SelectedFileWidget extends ConsumerWidget {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(l10n.textCancel),
child: Text(l10n.actionCancel),
),
ValueListenableBuilder(
valueListenable: hasNameNotifier,
Expand All @@ -65,7 +65,7 @@ class SelectedFileWidget extends ConsumerWidget {
Navigator.of(context).pop();
}
: null,
child: Text(l10n.textAdd),
child: Text(l10n.actionAdd),
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/google/google_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Future<void> _showPermissionsRationale([Set<String> missingScopes = const {}]) {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(AppLocalizations.of(context).textOk),
child: Text(AppLocalizations.of(context).actionOk),
),
],
);
Expand Down
16 changes: 10 additions & 6 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"titleAddNewFile": "Add New File",
"titlePermissionsRationale": "**Your Permissions Enable Key Features**",

"textReset": "Reset",
"textSave": "Save",
"textCancel": "Cancel",
"textAdd": "Add",
"textOk": "Ok",
"textClose": "Close",
"actionReset": "Reset",
"actionSave": "Save",
"actionCancel": "Cancel",
"actionAdd": "Add",
"actionOk": "Ok",
"actionClose": "Close",
"actionStart": "Start",
"actionPause": "Pause",
"actionResume": "Resume",

"textPermissionsRationale": "Our app requires access to your Google Drive and Google Sheets to function properly:\n\n 1. **Google Drive:** To show you a list of your existing Google Sheets and let you create a new one if needed.\n\n 2. **Google Sheets:** To store your stopwatch measurements directly in your chosen Google Sheet.\n\nWe only access the files you select or create through the app. Your data remains private and secure.",

"hintCreateCategory": "create a category",
Expand Down
24 changes: 19 additions & 5 deletions lib/measurement/widget/stop_watch_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class StopWatchState extends ConsumerState<StopWatchWidget> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final l10n = AppLocalizations.of(context);
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down Expand Up @@ -195,16 +196,29 @@ class StopWatchState extends ConsumerState<StopWatchWidget> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_running
? ElevatedButton.icon(
onPressed: _toggle,
icon: Icon(Icons.stop),
label: Text(l10n.actionPause),
)
: ElevatedButton.icon(
onPressed: _toggle,
icon: Icon(Icons.play_arrow),
label: Text(_hasMeasurement() ? l10n.actionResume : l10n.actionStart),
),
SizedBox(width: 8),
ElevatedButton.icon(
onPressed: _hasMeasurement() ? _reset : null,
icon: Icon(Icons.refresh),
label: Text(AppLocalizations.of(context).textReset),
label: Text(l10n.actionReset),
),
SizedBox(width: 20),
SizedBox(width: 18),
ElevatedButton.icon(
onPressed: _hasMeasurement() ? _saveMeasurement : null,
icon: Icon(Icons.save),
label: Text(AppLocalizations.of(context).textSave)),
onPressed: _hasMeasurement() ? _saveMeasurement : null,
icon: Icon(Icons.save),
label: Text(l10n.actionSave),
),
],
)
],
Expand Down

0 comments on commit cdee088

Please sign in to comment.