- Fix deprecated @ignore in json_serializable models (appState, yourLocation) - Fix empty catch blocks in compassMapPlugin, globalFiresBottomStats, locationUtils - Fix no_logic_in_create_state in firesApp, markdownPage, slider - Fix use_build_context_synchronously in fireAlert - Fix only_throw_errors in firesApi (8 instances) - Exclude generated .g.dart files from analysis - Update deprecated nullable: false to @JsonSerializable() Build: APK generated successfully, 0 errors, 0 warnings
55 lines
1.3 KiB
Dart
55 lines
1.3 KiB
Dart
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;
|
|
import 'mainDrawer.dart';
|
|
|
|
abstract class MarkdownPage extends StatefulWidget {
|
|
const MarkdownPage(
|
|
{super.key,
|
|
required this.title,
|
|
required this.route,
|
|
required this.file});
|
|
final String title;
|
|
final Future<String> file;
|
|
final String route;
|
|
|
|
@override
|
|
_MarkdownPageState createState() => _MarkdownPageState();
|
|
}
|
|
|
|
class _MarkdownPageState extends State<MarkdownPage> {
|
|
_MarkdownPageState();
|
|
late final String title;
|
|
late final String route;
|
|
late final Future<String> file;
|
|
String pageData = '';
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
title = widget.title;
|
|
route = widget.route;
|
|
file = widget.file;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
file.then((String fileSync) {
|
|
rootBundle
|
|
.loadString(fileSync, cache: !globals.isDevelopment)
|
|
.then((String pageData) {
|
|
setState(() {
|
|
this.pageData = pageData;
|
|
});
|
|
});
|
|
});
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(title)),
|
|
drawer: MainDrawer(context, route),
|
|
body: Markdown(data: pageData));
|
|
}
|
|
}
|