From 3996a9163b9a1e9c348245d8aa6dc281e665ab8d Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Mon, 27 Jul 2020 09:49:24 +0200 Subject: [PATCH] Change Zen Mode text Show 'Enable Zen Mode' or 'Disable Zen Mode' instead of just the toggle. --- assets/langs/en.yaml | 4 +++- lib/editors/common.dart | 16 +++++++++++++--- lib/editors/scaffold.dart | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/assets/langs/en.yaml b/assets/langs/en.yaml index 9798688c..a7f82023 100644 --- a/assets/langs/en.yaml +++ b/assets/langs/en.yaml @@ -63,7 +63,9 @@ editors: addImage: Add Image from Gallery editFileName: Edit File Name tags: Edit Tags - zen: Toggle Zen Mode + zen: + enable: Enable Zen Mode + disable: Disable Zen Mode saveNoteFailed: title: Failed to Save Note message: We're sorry, but we cannot seem to save the Note. It has been copied to the clipboard to avoid data loss. diff --git a/lib/editors/common.dart b/lib/editors/common.dart index f0954986..d9e9dee4 100644 --- a/lib/editors/common.dart +++ b/lib/editors/common.dart @@ -90,6 +90,7 @@ class EditorBottomBar extends StatelessWidget { final EditorState editorState; final NotesFolderFS parentFolder; final bool allowEdits; + final bool zenMode; final Func0 onZenModeChanged; EditorBottomBar({ @@ -97,6 +98,7 @@ class EditorBottomBar extends StatelessWidget { @required this.editorState, @required this.parentFolder, @required this.allowEdits, + @required this.zenMode, @required this.onZenModeChanged, }); @@ -118,8 +120,13 @@ class EditorBottomBar extends StatelessWidget { onPressed: () { showModalBottomSheet( context: context, - builder: (c) => - _buildBottomMenuSheet(c, editor, editorState, onZenModeChanged), + builder: (c) => _buildBottomMenuSheet( + c, + editor, + editorState, + zenMode, + onZenModeChanged, + ), elevation: 0, ); }, @@ -214,6 +221,7 @@ Widget _buildBottomMenuSheet( BuildContext context, Editor editor, EditorState editorState, + bool zenModeEnabled, Func0 zenModeChanged, ) { return Container( @@ -266,7 +274,9 @@ Widget _buildBottomMenuSheet( ProOverlay( child: ListTile( leading: const FaIcon(FontAwesomeIcons.peace), - title: Text(tr('editors.common.zen')), + title: Text(tr(zenModeEnabled + ? 'editors.common.zen.disable' + : 'editors.common.zen.enable')), onTap: () { zenModeChanged(); Navigator.of(context).pop(); diff --git a/lib/editors/scaffold.dart b/lib/editors/scaffold.dart index 3996a373..4e793e5a 100644 --- a/lib/editors/scaffold.dart +++ b/lib/editors/scaffold.dart @@ -88,6 +88,7 @@ class _EditorScaffoldState extends State { editorState: widget.editorState, parentFolder: widget.parentFolder, allowEdits: widget.allowEdits, + zenMode: zenMode, onZenModeChanged: () { setState(() { zenMode = !zenMode;