RawEditor: Use a monospace font

It looks way way nicer. Also it really highlights how you're editing the
raw contents of the file.
This commit is contained in:
Vishesh Handa
2019-10-11 17:07:39 +02:00
parent be74d80aff
commit cb399a9586
3 changed files with 13 additions and 3 deletions

BIN
fonts/RobotoMono-Regular.ttf Executable file

Binary file not shown.

View File

@ -48,11 +48,11 @@ class NoteEditorState extends State<NoteEditor> {
Widget editor = Column(
children: <Widget>[
NoteHeader(note),
NoteMarkdownEditor(_textController),
NoteMarkdownEditor(_textController, false),
],
);
if (rawEditor) {
editor = NoteMarkdownEditor(_textController);
editor = NoteMarkdownEditor(_textController, true);
}
var title = newNote ? "Journal Entry" : "Edit Journal Entry";
@ -174,17 +174,24 @@ class NoteEditorState extends State<NoteEditor> {
class NoteMarkdownEditor extends StatelessWidget {
final TextEditingController textController;
final bool useMonospace;
NoteMarkdownEditor(this.textController);
NoteMarkdownEditor(this.textController, this.useMonospace);
@override
Widget build(BuildContext context) {
var style = Theme.of(context).textTheme.subhead;
if (useMonospace) {
style = style.copyWith(fontFamily: "Roboto Mono");
}
return Form(
child: TextFormField(
autofocus: true,
autocorrect: false,
keyboardType: TextInputType.multiline,
maxLines: null,
style: style,
decoration: InputDecoration(
hintText: 'Write here',
border: InputBorder.none,

View File

@ -48,6 +48,9 @@ flutter:
- family: Lato
fonts:
- asset: fonts/Lato-Regular.ttf
- family: Roboto Mono
fonts:
- asset: fonts/RobotoMono-Regular.ttf
flutter_icons:
android: "launcher_icon"