Markdown. Privacy Policies. Injection dep updated
This commit is contained in:
parent
8301e6a40e
commit
f0ab472b3a
21 changed files with 487 additions and 25 deletions
42
lib/markdownPage.dart
Normal file
42
lib/markdownPage.dart
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
|
||||
import 'globals.dart' as globals;
|
||||
|
||||
abstract class MarkdownPage extends StatefulWidget {
|
||||
final String title;
|
||||
final Future<String> file;
|
||||
|
||||
MarkdownPage({this.title, this.file});
|
||||
|
||||
@override
|
||||
_MarkdownPageState createState() =>
|
||||
_MarkdownPageState(title: this.title, file: this.file);
|
||||
}
|
||||
|
||||
class _MarkdownPageState extends State<MarkdownPage> {
|
||||
final String title;
|
||||
final Future<String> file;
|
||||
String pageData = "";
|
||||
|
||||
_MarkdownPageState({this.title, this.file});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
this.file.then((fileSync) {
|
||||
rootBundle
|
||||
.loadString(fileSync, cache: !globals.isDevelopment)
|
||||
.then((pageData) {
|
||||
setState(() {
|
||||
this.pageData = pageData;
|
||||
});
|
||||
});
|
||||
});
|
||||
return new Scaffold(
|
||||
appBar: new SliverAppBar(title: new Text(title ?? '')),
|
||||
body: new Markdown(data: pageData));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue