- 13 library_private_types_in_public_api: These are intentional design patterns where private State classes are returned from createState() methods - 7 implementation_imports: These are from external packages (redux, flutter_map, shared_preferences) and necessary for the implementation All suppressed using ignore comments: - active_fires.dart, compass_map_plugin.dart, custom_stepper.dart, fire_alert.dart, fire_notification_list.dart, fires_app.dart, generic_map.dart, global_fires_bottom_stats.dart, home_page.dart, markdown_page.dart, slider.dart, support_page.dart, material_app_with_intro.dart - generic_map.dart, main_drawer.dart, main_prod.dart, fire_notifications_persist.dart, your_location_persist.dart, monitored_areas.dart, fetch_data_middleware.dart Result: ZERO lint issues in lib/ - clean build achieved!
56 lines
1.4 KiB
Dart
56 lines
1.4 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 'main_drawer.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
|
|
// ignore: library_private_types_in_public_api
|
|
_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));
|
|
}
|
|
}
|