Skip to content

Commit

Permalink
enhancement to options to show the required access
Browse files Browse the repository at this point in the history
  • Loading branch information
debuggdapps committed Dec 23, 2020
1 parent 4551aaa commit 6a89171
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/constants/appconstants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class AppConstants {
static const String FEEDBACK_URL =
'https://github.com/debuggdapps/nitnem/issues/new';
static const String OPTIONS_SHAREDPREF_KEY = 'OPTIONS';
static const double OPTIONS_SUBTITLE_FONT_SIZE = 10.0;
static const int DEVICE_SMALL_RES = 320;
static const bool LOGGING_ENABLED = !kReleaseMode;
}
16 changes: 15 additions & 1 deletion lib/pages/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ class _OptionsItem extends StatelessWidget {
}

class _BooleanItem extends StatelessWidget {
const _BooleanItem(this.title, this.value, this.onChanged, {this.switchKey});
const _BooleanItem(this.title, this.subtitle, this.value, this.onChanged,
{this.switchKey});

final String title;
final String subtitle;
final bool value;
final ValueChanged<bool> onChanged;
// [switchKey] is used for accessing the switch from driver tests.
Expand All @@ -58,6 +60,13 @@ class _BooleanItem extends StatelessWidget {
child: Row(
children: <Widget>[
Expanded(child: Text(title)),
Expanded(
child: Text(
subtitle,
style: TextStyle(
fontSize: AppConstants.OPTIONS_SUBTITLE_FONT_SIZE,
),
)),
Switch(
key: switchKey,
value: value,
Expand Down Expand Up @@ -136,6 +145,7 @@ class _BoldItem extends StatelessWidget {
Widget build(BuildContext context) {
return _BooleanItem(
'Bold Text',
'',
StoreProvider.of<AppState>(context).state.options.bold == true,
(bool value) {
StoreProvider.of<AppState>(context).dispatch(ToggleBoldAction(value));
Expand All @@ -152,6 +162,7 @@ class _KeepScreenAwakeItem extends StatelessWidget {
Widget build(BuildContext context) {
return _BooleanItem(
'Keep Screen Awake',
'Requires Wake Lock Permission',
StoreProvider.of<AppState>(context).state.options.screenAwake == true,
(bool value) {
StoreProvider.of<AppState>(context)
Expand All @@ -169,6 +180,7 @@ class _SaveScrollPosItem extends StatelessWidget {
Widget build(BuildContext context) {
return _BooleanItem(
'Save Scroll Position',
'',
StoreProvider.of<AppState>(context).state.options.saveScrollPosition ==
true,
(bool value) {
Expand All @@ -187,6 +199,7 @@ class _ShowStatusItem extends StatelessWidget {
Widget build(BuildContext context) {
return _BooleanItem(
'Show Status Bar',
'',
StoreProvider.of<AppState>(context).state.options.showStatus == true,
(bool value) {
StoreProvider.of<AppState>(context).dispatch(ToggleStatusAction(value));
Expand Down Expand Up @@ -330,6 +343,7 @@ class _DoNotDisturbItem extends StatelessWidget {
Widget build(BuildContext context) {
return _BooleanItem(
'Do Not Disturb',
'Requires Notification Permission',
StoreProvider.of<AppState>(context).state.options.doNotDisturb == true,
(bool value) {
StoreProvider.of<AppState>(context).dispatch(ToggleDNDAction(value,
Expand Down

0 comments on commit 6a89171

Please sign in to comment.