新住戶註冊(QR code 掃描和返回畫面)

This commit is contained in:
jasonchenwork 2025-05-09 13:23:42 +08:00
parent 4ec947bfc3
commit 7c8926e95c

View File

@ -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<NewResidentStepPage> {
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<NewResidentStepPage> {
);
}
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<NewResidentStepPage> {
return buildStep3();
case 4:
return buildStep4();
case 5:
return buildStep5();
default:
return const Text('未知步驟');
}