You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
216 lines
9.1 KiB
216 lines
9.1 KiB
2 weeks ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/services.dart';
|
||
|
import 'package:supplier_new/common/settings.dart';
|
||
|
|
||
|
class Login extends StatefulWidget {
|
||
|
const Login({super.key});
|
||
|
|
||
|
@override
|
||
|
State<Login> createState() => _LoginState();
|
||
|
}
|
||
|
|
||
|
class _LoginState extends State<Login> {
|
||
|
|
||
|
|
||
|
bool isObscureText=true;
|
||
|
TextEditingController mobileNumberController = TextEditingController();
|
||
|
TextEditingController passwordController = TextEditingController();
|
||
|
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
isObscureText=true;
|
||
|
super.initState();
|
||
|
}
|
||
|
|
||
|
|
||
|
Future<bool> onWillPop() async {
|
||
|
final shouldPop = await showDialog<bool>(context: context, builder: (context) {
|
||
|
return AlertDialog(
|
||
|
title: const Text('Do you want to exit app?',
|
||
|
style: TextStyle(
|
||
|
color: primaryColor,
|
||
|
fontSize: 20,
|
||
|
)),
|
||
|
actionsAlignment: MainAxisAlignment.spaceBetween,
|
||
|
actions: [
|
||
|
TextButton(
|
||
|
onPressed: () {
|
||
|
SystemNavigator.pop();
|
||
|
},
|
||
|
child: const Text('Yes',
|
||
|
style: TextStyle(
|
||
|
color: primaryColor,
|
||
|
fontSize: 20,
|
||
|
)),
|
||
|
),
|
||
|
TextButton(
|
||
|
onPressed: () {
|
||
|
Navigator.of(context).pop(false);
|
||
|
},
|
||
|
child: const Text('No',
|
||
|
style: TextStyle(
|
||
|
color: primaryColor,
|
||
|
fontSize: 20,
|
||
|
)),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
return shouldPop!;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
String lastInputValue="";
|
||
|
|
||
|
return WillPopScope(
|
||
|
onWillPop: () async => onWillPop(),
|
||
|
child: Scaffold(
|
||
|
backgroundColor: Colors.white,
|
||
|
body: Stack(
|
||
|
children: <Widget>[
|
||
|
/*Container(
|
||
|
decoration: const BoxDecoration(
|
||
|
image: DecorationImage(image: AssetImage("images/backgroundimage.png"), fit: BoxFit.cover,),
|
||
|
),
|
||
|
),*/
|
||
|
GestureDetector(
|
||
|
onTap: () {
|
||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||
|
},
|
||
|
child: SafeArea(
|
||
|
child: SingleChildScrollView(
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.fromLTRB(24, 0, 24, 0),
|
||
|
child: Column(
|
||
|
|
||
|
children: <Widget>[
|
||
|
Image(
|
||
|
image: const AssetImage('images/login_logo.png'),
|
||
|
height: MediaQuery.of(context).size.height * .30,
|
||
|
width:MediaQuery.of(context).size.width * .30,
|
||
|
),
|
||
|
|
||
|
SizedBox(height:MediaQuery.of(context).size.height * .04,),
|
||
|
/*Align(
|
||
|
alignment: Alignment.bottomLeft,
|
||
|
child: Text('Welcome!', style:fontTextStyle(24,Color(0XFF1C1E20),FontWeight.w800)
|
||
|
|
||
|
*//*style: GoogleFonts.inter(
|
||
|
textStyle: TextStyle(
|
||
|
fontSize: 24,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
),*//*),
|
||
|
),*/
|
||
|
SizedBox(height:MediaQuery.of(context).size.height * .024,),
|
||
|
Container(
|
||
|
child: TextFormField(
|
||
|
controller: mobileNumberController,
|
||
|
keyboardType: TextInputType.number,
|
||
|
textCapitalization: TextCapitalization.sentences,
|
||
|
maxLength: 10,
|
||
|
decoration: textFormFieldDecoration(Icons.phone,'Mobile Number'),
|
||
|
style:fontTextStyle(14,Color(0XFF101214),FontWeight.w400),
|
||
|
cursorColor: Color(0XFF1D7AFC),
|
||
|
|
||
|
//TextStyle(color: Colors.black,fontWeight: FontWeight.bold),
|
||
|
),
|
||
|
),
|
||
|
SizedBox(height:MediaQuery.of(context).size.height * .016,),
|
||
|
|
||
|
Container(
|
||
|
child: TextFormField(
|
||
|
cursorColor:Color(0XFF1D7AFC),
|
||
|
obscureText: isObscureText,
|
||
|
obscuringCharacter: '*',
|
||
|
controller: passwordController,
|
||
|
decoration: InputDecoration(
|
||
|
filled: false,
|
||
|
fillColor: Colors.white,
|
||
|
labelText: 'Password',
|
||
|
//prefixIcon: const Icon(Icons.lock, color: Colors.white,),
|
||
|
labelStyle: fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400),
|
||
|
border: OutlineInputBorder(
|
||
|
borderRadius: BorderRadius.circular(4.0),
|
||
|
borderSide: BorderSide(color: greyColor,
|
||
|
width: 1, )),
|
||
|
focusedBorder: OutlineInputBorder(
|
||
|
borderRadius: BorderRadius.circular(4.0),
|
||
|
borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,),
|
||
|
),
|
||
|
enabledBorder: OutlineInputBorder(
|
||
|
borderRadius: BorderRadius.circular(4.0),
|
||
|
borderSide: BorderSide(color: greyColor),
|
||
|
),
|
||
|
|
||
|
suffixIcon: IconButton(
|
||
|
icon: isObscureText==true?Image.asset('images/eye_icon.png',color: Color(0XFF7E7F80),width: 30,height: 30,):Image.asset('images/open_eye.png',color:Color(0XFF7E7F80),width: 30,height: 30,),
|
||
|
/* Icon(
|
||
|
icon:Image.asset('assets/your_image.png'),
|
||
|
color: isObscureText==true?greyColor:primaryColor,
|
||
|
),*/
|
||
|
onPressed: () {
|
||
|
|
||
|
print("show password");
|
||
|
setState(() {
|
||
|
isObscureText = !isObscureText;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
|
||
|
),
|
||
|
style: fontTextStyle(14,Color(0XFF101214),FontWeight.w400),
|
||
|
|
||
|
),
|
||
|
),
|
||
|
|
||
|
SizedBox(height:MediaQuery.of(context).size.height * .016,),
|
||
|
Align(
|
||
|
alignment: Alignment.bottomLeft,
|
||
|
child:GestureDetector(
|
||
|
onTap: (){
|
||
|
/*Navigator.push(
|
||
|
context,
|
||
|
MaterialPageRoute(builder: (context) => ForgotpasswordNew()),
|
||
|
);*/
|
||
|
},
|
||
|
child: Text(
|
||
|
'Forgot Password?',
|
||
|
style: fontTextStyle(12,Color(0XFF1D7AFC),FontWeight.w600),
|
||
|
|
||
|
),
|
||
|
)
|
||
|
),
|
||
|
SizedBox(height:MediaQuery.of(context).size.height * .024,),
|
||
|
Container(
|
||
|
width:double.infinity,
|
||
|
height: MediaQuery.of(context).size.height * .06,
|
||
|
child: ElevatedButton(
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
foregroundColor: Colors.white,
|
||
|
backgroundColor: primaryColor,
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(24.0), // Customize the radius
|
||
|
),
|
||
|
),
|
||
|
onPressed: () async{
|
||
|
|
||
|
},
|
||
|
child: Text('Login',style: fontTextStyle(12,Colors.white,FontWeight.w600),),
|
||
|
)),
|
||
|
],
|
||
|
),
|
||
|
)
|
||
|
)),
|
||
|
),
|
||
|
],
|
||
|
)
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|