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

View File

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