From 5d0054fd7e6cef7d90c0a4dbaf221d4a256483e9 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 28 Jan 2020 15:55:00 +0100 Subject: [PATCH] Remove FontSize configuration Ever since we had a proper markdown renderer, this option has been broken as it only scales the body text and not the headers, and other text in code-blocks. Additionally it only modifies the viewing text size and not the editing text size. Fixing this feature is way too much work, and barely any users are using this feature. Maybe we will introduce it again in the future. --- lib/screens/journal_browsing.dart | 4 +- lib/screens/settings_screen.dart | 66 ------------------------------- lib/settings.dart | 65 ------------------------------ 3 files changed, 1 insertion(+), 134 deletions(-) diff --git a/lib/screens/journal_browsing.dart b/lib/screens/journal_browsing.dart index c457267d..84dcf661 100644 --- a/lib/screens/journal_browsing.dart +++ b/lib/screens/journal_browsing.dart @@ -9,7 +9,6 @@ import 'package:url_launcher/url_launcher.dart'; import 'package:gitjournal/core/note.dart'; import 'package:gitjournal/state_container.dart'; import 'package:gitjournal/utils.dart'; -import 'package:gitjournal/settings.dart'; import 'package:gitjournal/widgets/journal_editor_header.dart'; import 'package:gitjournal/widgets/rename_dialog.dart'; @@ -176,8 +175,7 @@ class NoteViewer extends StatelessWidget { ThemeData theme = Theme.of(context); theme = theme.copyWith( textTheme: theme.textTheme.copyWith( - body1: theme.textTheme.body1 - .copyWith(fontSize: Settings.instance.noteFontSize.toDouble()), + body1: theme.textTheme.body1, ), ); diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index e1cd2834..32d96a1c 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -129,22 +129,6 @@ class SettingsListState extends State { dynamicTheme.setBrightness(b); }, ), - ListTile( - title: const Text("Font Size"), - subtitle: Text(settings.noteFontSize.toPublicString()), - onTap: () async { - var fontSize = await showDialog( - context: context, - builder: (context) => FontSizeSettingsDialog(settings.noteFontSize), - ); - - if (fontSize != null) { - settings.noteFontSize = fontSize; - settings.save(); - setState(() {}); - } - }, - ), SettingsHeader("Git Author Settings"), ListTile(title: gitAuthorForm), ListTile(title: gitAuthorEmailForm), @@ -261,53 +245,3 @@ class VersionNumberTileState extends State { ); } } - -class FontSizeSettingsDialog extends StatelessWidget { - final String title = "Font Size"; - final NoteFontSize prevSize; - - FontSizeSettingsDialog(this.prevSize); - - @override - Widget build(BuildContext context) { - var sizes = []; - for (var fontSize in NoteFontSize.options) { - var tile = _constructTile(context, fontSize); - sizes.add(tile); - } - - return AlertDialog( - title: Text(title), - content: SingleChildScrollView( - child: ListBody( - children: sizes, - ), - ), - contentPadding: const EdgeInsets.all(0.0), - actions: [ - FlatButton( - child: const Text('CANCEL'), - onPressed: () { - Navigator.of(context).pop(); - }, - ) - ], - ); - } - - Widget _constructTile(BuildContext context, NoteFontSize fontSize) { - var style = Theme.of(context).textTheme.body1; - style = style.copyWith(fontSize: fontSize.toDouble()); - - var tile = RadioListTile( - title: Text(fontSize.toPublicString(), style: style), - value: fontSize, - groupValue: prevSize, - onChanged: (NoteFontSize newVal) { - Navigator.of(context).pop(newVal); - }, - ); - - return tile; - } -} diff --git a/lib/settings.dart b/lib/settings.dart index c01e8cac..159d562e 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -14,8 +14,6 @@ class Settings { String gitAuthorEmail = "app@gitjournal.io"; NoteFileNameFormat noteFileNameFormat; - NoteFontSize noteFontSize; - bool collectUsageStatistics = true; bool collectCrashReports = true; @@ -26,9 +24,6 @@ class Settings { gitAuthor = pref.getString("gitAuthor") ?? gitAuthor; gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail; - noteFontSize = - NoteFontSize.fromInternalString(pref.getString("noteFontSize")); - noteFileNameFormat = NoteFileNameFormat.fromInternalString( pref.getString("noteFileNameFormat")); @@ -45,7 +40,6 @@ class Settings { var pref = await SharedPreferences.getInstance(); pref.setString("gitAuthor", gitAuthor); pref.setString("gitAuthorEmail", gitAuthorEmail); - pref.setString("noteFontSize", noteFontSize.toInternalString()); pref.setString("noteFileNameFormat", noteFileNameFormat.toInternalString()); pref.setBool("collectUsageStatistics", collectUsageStatistics); pref.setBool("collectCrashReports", collectCrashReports); @@ -62,7 +56,6 @@ class Settings { return { "gitAuthor": gitAuthor, "gitAuthorEmail": gitAuthorEmail, - "noteFontSize": noteFontSize.toInternalString(), "noteFileNameFormat": noteFileNameFormat.toInternalString(), "collectUsageStatistics": collectUsageStatistics, "collectCrashReports": collectCrashReports, @@ -79,64 +72,6 @@ class Settings { } } -class NoteFontSize { - static const ExtraSmall = NoteFontSize("ExtraSmall", "Extra Small", 12.0); - static const Small = NoteFontSize("Small", "Small", 16.0); - static const Normal = NoteFontSize("Normal", "Normal", 18.0); - static const Large = NoteFontSize("Large", "Large", 22.0); - static const ExtraLarge = NoteFontSize("ExtraLarge", "Extra Large", 26.0); - - static const options = [ - ExtraSmall, - Small, - Normal, - Large, - ExtraLarge, - ]; - - static NoteFontSize fromInternalString(String str) { - for (var opt in options) { - if (opt.toInternalString() == str) { - return opt; - } - } - return Normal; - } - - static NoteFontSize fromPublicString(String str) { - for (var opt in options) { - if (opt.toPublicString() == str) { - return opt; - } - } - return Normal; - } - - final String _str; - final String _publicStr; - final double _value; - - const NoteFontSize(this._str, this._publicStr, this._value); - - String toInternalString() { - return _str; - } - - String toPublicString() { - return _publicStr; - } - - double toDouble() { - return _value; - } - - @override - String toString() { - assert(false, "NoteFontSize toString should never be called"); - return ""; - } -} - class NoteFileNameFormat { static const Iso8601WithTimeZone = NoteFileNameFormat("Iso8601WithTimeZone", "ISO8601 With TimeZone");