mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
NoteViewer: Simplify code
This commit is contained in:
@ -4,15 +4,11 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import 'package:gitjournal/core/note.dart';
|
import 'package:gitjournal/core/note.dart';
|
||||||
import 'package:gitjournal/widgets/journal_editor_header.dart';
|
|
||||||
|
|
||||||
class NoteViewer extends StatelessWidget {
|
class NoteViewer extends StatelessWidget {
|
||||||
final Note note;
|
final Note note;
|
||||||
const NoteViewer({Key key, @required this.note}) : super(key: key);
|
const NoteViewer({Key key, @required this.note}) : super(key: key);
|
||||||
|
|
||||||
final bool showJournalHeader = false;
|
|
||||||
final bool showTitle = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ThemeData theme = Theme.of(context);
|
ThemeData theme = Theme.of(context);
|
||||||
@ -45,10 +41,7 @@ class NoteViewer extends StatelessWidget {
|
|||||||
var view = SingleChildScrollView(
|
var view = SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (note.created != null && showJournalHeader)
|
if (note.canHaveMetadata) NoteTitleHeader(note.title),
|
||||||
JournalEditorHeader(note),
|
|
||||||
if (showTitle && note.canHaveMetadata)
|
|
||||||
NoteTitleHeader(note.title),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
|
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
|
||||||
child: MarkdownBody(
|
child: MarkdownBody(
|
||||||
|
Reference in New Issue
Block a user