mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
NoteViewer: Render the markdown
This commit is contained in:
@ -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),
|
||||
],
|
||||
|
14
pubspec.lock
14
pubspec.lock
@ -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:
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user