diff --git a/lib/new_resident_step.dart b/lib/new_resident_step.dart index cf49037..0d4381a 100644 --- a/lib/new_resident_step.dart +++ b/lib/new_resident_step.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'login_page.dart'; class NewResidentStepPage extends StatefulWidget { const NewResidentStepPage({super.key}); @@ -332,8 +333,11 @@ class _NewResidentStepPageState extends State { width: double.infinity, child: ElevatedButton( onPressed: () { - // 跳轉到掃描開通畫面 - Navigator.pushNamed(context, '/scan_activate'); + setState(() { + currentStep = 5; + statusMessage = null; + isSuccess = true; + }); }, style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF4CAF50), @@ -355,6 +359,77 @@ class _NewResidentStepPageState extends State { ); } + Widget buildStep5() { + return Column( + children: [ + // Body content + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), + child: Column( + mainAxisSize: MainAxisSize.min, // 讓 Column 的高度根據內容來調整 + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text( + '掃描QR Code 來開通', + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.w600, + color: Color(0xFF333333), + ), + ), + const SizedBox(height: 20), + const Text( + '請掃描下面的 QR Code 開通此住戶。', + style: TextStyle(fontSize: 16, color: Color(0xFF666666)), + textAlign: TextAlign.center, + ), + const SizedBox(height: 20), + // 塞入QR CODE 圖片 + Image.network( + 'https://docs.lightburnsoftware.com/legacy/img/QRCode/ExampleCode.png', + width: 200, + height: 200, + ), + const SizedBox(height: 40), + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: () { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => const LoginPage(), + ), + ); + }, + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF4CAF50), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(24), + ), + padding: const EdgeInsets.symmetric(vertical: 12), + ), + child: const Text( + '掃描完畢,返回登入介面', + style: TextStyle(fontSize: 16, color: Colors.white), + ), + ), + ), + const Text( + '如果無法掃描,請調整螢幕亮度。', + style: TextStyle( + fontSize: 14, + color: Color.fromARGB(255, 129, 129, 129), + ), + textAlign: TextAlign.center, + ), + ], + ), + ), + ], + ); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -417,6 +492,8 @@ class _NewResidentStepPageState extends State { return buildStep3(); case 4: return buildStep4(); + case 5: + return buildStep5(); default: return const Text('未知步驟'); }