third/TestModuleB_1/testModuleB_1/lib/Login.dart
2025-07-29 14:31:14 +08:00

122 lines
5.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:testmoduleb_1/homepage.dart';
class Login extends StatefulWidget {
const Login({super.key});
@override
State<Login> createState() => _LoginState();
}
class _LoginState extends State<Login> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("lib/image/image_1.jpg"),
fit: BoxFit.cover)),
child: Stack(
children: [
Positioned(
left: 16,
top: 64,
child: IconButton(
onPressed: () => Navigator.pop(context),
icon: Icon(
Icons.arrow_back_ios_sharp,
color: Colors.grey,
))),
Positioned(
top: 300,
left: 120,
child: Center(
child: Image.asset(
"lib/image/logo.png",
height: 150,
width: 150,
fit: BoxFit.cover,
)),
),
Positioned(
top: 500,
child: Center(
child: Container(
height: 300,
width: 380,
margin: EdgeInsets.all(16),
padding: EdgeInsets.all(16),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.black54
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
height: 50,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8)
),
child: TextField(
decoration: InputDecoration(
prefixIcon: Image.asset("lib/image/icon_35.png",fit: BoxFit.cover,height: 40,width: 40,),
border: InputBorder.none,
hintText: "Please enter your account",
hintStyle: TextStyle(color: Colors.black54)
),
),
),
Container(
height: 50,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8)
),
child: TextField(
decoration: InputDecoration(
prefixIcon: Image.asset("lib/image/icon_86.png",fit: BoxFit.cover,height: 40,width: 40,),
border: InputBorder.none,
hintText: "Please enter your password",
hintStyle: TextStyle(color: Colors.black54)
),
),
),
Row(
children: [
Image.asset("lib/image/icon_43.png",fit: BoxFit.cover,height: 30,width: 30,),
Text("I have read and agreed User Privacy Policy",style: TextStyle(color: Colors.grey),),
],
),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: ()=>Navigator.of(context).push(MaterialPageRoute(builder: (c)=>HomePage())),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.amber),
child: Text("Login",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white)),
),
),
],
)
),
),
),
Positioned(
bottom: 16,
left: 0,
right: 0,
child: Text("Forgot your password?",textAlign: TextAlign.center,style: TextStyle(color: Colors.white),)
)
],
)));
}
}