NoteViewer: Render the markdown

This commit is contained in:
Vishesh Handa
2019-05-01 23:53:21 +02:00
parent 7412eb0c07
commit 954573bcce
3 changed files with 27 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:journal/note.dart';
import 'package:journal/state_container.dart';
import 'package:journal/utils.dart';
@ -124,17 +125,25 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
class NoteViewer extends StatelessWidget {
final Note note;
final _biggerFont = const TextStyle(fontSize: 18.0);
const NoteViewer({Key key, @required this.note}) : super(key: key);
@override
Widget build(BuildContext context) {
ThemeData theme = Theme.of(context);
theme = theme.copyWith(
textTheme: theme.textTheme.copyWith(
body1: theme.textTheme.body1.copyWith(fontSize: 18.0),
),
);
var view = SingleChildScrollView(
child: Column(
children: <Widget>[
note.hasValidDate() ? NoteHeader(note) : Container(),
Text(note.body, style: _biggerFont),
MarkdownBody(
data: note.body,
styleSheet: MarkdownStyleSheet.fromTheme(theme),
),
SizedBox(height: 64.0),
// _buildFooter(context),
],

View File

@ -139,6 +139,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.0"
flutter_markdown:
dependency: "direct main"
description:
name: flutter_markdown
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -240,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
markdown:
dependency: transitive
description:
name: markdown
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
matcher:
dependency: transitive
description:

View File

@ -20,6 +20,7 @@ dependencies:
share: ^0.6.0+1
launch_review: ^1.0.1
device_info: ^0.4.0+1
flutter_markdown: ^0.2.0
dev_dependencies:
flutter_launcher_icons: "^0.7.0"