mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 14:29:35 +00:00
中文翻译
This commit is contained in:
parent
f671b704cf
commit
e354949cc1
13 changed files with 1692 additions and 163 deletions
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart';
|
||||
import 'package:vaani/settings/view/simple_settings_page.dart';
|
||||
import 'package:vaani/shared/extensions/time_of_day.dart';
|
||||
|
|
@ -22,7 +23,7 @@ class AutoSleepTimerSettingsPage extends HookConsumerWidget {
|
|||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).disabledColor;
|
||||
return SimpleSettingsPage(
|
||||
title: const Text('Auto Sleep Timer Settings'),
|
||||
title: Text(S.of(context).autoSleepTimerSettings),
|
||||
sections: [
|
||||
SettingsSection(
|
||||
margin: const EdgeInsetsDirectional.symmetric(
|
||||
|
|
@ -32,9 +33,9 @@ class AutoSleepTimerSettingsPage extends HookConsumerWidget {
|
|||
tiles: [
|
||||
SettingsTile.switchTile(
|
||||
// initialValue: sleepTimerSettings.autoTurnOnTimer,
|
||||
title: const Text('Auto Turn On Timer'),
|
||||
description: const Text(
|
||||
'Automatically turn on the sleep timer based on the time of day',
|
||||
title: Text(S.of(context).autoTurnOnTimer),
|
||||
description: Text(
|
||||
S.of(context).autoTurnOnTimerDescription,
|
||||
),
|
||||
leading: sleepTimerSettings.autoTurnOnTimer
|
||||
? const Icon(Symbols.time_auto)
|
||||
|
|
@ -52,9 +53,9 @@ class AutoSleepTimerSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile.navigation(
|
||||
enabled: enabled,
|
||||
leading: const Icon(Symbols.timer_play),
|
||||
title: const Text('From'),
|
||||
description: const Text(
|
||||
'Turn on the sleep timer at the specified time',
|
||||
title: Text(S.of(context).autoTurnOnTimerFrom),
|
||||
description: Text(
|
||||
S.of(context).autoTurnOnTimerFromDescription,
|
||||
),
|
||||
onPressed: (context) async {
|
||||
// navigate to the time picker
|
||||
|
|
@ -78,9 +79,9 @@ class AutoSleepTimerSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile.navigation(
|
||||
enabled: enabled,
|
||||
leading: const Icon(Symbols.timer_pause),
|
||||
title: const Text('Until'),
|
||||
description: const Text(
|
||||
'Turn off the sleep timer at the specified time',
|
||||
title: Text(S.of(context).autoTurnOnTimerUntil),
|
||||
description: Text(
|
||||
S.of(context).autoTurnOnTimerUntilDescription,
|
||||
),
|
||||
onPressed: (context) async {
|
||||
// navigate to the time picker
|
||||
|
|
@ -107,9 +108,9 @@ class AutoSleepTimerSettingsPage extends HookConsumerWidget {
|
|||
// switch tile for always auto turn on timer no matter what
|
||||
SettingsTile.switchTile(
|
||||
leading: const Icon(Symbols.all_inclusive),
|
||||
title: const Text('Always Auto Turn On Timer'),
|
||||
description: const Text(
|
||||
'Always turn on the sleep timer, no matter what',
|
||||
title: Text(S.of(context).autoTurnOnTimerAlways),
|
||||
description: Text(
|
||||
S.of(context).autoTurnOnTimerAlwaysDescription,
|
||||
),
|
||||
onToggle: (value) {
|
||||
ref.read(appSettingsProvider.notifier).update(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart';
|
||||
import 'package:vaani/settings/view/simple_settings_page.dart'
|
||||
show SimpleSettingsPage;
|
||||
|
|
@ -14,10 +15,10 @@ class HomePageSettingsPage extends HookConsumerWidget {
|
|||
final appSettingsNotifier = ref.read(appSettingsProvider.notifier);
|
||||
|
||||
return SimpleSettingsPage(
|
||||
title: Text('Home Page Settings'),
|
||||
title: Text(S.of(context).homePageSettings),
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('Quick Play'),
|
||||
title: Text(S.of(context).homePageSettingsQuickPlay),
|
||||
margin: const EdgeInsetsDirectional.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0,
|
||||
|
|
@ -26,11 +27,10 @@ class HomePageSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile.switchTile(
|
||||
initialValue: appSettings
|
||||
.homePageSettings.showPlayButtonOnContinueListeningShelf,
|
||||
title: const Text('Continue Listening'),
|
||||
title: Text(S.of(context).homeContinueListening),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
description: const Text(
|
||||
'Show play button for books in currently listening shelf',
|
||||
),
|
||||
description:
|
||||
Text(S.of(context).homeBookContinueListeningDescription),
|
||||
onToggle: (value) {
|
||||
appSettingsNotifier.update(
|
||||
appSettings.copyWith(
|
||||
|
|
@ -42,11 +42,10 @@ class HomePageSettingsPage extends HookConsumerWidget {
|
|||
},
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Continue Series'),
|
||||
title: Text(S.of(context).homeBookContinueSeries),
|
||||
leading: const Icon(Icons.play_arrow),
|
||||
description: const Text(
|
||||
'Show play button for books in continue series shelf',
|
||||
),
|
||||
description:
|
||||
Text(S.of(context).homeBookContinueSeriesDescription),
|
||||
initialValue: appSettings
|
||||
.homePageSettings.showPlayButtonOnContinueSeriesShelf,
|
||||
onToggle: (value) {
|
||||
|
|
@ -60,11 +59,10 @@ class HomePageSettingsPage extends HookConsumerWidget {
|
|||
},
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Other shelves'),
|
||||
title: Text(S.of(context).homePageSettingsOtherShelves),
|
||||
leading: const Icon(Icons.all_inclusive),
|
||||
description: const Text(
|
||||
'Show play button for all books in all remaining shelves',
|
||||
),
|
||||
description:
|
||||
Text(S.of(context).homePageSettingsOtherShelvesDescription),
|
||||
initialValue: appSettings
|
||||
.homePageSettings.showPlayButtonOnAllRemainingShelves,
|
||||
onToggle: (value) {
|
||||
|
|
@ -78,11 +76,9 @@ class HomePageSettingsPage extends HookConsumerWidget {
|
|||
},
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Listen Again'),
|
||||
title: Text(S.of(context).homeBookListenAgain),
|
||||
leading: const Icon(Icons.replay),
|
||||
description: const Text(
|
||||
'Show play button for all books in listen again shelf',
|
||||
),
|
||||
description: Text(S.of(context).homeBookListenAgainDescription),
|
||||
initialValue:
|
||||
appSettings.homePageSettings.showPlayButtonOnListenAgainShelf,
|
||||
onToggle: (value) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart';
|
||||
import 'package:vaani/settings/models/app_settings.dart';
|
||||
import 'package:vaani/settings/view/buttons.dart';
|
||||
|
|
@ -19,7 +20,7 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
final notificationSettings = appSettings.notificationSettings;
|
||||
final primaryColor = Theme.of(context).colorScheme.primary;
|
||||
return SimpleSettingsPage(
|
||||
title: const Text('Notification Settings'),
|
||||
title: Text(S.of(context).notificationMediaPlayer),
|
||||
sections: [
|
||||
SettingsSection(
|
||||
margin: const EdgeInsetsDirectional.only(
|
||||
|
|
@ -31,10 +32,10 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
tiles: [
|
||||
// set the primary and secondary titles
|
||||
SettingsTile(
|
||||
title: const Text('Primary Title'),
|
||||
title: Text(S.of(context).nmpSettingsTitle),
|
||||
description: Text.rich(
|
||||
TextSpan(
|
||||
text: 'The title of the notification\n',
|
||||
text: S.of(context).nmpSettingsTitleDescription,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: notificationSettings.primaryTitle,
|
||||
|
|
@ -54,7 +55,7 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
builder: (context) {
|
||||
return NotificationTitlePicker(
|
||||
initialValue: notificationSettings.primaryTitle,
|
||||
title: 'Primary Title',
|
||||
title: S.of(context).nmpSettingsTitle,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
@ -69,10 +70,10 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
),
|
||||
|
||||
SettingsTile(
|
||||
title: const Text('Secondary Title'),
|
||||
title: Text(S.of(context).nmpSettingsSubTitle),
|
||||
description: Text.rich(
|
||||
TextSpan(
|
||||
text: 'The subtitle of the notification\n',
|
||||
text: S.of(context).nmpSettingsSubTitleDescription,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: notificationSettings.secondaryTitle,
|
||||
|
|
@ -92,7 +93,7 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
builder: (context) {
|
||||
return NotificationTitlePicker(
|
||||
initialValue: notificationSettings.secondaryTitle,
|
||||
title: 'Secondary Title',
|
||||
title: S.of(context).nmpSettingsSubTitle,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
@ -108,11 +109,13 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
|
||||
// set forward and backward intervals
|
||||
SettingsTile(
|
||||
title: const Text('Forward Interval'),
|
||||
title: Text(S.of(context).nmpSettingsForward),
|
||||
description: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${notificationSettings.fastForwardInterval.inSeconds} seconds',
|
||||
S.of(context).timeSecond(
|
||||
notificationSettings.fastForwardInterval.inSeconds,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TimeIntervalSlider(
|
||||
|
|
@ -131,11 +134,13 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
leading: const Icon(Icons.fast_forward),
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Backward Interval'),
|
||||
title: Text(S.of(context).nmpSettingsBackward),
|
||||
description: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${notificationSettings.rewindInterval.inSeconds} seconds',
|
||||
S.of(context).timeSecond(
|
||||
notificationSettings.rewindInterval.inSeconds,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TimeIntervalSlider(
|
||||
|
|
@ -155,10 +160,11 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
),
|
||||
// set the media controls
|
||||
SettingsTile(
|
||||
title: const Text('Media Controls'),
|
||||
title: Text(S.of(context).nmpSettingsMediaControls),
|
||||
leading: const Icon(Icons.control_camera),
|
||||
// description: const Text('Select the media controls to display'),
|
||||
description: const Text('Select the media controls to display'),
|
||||
description:
|
||||
Text(S.of(context).nmpSettingsMediaControlsDescription),
|
||||
trailing: Wrap(
|
||||
spacing: 8.0,
|
||||
children: notificationSettings.mediaControls
|
||||
|
|
@ -192,10 +198,10 @@ class NotificationSettingsPage extends HookConsumerWidget {
|
|||
|
||||
// set the progress bar to show chapter progress
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Show Chapter Progress'),
|
||||
title: Text(S.of(context).nmpSettingsShowChapterProgress),
|
||||
leading: const Icon(Icons.book),
|
||||
description:
|
||||
const Text('instead of the overall progress of the book'),
|
||||
Text(S.of(context).nmpSettingsShowChapterProgressDescription),
|
||||
initialValue: notificationSettings.progressBarIsChapterProgress,
|
||||
onToggle: (value) {
|
||||
ref.read(appSettingsProvider.notifier).update(
|
||||
|
|
@ -224,7 +230,7 @@ class MediaControlsPicker extends HookConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final selectedMediaControls = useState(selectedControls);
|
||||
return AlertDialog(
|
||||
title: const Text('Media Controls'),
|
||||
title: Text(S.of(context).nmpSettingsMediaControls),
|
||||
actions: [
|
||||
const CancelButton(),
|
||||
OkButton(
|
||||
|
|
@ -296,7 +302,7 @@ class TimeIntervalSlider extends HookConsumerWidget {
|
|||
min: min.inSeconds.toDouble(),
|
||||
max: max.inSeconds.toDouble(),
|
||||
divisions: ((max.inSeconds - min.inSeconds) ~/ step.inSeconds),
|
||||
label: '${selectedInterval.value.inSeconds} seconds',
|
||||
label: S.of(context).timeSecond(selectedInterval.value.inSeconds),
|
||||
onChanged: (value) {
|
||||
selectedInterval.value = Duration(seconds: value.toInt());
|
||||
onChanged?.call(selectedInterval.value);
|
||||
|
|
@ -345,7 +351,7 @@ class NotificationTitlePicker extends HookConsumerWidget {
|
|||
selectedTitle.value = value;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
helper: const Text('Select a field below to insert it'),
|
||||
helper: Text(S.of(context).nmpSettingsSelectOne),
|
||||
suffix: IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
|
|
|
|||
|
|
@ -150,10 +150,10 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
),
|
||||
// when to mark complete
|
||||
SettingsTile(
|
||||
title: const Text('Mark Complete When Time Left'),
|
||||
title: Text(S.of(context).playerSettingsCompleteTime),
|
||||
description: Text.rich(
|
||||
TextSpan(
|
||||
text: 'Mark complete when less than ',
|
||||
text: S.of(context).playerSettingsCompleteTimeDescriptionHead,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: playerSettings
|
||||
|
|
@ -163,7 +163,10 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: ' left in the book'),
|
||||
TextSpan(
|
||||
text: S
|
||||
.of(context)
|
||||
.playerSettingsCompleteTimeDescriptionTail),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -173,7 +176,7 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return TimeDurationSelector(
|
||||
title: const Text('Mark Complete When Time Left'),
|
||||
title: Text(S.of(context).playerSettingsCompleteTime),
|
||||
baseUnit: BaseUnit.second,
|
||||
initialValue: playerSettings.markCompleteWhenTimeLeft,
|
||||
);
|
||||
|
|
@ -190,10 +193,12 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
),
|
||||
// playback report interval
|
||||
SettingsTile(
|
||||
title: const Text('Playback Report Interval'),
|
||||
title: Text(S.of(context).playerSettingsPlaybackInterval),
|
||||
description: Text.rich(
|
||||
TextSpan(
|
||||
text: 'Report progress every ',
|
||||
text: S
|
||||
.of(context)
|
||||
.playerSettingsPlaybackIntervalDescriptionHead,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: playerSettings
|
||||
|
|
@ -203,7 +208,10 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: ' to the server'),
|
||||
TextSpan(
|
||||
text: S
|
||||
.of(context)
|
||||
.playerSettingsPlaybackIntervalDescriptionTail),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -213,7 +221,7 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return TimeDurationSelector(
|
||||
title: const Text('Playback Report Interval'),
|
||||
title: Text(S.of(context).playerSettingsPlaybackInterval),
|
||||
baseUnit: BaseUnit.second,
|
||||
initialValue: playerSettings.playbackReportInterval,
|
||||
);
|
||||
|
|
@ -232,14 +240,14 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
),
|
||||
// Display Settings
|
||||
SettingsSection(
|
||||
title: const Text('Display Settings'),
|
||||
title: Text(S.of(context).playerSettingsDisplay),
|
||||
tiles: [
|
||||
// show total progress
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Show Total Progress'),
|
||||
title: Text(S.of(context).playerSettingsDisplayTotalProgress),
|
||||
leading: const Icon(Icons.show_chart),
|
||||
description: const Text(
|
||||
'Show the total progress of the book in the player',
|
||||
description: Text(
|
||||
S.of(context).playerSettingsDisplayTotalProgressDescription,
|
||||
),
|
||||
initialValue:
|
||||
playerSettings.expandedPlayerSettings.showTotalProgress,
|
||||
|
|
@ -252,10 +260,10 @@ class PlayerSettingsPage extends HookConsumerWidget {
|
|||
),
|
||||
// show chapter progress
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Show Chapter Progress'),
|
||||
title: Text(S.of(context).playerSettingsDisplayChapterProgress),
|
||||
leading: const Icon(Icons.show_chart),
|
||||
description: const Text(
|
||||
'Show the progress of the current chapter in the player',
|
||||
description: Text(
|
||||
S.of(context).playerSettingsDisplayChapterProgressDescription,
|
||||
),
|
||||
initialValue:
|
||||
playerSettings.expandedPlayerSettings.showChapterProgress,
|
||||
|
|
@ -326,7 +334,7 @@ class SpeedPicker extends HookConsumerWidget {
|
|||
useTextEditingController(text: initialValue.toString());
|
||||
final speed = useState<double?>(initialValue);
|
||||
return AlertDialog(
|
||||
title: const Text('Select Speed'),
|
||||
title: Text(S.of(context).playerSettingsSpeedSelect),
|
||||
content: TextField(
|
||||
controller: speedController,
|
||||
onChanged: (value) => speed.value = double.tryParse(value),
|
||||
|
|
@ -335,11 +343,9 @@ class SpeedPicker extends HookConsumerWidget {
|
|||
},
|
||||
autofocus: true,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Speed',
|
||||
helper: Text(
|
||||
'Enter the speed you want to set when playing for the first time',
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
labelText: S.of(context).playerSettingsSpeed,
|
||||
helper: Text(S.of(context).playerSettingsSpeedSelectHelper),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
|
|
@ -368,7 +374,7 @@ class SpeedOptionsPicker extends HookConsumerWidget {
|
|||
final speedOptions = useState<List<double>>(initialValue);
|
||||
final focusNode = useFocusNode();
|
||||
return AlertDialog(
|
||||
title: const Text('Select Speed Options'),
|
||||
title: Text(S.of(context).playerSettingsSpeedOptionsSelect),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
|
@ -413,9 +419,10 @@ class SpeedOptionsPicker extends HookConsumerWidget {
|
|||
focusNode.requestFocus();
|
||||
},
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Add Speed Option',
|
||||
helper: Text('Enter a new speed option to add'),
|
||||
decoration: InputDecoration(
|
||||
labelText: S.of(context).playerSettingsSpeedOptionsSelectAdd,
|
||||
helper:
|
||||
Text(S.of(context).playerSettingsSpeedOptionsSelectAddHelper),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart';
|
||||
import 'package:vaani/settings/models/app_settings.dart';
|
||||
import 'package:vaani/settings/view/buttons.dart';
|
||||
|
|
@ -23,7 +24,7 @@ class ShakeDetectorSettingsPage extends HookConsumerWidget {
|
|||
: Theme.of(context).disabledColor;
|
||||
|
||||
return SimpleSettingsPage(
|
||||
title: const Text('Shake Detector Settings'),
|
||||
title: Text(S.of(context).shakeDetectorSettings),
|
||||
sections: [
|
||||
SettingsSection(
|
||||
margin: const EdgeInsetsDirectional.symmetric(
|
||||
|
|
@ -35,9 +36,9 @@ class ShakeDetectorSettingsPage extends HookConsumerWidget {
|
|||
leading: shakeDetectionSettings.isEnabled
|
||||
? const Icon(Icons.vibration)
|
||||
: const Icon(Icons.not_interested),
|
||||
title: const Text('Enable Shake Detection'),
|
||||
description: const Text(
|
||||
'Enable shake detection to do various actions',
|
||||
title: Text(S.of(context).shakeDetectorEnable),
|
||||
description: Text(
|
||||
S.of(context).shakeDetectorEnableDescription,
|
||||
),
|
||||
initialValue: shakeDetectionSettings.isEnabled,
|
||||
onToggle: (value) {
|
||||
|
|
@ -57,9 +58,9 @@ class ShakeDetectorSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile(
|
||||
enabled: isShakeDetectionEnabled,
|
||||
leading: const Icon(Icons.flag_circle),
|
||||
title: const Text('Shake Activation Threshold'),
|
||||
description: const Text(
|
||||
'The higher the threshold, the harder you need to shake',
|
||||
title: Text(S.of(context).shakeActivationThreshold),
|
||||
description: Text(
|
||||
S.of(context).shakeActivationThresholdDescription,
|
||||
),
|
||||
trailing: Text(
|
||||
'${shakeDetectionSettings.threshold} m/s²',
|
||||
|
|
@ -90,9 +91,9 @@ class ShakeDetectorSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile(
|
||||
enabled: isShakeDetectionEnabled,
|
||||
leading: const Icon(Icons.directions_run),
|
||||
title: const Text('Shake Action'),
|
||||
description: const Text(
|
||||
'The action to perform when a shake is detected',
|
||||
title: Text(S.of(context).shakeAction),
|
||||
description: Text(
|
||||
S.of(context).shakeActionDescription,
|
||||
),
|
||||
trailing: Icon(
|
||||
shakeDetectionSettings.shakeAction.icon,
|
||||
|
|
@ -120,9 +121,9 @@ class ShakeDetectorSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile(
|
||||
enabled: isShakeDetectionEnabled,
|
||||
leading: const Icon(Icons.feedback),
|
||||
title: const Text('Shake Feedback'),
|
||||
description: const Text(
|
||||
'The feedback to give when a shake is detected',
|
||||
title: Text(S.of(context).shakeFeedback),
|
||||
description: Text(
|
||||
S.of(context).shakeFeedbackDescription,
|
||||
),
|
||||
trailing: shakeDetectionSettings.feedback.isEmpty
|
||||
? Icon(
|
||||
|
|
@ -177,7 +178,7 @@ class ShakeFeedbackSelector extends HookConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final feedback = useState(initialValue);
|
||||
return AlertDialog(
|
||||
title: const Text('Select Shake Feedback'),
|
||||
title: Text(S.of(context).shakeSelectFeedback),
|
||||
content: Wrap(
|
||||
spacing: 8.0,
|
||||
runSpacing: 8.0,
|
||||
|
|
@ -225,7 +226,7 @@ class ShakeActionSelector extends HookConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final shakeAction = useState(initialValue);
|
||||
return AlertDialog(
|
||||
title: const Text('Select Shake Action'),
|
||||
title: Text(S.of(context).shakeSelectAction),
|
||||
content: Wrap(
|
||||
spacing: 8.0,
|
||||
runSpacing: 8.0,
|
||||
|
|
@ -268,7 +269,7 @@ class ShakeForceSelector extends HookConsumerWidget {
|
|||
final shakeForce = useState(initialValue);
|
||||
final controller = useTextEditingController(text: initialValue.toString());
|
||||
return AlertDialog(
|
||||
title: const Text('Select Shake Activation Threshold'),
|
||||
title: Text(S.of(context).shakeSelectActivationThreshold),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
|
@ -291,8 +292,8 @@ class ShakeForceSelector extends HookConsumerWidget {
|
|||
shakeForce.value = 0;
|
||||
},
|
||||
),
|
||||
helper: const Text(
|
||||
'Enter a number to set the threshold in m/s²',
|
||||
helper: Text(
|
||||
S.of(context).shakeSelectActivationThresholdHelper,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart';
|
||||
import 'package:vaani/settings/view/buttons.dart';
|
||||
import 'package:vaani/settings/view/simple_settings_page.dart';
|
||||
import 'package:vaani/shared/extensions/enum.dart';
|
||||
|
||||
class ThemeSettingsPage extends HookConsumerWidget {
|
||||
const ThemeSettingsPage({
|
||||
|
|
@ -18,10 +16,10 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final appSettings = ref.watch(appSettingsProvider);
|
||||
final themeSettings = appSettings.themeSettings;
|
||||
final primaryColor = Theme.of(context).colorScheme.primary;
|
||||
// final primaryColor = Theme.of(context).colorScheme.primary;
|
||||
|
||||
return SimpleSettingsPage(
|
||||
title: const Text('Theme Settings'),
|
||||
title: Text(S.of(context).themeSettings),
|
||||
sections: [
|
||||
SettingsSection(
|
||||
margin: const EdgeInsetsDirectional.symmetric(
|
||||
|
|
@ -31,7 +29,7 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
tiles: [
|
||||
// choose system , light or dark theme
|
||||
SettingsTile(
|
||||
title: const Text('Theme Mode'),
|
||||
title: Text(S.of(context).themeMode),
|
||||
description: SegmentedButton(
|
||||
expandedInsets: const EdgeInsets.only(top: 8.0),
|
||||
showSelectedIcon: true,
|
||||
|
|
@ -48,17 +46,17 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
ButtonSegment(
|
||||
value: ThemeMode.light,
|
||||
icon: Icon(Icons.light_mode),
|
||||
label: const Text('Light'),
|
||||
label: Text(S.of(context).themeModeLight),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ThemeMode.system,
|
||||
icon: Icon(Icons.auto_awesome),
|
||||
label: const Text('System'),
|
||||
label: Text(S.of(context).themeModeSystem),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ThemeMode.dark,
|
||||
icon: Icon(Icons.dark_mode),
|
||||
label: const Text('Dark'),
|
||||
label: Text(S.of(context).themeModeDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -77,9 +75,9 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
? const Icon(Icons.accessibility)
|
||||
: const Icon(Icons.accessibility_new_outlined),
|
||||
initialValue: themeSettings.highContrast,
|
||||
title: const Text('High Contrast Mode'),
|
||||
description: const Text(
|
||||
'Increase the contrast between the background and the text',
|
||||
title: Text(S.of(context).themeModeHighContrast),
|
||||
description: Text(
|
||||
S.of(context).themeModeHighContrastDescription,
|
||||
),
|
||||
onToggle: (value) {
|
||||
ref.read(appSettingsProvider.notifier).update(
|
||||
|
|
@ -94,11 +92,9 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
SettingsTile.switchTile(
|
||||
initialValue: themeSettings.useMaterialThemeFromSystem,
|
||||
title: Platform.isAndroid
|
||||
? const Text('Use Material You')
|
||||
: const Text('Material Theme from System'),
|
||||
description: const Text(
|
||||
'Use the system theme colors for the app',
|
||||
),
|
||||
? Text(S.of(context).themeSettingsColorsAndroid)
|
||||
: Text(S.of(context).themeSettingsColors),
|
||||
description: Text(S.of(context).themeSettingsColorsDescription),
|
||||
leading: themeSettings.useMaterialThemeFromSystem
|
||||
? const Icon(Icons.auto_awesome)
|
||||
: const Icon(Icons.auto_fix_off),
|
||||
|
|
@ -156,10 +152,9 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
// use theme throughout the app when playing item
|
||||
SettingsTile.switchTile(
|
||||
initialValue: themeSettings.useCurrentPlayerThemeThroughoutApp,
|
||||
title: const Text('Adapt theme from currently playing item'),
|
||||
description: const Text(
|
||||
'Use the theme colors from the currently playing item for the app',
|
||||
),
|
||||
title: Text(S.of(context).themeSettingsColorsCurrent),
|
||||
description:
|
||||
Text(S.of(context).themeSettingsColorsCurrentDescription),
|
||||
leading: themeSettings.useCurrentPlayerThemeThroughoutApp
|
||||
? const Icon(Icons.auto_fix_high)
|
||||
: const Icon(Icons.auto_fix_off),
|
||||
|
|
@ -174,10 +169,9 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
|
||||
SettingsTile.switchTile(
|
||||
initialValue: themeSettings.useMaterialThemeOnItemPage,
|
||||
title: const Text('Adaptive Theme on Item Page'),
|
||||
description: const Text(
|
||||
'get fancy with the colors on the item page at the cost of some performance',
|
||||
),
|
||||
title: Text(S.of(context).themeSettingsColorsBook),
|
||||
description:
|
||||
Text(S.of(context).themeSettingsColorsBookDescription),
|
||||
leading: themeSettings.useMaterialThemeOnItemPage
|
||||
? const Icon(Icons.auto_fix_high)
|
||||
: const Icon(Icons.auto_fix_off),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue