Skip to content

Commit

Permalink
Add descriptions for various settings
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanSarwar45 committed Jun 29, 2024
1 parent 88e2e0a commit f57105b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
4 changes: 3 additions & 1 deletion fastlane/metadata/android/en-US/changelogs/251.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* Added option to turn on foreground notification to keep app alive
* Added current lap card for stopwatch. Now you can view the current lap time in real time.
* Removed support for Android 5 (min api level now is 23/Android 6)
* Added option to show next alarm in filters

28 changes: 22 additions & 6 deletions lib/common/widgets/fields/switch_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import 'package:flutter/material.dart';

class SwitchField extends StatefulWidget {
const SwitchField(
{Key? key,
{super.key,
required this.value,
required this.onChanged,
required this.name})
: super(key: key);
required this.name,
this.description = ""});

final String name;
final String description;
final bool value;
final void Function(bool value)? onChanged;

Expand All @@ -19,6 +20,11 @@ class SwitchField extends StatefulWidget {
class _SwitchFieldState extends State<SwitchField> {
@override
Widget build(BuildContext context) {
ThemeData theme = Theme.of(context);
TextTheme textTheme = theme.textTheme;



return Material(
color: Colors.transparent,
child: InkWell(
Expand All @@ -29,9 +35,19 @@ class _SwitchFieldState extends State<SwitchField> {
children: [
Expanded(
flex: 100,
child: Text(
widget.name,
style: Theme.of(context).textTheme.headlineMedium,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.name,
style: textTheme.headlineMedium,
),
if (widget.description.isNotEmpty)
Text(widget.description, style: textTheme.bodyMedium)
],
),
),
),
const Spacer(),
Expand Down
8 changes: 7 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -706,5 +706,11 @@
"showNextAlarm": "Show Next Alarm",
"@showNextAlarm": {},
"showForegroundNotification": "Show Foreground Notification",
"@showForegroundNotification": {}
"@showForegroundNotification": {},
"showForegroundNotificationDescription": "Show a persistent notification to keep app alive",
"@showForegroundNotificationDescription": {},
"notificationPermissionDescription": "Allow notifications to be showed",
"@notificationPermissionDescription": {},
"extraAnimationSettingDescription": "Show animations that are notpolished and might cause frame drops in low-end devices",
"@extraAnimationSettingDescription": {}
}
22 changes: 15 additions & 7 deletions lib/settings/data/general_settings_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ SettingGroup generalSettingsSchema = SettingGroup(
"Date Format",
(context) => AppLocalizations.of(context)!.dateFormatSetting,
dateFormatOptions,
getDescription: (context) => "How to display the dates",
onChange: (context, index) async {
// await HomeWidget.saveWidgetData(
// "dateFormat", dateFormatOptions[index].value);
Expand All @@ -118,7 +117,6 @@ SettingGroup generalSettingsSchema = SettingGroup(
"Long Date Format",
(context) => AppLocalizations.of(context)!.longDateFormatSetting,
longDateFormatOptions,
getDescription: (context) => "How to display the dates",
onChange: (context, index) async {
setDigitalClockWidgetData(context);

Expand All @@ -131,7 +129,6 @@ SettingGroup generalSettingsSchema = SettingGroup(
"Time Format",
(context) => AppLocalizations.of(context)!.timeFormatSetting,
timeFormatOptions,
getDescription: (context) => "12 or 24 hour time",
onChange: (context, index) async {
String timeFormat =
getTimeFormatString(context, timeFormatOptions[index].value);
Expand Down Expand Up @@ -231,7 +228,13 @@ SettingGroup generalSettingsSchema = SettingGroup(
),
SettingGroup("Reliability",
(context) => AppLocalizations.of(context)!.reliabilitySettingGroup, [
SwitchSetting("Show Foreground Notification", (context) => AppLocalizations.of(context)!.showForegroundNotification, false),
SwitchSetting(
"Show Foreground Notification",
(context) => AppLocalizations.of(context)!.showForegroundNotification,
false,
getDescription: (context) =>
AppLocalizations.of(context)!.showForegroundNotificationDescription,
),
SettingAction(
"Ignore Battery Optimizations",
(context) =>
Expand Down Expand Up @@ -261,6 +264,8 @@ SettingGroup generalSettingsSchema = SettingGroup(
.notificationPermissionAlreadyGranted)
});
},
getDescription: (context) =>
AppLocalizations.of(context)!.notificationPermissionDescription,
),
SettingAction(
"Vendor Specific",
Expand Down Expand Up @@ -351,9 +356,12 @@ SettingGroup generalSettingsSchema = SettingGroup(
// ],
),
SwitchSetting(
"Extra Animations",
(context) => AppLocalizations.of(context)!.extraAnimationSetting,
false),
"Extra Animations",
(context) => AppLocalizations.of(context)!.extraAnimationSetting,
false,
getDescription: (context) =>
AppLocalizations.of(context)!.extraAnimationSettingDescription,
),
])
],
icon: FluxIcons.settings,
Expand Down
1 change: 1 addition & 0 deletions lib/settings/widgets/switch_setting_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class _SwitchSettingCardState extends State<SwitchSettingCard> {
SwitchField switchCard = SwitchField(
name: widget.setting.displayName(context),
value: widget.setting.value,
description: widget.setting.displayDescription(context),
onChanged: (value) {
setState(() {
widget.setting.setValue(context, value);
Expand Down

0 comments on commit f57105b

Please sign in to comment.