重构事件注册模型并更新应用配置。更改不同环境的基本url,增强事件注册项结构,并改进ScanQrCodePage中的导航。在AuthViewModel中添加clearAuth方法,以便更好地进行状态管理。
This commit is contained in:
@@ -54,64 +54,89 @@ class _AuthPageWidgetState extends ConsumerState<ScanQrCodePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: myAppBar(context: context, title: '扫码'),
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 100.h),
|
||||
Text('裁判工作台', style: TextStyle(fontSize: 30, color: Colors.black)),
|
||||
SizedBox(height: 100.h),
|
||||
Text(
|
||||
'扫描选手参赛凭证进行执裁',
|
||||
style: TextStyle(fontSize: 30, color: Colors.black),
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
return PopScope(
|
||||
canPop: true,
|
||||
onPopInvokedWithResult: (didPop, result) async {
|
||||
if (!didPop) return;
|
||||
await ref.read(authProvider.notifier).clearAuth();
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: myAppBar(context: context, title: '扫码'),
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 100.h),
|
||||
Text(
|
||||
'裁判工作台',
|
||||
style: TextStyle(fontSize: 30, color: Colors.black),
|
||||
),
|
||||
SizedBox(height: 100.h),
|
||||
Text(
|
||||
'扫描选手参赛凭证进行执裁',
|
||||
style: TextStyle(fontSize: 30, color: Colors.black),
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
return SizedBox(
|
||||
width: 280.w,
|
||||
height: 80.h,
|
||||
child: AppButton(
|
||||
label: '查看录像',
|
||||
onPressed: () async {
|
||||
final data = ref.watch(
|
||||
authProvider.select((state) => state.jwtDecodedData),
|
||||
);
|
||||
if (data == null) return;
|
||||
debugPrint('赛事名字: ${data.eventName}');
|
||||
final eventName = data.eventName ?? '';
|
||||
await ref
|
||||
.read(authProvider.notifier)
|
||||
.getRecordList(eventName);
|
||||
},
|
||||
variant: AppButtonVariant.secondary,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
SizedBox(
|
||||
width: 280.w,
|
||||
height: 80.h,
|
||||
child: AppButton(
|
||||
label: '扫码',
|
||||
onPressed: () async {
|
||||
final String? playerId = await AppQrScannerDialog.show(
|
||||
context,
|
||||
);
|
||||
if (playerId == null || playerId.isEmpty) return;
|
||||
|
||||
/// TODO
|
||||
AppNavigator.push(
|
||||
EventInfoPage(playerId: '74300708945530955'),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
return SizedBox(
|
||||
width: 280.w,
|
||||
height: 80.h,
|
||||
child: AppButton(
|
||||
label: '查看录像',
|
||||
onPressed: () async {
|
||||
final data = ref.watch(
|
||||
authProvider.select((state) => state.jwtDecodedData),
|
||||
);
|
||||
if (data == null) return;
|
||||
debugPrint('赛事名字: ${data.eventName}');
|
||||
final eventName = data.eventName ?? '';
|
||||
await ref
|
||||
.read(authProvider.notifier)
|
||||
.getRecordList(eventName);
|
||||
},
|
||||
variant: AppButtonVariant.secondary,
|
||||
),
|
||||
);
|
||||
},
|
||||
variant: AppButtonVariant.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 16.h),
|
||||
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
return SizedBox(
|
||||
width: 280.w,
|
||||
height: 80.h,
|
||||
child: AppButton(
|
||||
label: '参赛队伍',
|
||||
onPressed: () async {},
|
||||
variant: AppButtonVariant.secondary,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
SizedBox(
|
||||
width: 280.w,
|
||||
height: 80.h,
|
||||
child: AppButton(
|
||||
label: '扫码',
|
||||
onPressed: () async {
|
||||
final String? playerId = await AppQrScannerDialog.show(
|
||||
context,
|
||||
);
|
||||
if (playerId == null || playerId.isEmpty) return;
|
||||
|
||||
/// TODO
|
||||
AppNavigator.push(
|
||||
EventInfoPage(playerId: '74300708945530955'),
|
||||
);
|
||||
},
|
||||
variant: AppButtonVariant.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user