fix:按照shadcn_ui对着demo_shadcn对齐
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../../data/api/report_data_source.dart';
|
||||
import '../../data/models/models.dart';
|
||||
import '../../theme/app_icons.dart';
|
||||
import '../../theme/yanting_text.dart';
|
||||
import '../../theme/yanting_tokens.dart';
|
||||
import '../../theme/wise_tokens.dart';
|
||||
import '../../widgets/app_buttons.dart';
|
||||
import '../../widgets/app_card.dart';
|
||||
import '../../widgets/badges.dart';
|
||||
@@ -52,9 +52,23 @@ class ReportDetailPage extends HookConsumerWidget {
|
||||
]);
|
||||
final snapshot = useFuture(detailFuture);
|
||||
const registry = ModuleRendererRegistry();
|
||||
final theme = ShadTheme.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('研报详情')),
|
||||
backgroundColor: theme.colorScheme.background,
|
||||
appBar: AppBar(
|
||||
backgroundColor: theme.colorScheme.background,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
title: const Text('研报详情'),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(1),
|
||||
child: ColoredBox(
|
||||
color: theme.colorScheme.border,
|
||||
child: const SizedBox(height: 1, width: double.infinity),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: snapshot.connectionState != ConnectionState.done
|
||||
? const LoadingState()
|
||||
: snapshot.hasError
|
||||
@@ -106,7 +120,12 @@ class _ReportDetailContent extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.fromLTRB(WiseSpacing.x4, 4, WiseSpacing.x4, 16),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
YantingSpacing.x4,
|
||||
4,
|
||||
YantingSpacing.x4,
|
||||
16,
|
||||
),
|
||||
children: [
|
||||
AppCard(
|
||||
color: YantingColors.brandSoft,
|
||||
@@ -115,8 +134,8 @@ class _ReportDetailContent extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Wrap(
|
||||
spacing: WiseSpacing.x2,
|
||||
runSpacing: WiseSpacing.x2,
|
||||
spacing: YantingSpacing.x2,
|
||||
runSpacing: YantingSpacing.x2,
|
||||
children: [
|
||||
AppBadge(
|
||||
text: detail.interpretationLabel,
|
||||
@@ -134,7 +153,7 @@ class _ReportDetailContent extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: WiseSpacing.x3),
|
||||
const SizedBox(height: YantingSpacing.x3),
|
||||
Text(
|
||||
detail.titleCn,
|
||||
maxLines: 3,
|
||||
@@ -142,10 +161,10 @@ class _ReportDetailContent extends StatelessWidget {
|
||||
style: YantingText.sectionTitle.copyWith(fontSize: 21),
|
||||
),
|
||||
if (detail.oneLiner.isNotEmpty) ...[
|
||||
const SizedBox(height: WiseSpacing.x2),
|
||||
const SizedBox(height: YantingSpacing.x2),
|
||||
Text(detail.oneLiner, style: YantingText.body),
|
||||
],
|
||||
const SizedBox(height: WiseSpacing.x3),
|
||||
const SizedBox(height: YantingSpacing.x3),
|
||||
Text(
|
||||
'${detail.institution.nameCn} · ${formatDate(detail.releasedAt)}',
|
||||
style: YantingText.meta,
|
||||
@@ -153,11 +172,11 @@ class _ReportDetailContent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: WiseSpacing.x4),
|
||||
const SizedBox(height: YantingSpacing.x4),
|
||||
_ActionBar(detail: detail),
|
||||
const SizedBox(height: WiseSpacing.x4),
|
||||
const SizedBox(height: YantingSpacing.x4),
|
||||
_Toc(modules: detail.modules),
|
||||
const SizedBox(height: WiseSpacing.x4),
|
||||
const SizedBox(height: YantingSpacing.x4),
|
||||
for (final module in detail.modules) ...[
|
||||
registry.card(
|
||||
context: context,
|
||||
@@ -170,7 +189,7 @@ class _ReportDetailContent extends StatelessWidget {
|
||||
onSeekAudio: onSeekAudio,
|
||||
onSpeed: onSpeed,
|
||||
),
|
||||
const SizedBox(height: WiseSpacing.x4),
|
||||
const SizedBox(height: YantingSpacing.x4),
|
||||
],
|
||||
],
|
||||
);
|
||||
@@ -194,7 +213,7 @@ class _ActionBar extends StatelessWidget {
|
||||
onPressed: () => showLoginSheet(context, reason: '登录后保存到你的收藏'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: WiseSpacing.x2),
|
||||
const SizedBox(width: YantingSpacing.x2),
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: '原文',
|
||||
@@ -222,7 +241,7 @@ class _Toc extends StatelessWidget {
|
||||
children: [
|
||||
for (final module in modules)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: WiseSpacing.x2),
|
||||
padding: const EdgeInsets.only(right: YantingSpacing.x2),
|
||||
child: AppBadge(text: module.titleCn, kind: BadgeKind.brand),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user