mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-25 08:12:19 +08:00
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:
BIN
fonts/RobotoMono-Regular.ttf
Executable file
BIN
fonts/RobotoMono-Regular.ttf
Executable file
Binary file not shown.
@ -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,
|
||||||
|
@ -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"
|
||||||
|
Reference in New Issue
Block a user