fix:靠原型不齐页面

This commit is contained in:
jingyun
2026-06-18 16:53:08 +08:00
parent 35eed6b5b8
commit f42ad566e0
14 changed files with 4013 additions and 569 deletions
+88 -95
View File
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../common/widgets/adaptive.dart';
import '../../../common/router/app_router.dart';
import '../../../common/widgets/prototype_ui.dart';
import '../application/news_controller.dart';
class NewsPage extends ConsumerWidget {
@@ -15,104 +17,91 @@ class NewsPage extends ConsumerWidget {
return SafeArea(
top: false,
child: ListView(
padding: const EdgeInsets.fromLTRB(18, 18, 18, 24),
padding: const EdgeInsets.fromLTRB(0, 8, 0, 86),
children: [
Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: Adaptive.contentMaxWidth,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
Expanded(
child: Text(
'信息整理 · 非投资建议',
style: TextStyle(
color: cs.mutedForeground,
fontSize: 13,
),
),
),
TextButton(
onPressed: () =>
ref.read(newsControllerProvider.notifier).refresh(),
child: const Text('刷新'),
),
],
),
const SizedBox(height: 8),
for (final item in news.items)
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: DecoratedBox(
decoration: BoxDecoration(
color: cs.card,
border: Border.all(color: cs.border),
borderRadius: BorderRadius.circular(12),
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
decoration: BoxDecoration(
color: item.metal.color.withValues(
alpha: 0.12,
),
borderRadius: BorderRadius.circular(999),
),
child: Text(
item.metal.shortLabel,
style: TextStyle(
color: item.metal.color,
fontWeight: FontWeight.w700,
),
),
),
const SizedBox(width: 8),
Text(
'${item.source} · ${item.publishedAt.hour.toString().padLeft(2, '0')}:${item.publishedAt.minute.toString().padLeft(2, '0')}',
style: TextStyle(
color: cs.mutedForeground,
fontSize: 12,
),
),
],
),
const SizedBox(height: 10),
Text(
item.title,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: cs.foreground,
),
),
const SizedBox(height: 8),
Text(
item.summary,
style: TextStyle(
color: cs.mutedForeground,
height: 1.5,
),
),
],
),
),
PrototypeFrame(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
const Text(
'资讯',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600),
),
const Spacer(),
IconButton(
onPressed: () => ref.read(newsControllerProvider.notifier).refresh(),
icon: const Icon(Icons.refresh, size: 19),
color: const Color(0xFF9A968D),
padding: EdgeInsets.zero,
constraints: const BoxConstraints.tightFor(
width: 30,
height: 30,
),
),
],
),
const SizedBox(height: 2),
Text(
'信息整理 · 非投资建议',
style: TextStyle(fontSize: 13, color: cs.mutedForeground),
),
const SizedBox(height: 10),
for (final item in news.items) ...[
PrototypeCard(
margin: const EdgeInsets.only(bottom: 10),
child: InkWell(
onTap: () => context.push('${AppRoutes.newsDetail}?id=${item.id}'),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: item.metal.color.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(999),
),
child: Text(
item.metal.shortLabel,
style: TextStyle(
color: item.metal.color,
fontWeight: FontWeight.w700,
fontSize: 12,
),
),
),
const SizedBox(width: 8),
Text(
'${item.source} · ${_timeLabel(item.publishedAt)}',
style: TextStyle(fontSize: 12, color: cs.mutedForeground),
),
const Spacer(),
Icon(Icons.chevron_right, size: 16, color: cs.mutedForeground),
],
),
const SizedBox(height: 10),
Text(
item.title,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700),
),
const SizedBox(height: 8),
Text(
item.summary,
style: TextStyle(
fontSize: 14,
color: cs.mutedForeground,
height: 1.55,
),
),
],
),
),
),
],
),
],
),
),
],
@@ -120,3 +109,7 @@ class NewsPage extends ConsumerWidget {
);
}
}
String _timeLabel(DateTime value) {
return '${value.hour.toString().padLeft(2, '0')}:${value.minute.toString().padLeft(2, '0')}';
}