重构参赛队伍相关模型,更新API接口以支持队伍详情获取;
调整UI逻辑以使用新的数据结构,优化比赛信息展示; 更新构建脚本以支持新功能。
This commit is contained in:
@@ -8,9 +8,14 @@ import 'package:recording_tool/shared/widgets/app_empty_view.dart';
|
||||
import 'package:recording_tool/shared/widgets/app_toast.dart';
|
||||
|
||||
class CompetitionTeamDetailPage extends ConsumerWidget {
|
||||
const CompetitionTeamDetailPage({super.key, required this.itemId});
|
||||
const CompetitionTeamDetailPage({
|
||||
super.key,
|
||||
required this.itemId,
|
||||
required this.eventId,
|
||||
});
|
||||
|
||||
final String itemId;
|
||||
final String eventId;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -19,7 +24,7 @@ class CompetitionTeamDetailPage extends ConsumerWidget {
|
||||
);
|
||||
CompetitionTeamListItem? item;
|
||||
for (final candidate in items) {
|
||||
if (candidate.id == itemId) {
|
||||
if (candidate.itemId == itemId) {
|
||||
item = candidate;
|
||||
break;
|
||||
}
|
||||
@@ -30,6 +35,8 @@ class CompetitionTeamDetailPage extends ConsumerWidget {
|
||||
appBar: AppBar(title: Text(item?.title ?? '参赛队伍')),
|
||||
body: item == null
|
||||
? const AppEmptyView(message: '未找到对阵信息')
|
||||
: item.matchups.isEmpty
|
||||
? const AppEmptyView(message: '暂无对阵信息')
|
||||
: ListView.separated(
|
||||
padding: EdgeInsets.fromLTRB(20.w, 24.h, 20.w, 36.h),
|
||||
itemCount: item.matchups.length,
|
||||
@@ -42,7 +49,7 @@ class CompetitionTeamDetailPage extends ConsumerWidget {
|
||||
onManualProcess: () => _handleManualProcess(
|
||||
context,
|
||||
ref,
|
||||
itemId: item!.id,
|
||||
itemId: item!.itemId,
|
||||
matchup: matchup,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -61,7 +61,10 @@ class _CompetitionTeamListPageState
|
||||
return _CompetitionScheduleCard(
|
||||
item: item,
|
||||
onTap: () => AppNavigator.push(
|
||||
CompetitionTeamDetailPage(itemId: item.id),
|
||||
CompetitionTeamDetailPage(
|
||||
itemId: item.itemId,
|
||||
eventId: item.eventId,
|
||||
),
|
||||
context: context,
|
||||
),
|
||||
);
|
||||
@@ -82,8 +85,10 @@ class _CompetitionScheduleCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheduleText = item.scheduleTime.isEmpty ? '时间待定' : item.scheduleTime;
|
||||
|
||||
return Material(
|
||||
key: ValueKey('competition-team-item-${item.id}'),
|
||||
key: ValueKey('competition-team-item-${item.itemId}'),
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(14.r),
|
||||
child: InkWell(
|
||||
@@ -120,40 +125,18 @@ class _CompetitionScheduleCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.h),
|
||||
_InfoLine(
|
||||
icon: Icons.location_on_outlined,
|
||||
text: item.matchPlace,
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
_InfoLine(
|
||||
icon: Icons.schedule_outlined,
|
||||
text: item.scheduleTime,
|
||||
text: scheduleText,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 14.w),
|
||||
Container(
|
||||
width: 72.w,
|
||||
height: 72.h,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: item.completed
|
||||
? const Color(0xFFF1F3F6)
|
||||
: const Color(0xFFEAF3FF),
|
||||
borderRadius: BorderRadius.circular(16.r),
|
||||
),
|
||||
child: Text(
|
||||
item.completed ? '已完成' : item.matchPlace,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: item.completed ? 14.sp : 20.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: item.completed
|
||||
? const Color(0xFF69717D)
|
||||
: const Color(0xFF147FEA),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
size: 28.r,
|
||||
color: const Color(0xFF9AA3AF),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user