import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:recording_tool/app/router/app_navigator.dart';
import 'package:recording_tool/features/scan_qrcode/pages/page_push_test.dart';
import 'package:recording_tool/shared/widgets/app_bar.dart';
import 'package:recording_tool/shared/widgets/app_button.dart';
import 'package:recording_tool/shared/widgets/app_qr_scanner_dialog.dart';

class ScanQrCodePage extends StatefulWidget {
  const ScanQrCodePage({super.key});

  @override
  State<ScanQrCodePage> createState() => _AuthPageWidgetState();
}

class _AuthPageWidgetState extends State<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),

            SizedBox(
              width: 280.w,
              height: 80.h,
              child: AppButton(
                label: '扫码',
                onPressed: () async {
                  final result = await AppQrScannerDialog.show(context);
                  if (result == null || result.isEmpty) return;
                  debugPrint('扫码结果: $result');
                  // AppNavigator.push(
                  // const WebviewPage(url: 'https://www.dronex.cc/'),
                  // );
                  AppNavigator.push(const PushSteamTestWidget());
                },
                variant: AppButtonVariant.secondary,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
