49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'package:aves/widgets/common/basic/markdown_container.dart';
|
|
import 'package:aves/widgets/common/extensions/build_context.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
class PolicyPage extends StatefulWidget {
|
|
static const routeName = '/about/policy';
|
|
|
|
const PolicyPage({
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
_PolicyPageState createState() => _PolicyPageState();
|
|
}
|
|
|
|
class _PolicyPageState extends State<PolicyPage> {
|
|
late Future<String> _termsLoader;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_termsLoader = rootBundle.loadString('assets/terms.md');
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(context.l10n.policyPageTitle),
|
|
),
|
|
body: SafeArea(
|
|
child: Center(
|
|
child: FutureBuilder<String>(
|
|
future: _termsLoader,
|
|
builder: (context, snapshot) {
|
|
if (snapshot.hasError || snapshot.connectionState != ConnectionState.done) return const SizedBox();
|
|
final terms = snapshot.data!;
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
child: MarkdownContainer(data: terms),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|