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.
This commit is contained in:
Vishesh Handa
2020-01-28 15:55:00 +01:00
parent 88e49dbf76
commit 5d0054fd7e
3 changed files with 1 additions and 134 deletions

View File

@ -9,7 +9,6 @@ import 'package:url_launcher/url_launcher.dart';
import 'package:gitjournal/core/note.dart'; import 'package:gitjournal/core/note.dart';
import 'package:gitjournal/state_container.dart'; import 'package:gitjournal/state_container.dart';
import 'package:gitjournal/utils.dart'; import 'package:gitjournal/utils.dart';
import 'package:gitjournal/settings.dart';
import 'package:gitjournal/widgets/journal_editor_header.dart'; import 'package:gitjournal/widgets/journal_editor_header.dart';
import 'package:gitjournal/widgets/rename_dialog.dart'; import 'package:gitjournal/widgets/rename_dialog.dart';
@ -176,8 +175,7 @@ class NoteViewer extends StatelessWidget {
ThemeData theme = Theme.of(context); ThemeData theme = Theme.of(context);
theme = theme.copyWith( theme = theme.copyWith(
textTheme: theme.textTheme.copyWith( textTheme: theme.textTheme.copyWith(
body1: theme.textTheme.body1 body1: theme.textTheme.body1,
.copyWith(fontSize: Settings.instance.noteFontSize.toDouble()),
), ),
); );

View File

@ -129,22 +129,6 @@ class SettingsListState extends State<SettingsList> {
dynamicTheme.setBrightness(b); dynamicTheme.setBrightness(b);
}, },
), ),
ListTile(
title: const Text("Font Size"),
subtitle: Text(settings.noteFontSize.toPublicString()),
onTap: () async {
var fontSize = await showDialog<NoteFontSize>(
context: context,
builder: (context) => FontSizeSettingsDialog(settings.noteFontSize),
);
if (fontSize != null) {
settings.noteFontSize = fontSize;
settings.save();
setState(() {});
}
},
),
SettingsHeader("Git Author Settings"), SettingsHeader("Git Author Settings"),
ListTile(title: gitAuthorForm), ListTile(title: gitAuthorForm),
ListTile(title: gitAuthorEmailForm), ListTile(title: gitAuthorEmailForm),
@ -261,53 +245,3 @@ class VersionNumberTileState extends State<VersionNumberTile> {
); );
} }
} }
class FontSizeSettingsDialog extends StatelessWidget {
final String title = "Font Size";
final NoteFontSize prevSize;
FontSizeSettingsDialog(this.prevSize);
@override
Widget build(BuildContext context) {
var sizes = <Widget>[];
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: <Widget>[
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<NoteFontSize>(
title: Text(fontSize.toPublicString(), style: style),
value: fontSize,
groupValue: prevSize,
onChanged: (NoteFontSize newVal) {
Navigator.of(context).pop(newVal);
},
);
return tile;
}
}

View File

@ -14,8 +14,6 @@ class Settings {
String gitAuthorEmail = "app@gitjournal.io"; String gitAuthorEmail = "app@gitjournal.io";
NoteFileNameFormat noteFileNameFormat; NoteFileNameFormat noteFileNameFormat;
NoteFontSize noteFontSize;
bool collectUsageStatistics = true; bool collectUsageStatistics = true;
bool collectCrashReports = true; bool collectCrashReports = true;
@ -26,9 +24,6 @@ class Settings {
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor; gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail; gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail;
noteFontSize =
NoteFontSize.fromInternalString(pref.getString("noteFontSize"));
noteFileNameFormat = NoteFileNameFormat.fromInternalString( noteFileNameFormat = NoteFileNameFormat.fromInternalString(
pref.getString("noteFileNameFormat")); pref.getString("noteFileNameFormat"));
@ -45,7 +40,6 @@ class Settings {
var pref = await SharedPreferences.getInstance(); var pref = await SharedPreferences.getInstance();
pref.setString("gitAuthor", gitAuthor); pref.setString("gitAuthor", gitAuthor);
pref.setString("gitAuthorEmail", gitAuthorEmail); pref.setString("gitAuthorEmail", gitAuthorEmail);
pref.setString("noteFontSize", noteFontSize.toInternalString());
pref.setString("noteFileNameFormat", noteFileNameFormat.toInternalString()); pref.setString("noteFileNameFormat", noteFileNameFormat.toInternalString());
pref.setBool("collectUsageStatistics", collectUsageStatistics); pref.setBool("collectUsageStatistics", collectUsageStatistics);
pref.setBool("collectCrashReports", collectCrashReports); pref.setBool("collectCrashReports", collectCrashReports);
@ -62,7 +56,6 @@ class Settings {
return <String, dynamic>{ return <String, dynamic>{
"gitAuthor": gitAuthor, "gitAuthor": gitAuthor,
"gitAuthorEmail": gitAuthorEmail, "gitAuthorEmail": gitAuthorEmail,
"noteFontSize": noteFontSize.toInternalString(),
"noteFileNameFormat": noteFileNameFormat.toInternalString(), "noteFileNameFormat": noteFileNameFormat.toInternalString(),
"collectUsageStatistics": collectUsageStatistics, "collectUsageStatistics": collectUsageStatistics,
"collectCrashReports": collectCrashReports, "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 = <NoteFontSize>[
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 { class NoteFileNameFormat {
static const Iso8601WithTimeZone = static const Iso8601WithTimeZone =
NoteFileNameFormat("Iso8601WithTimeZone", "ISO8601 With TimeZone"); NoteFileNameFormat("Iso8601WithTimeZone", "ISO8601 With TimeZone");