feat: 实现起卦、设置与积分系统
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
|
||||
import '../../../../shared/theme/design_tokens.dart';
|
||||
import '../../../../shared/widgets/app_loading_indicator.dart';
|
||||
|
||||
class LegalDocumentScreen extends StatelessWidget {
|
||||
const LegalDocumentScreen({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.assetPath,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String assetPath;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Scaffold(
|
||||
backgroundColor: colors.surfaceContainerLow,
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
centerTitle: true,
|
||||
backgroundColor: colors.surfaceContainerLow,
|
||||
surfaceTintColor: colors.surfaceContainerLow,
|
||||
),
|
||||
body: FutureBuilder<String>(
|
||||
future: rootBundle.loadString(assetPath),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return const Center(
|
||||
child: AppLoadingIndicator(variant: AppLoadingVariant.surface),
|
||||
);
|
||||
}
|
||||
|
||||
return Markdown(
|
||||
data: snapshot.data!,
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context))
|
||||
.copyWith(
|
||||
p: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(height: 1.7),
|
||||
h1: Theme.of(context).textTheme.titleLarge,
|
||||
h2: Theme.of(context).textTheme.titleMedium,
|
||||
h3: Theme.of(
|
||||
context,
|
||||
).textTheme.titleMedium?.copyWith(color: colors.primary),
|
||||
blockSpacing: AppSpacing.lg,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user