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.

192 lines
8.8 KiB

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:supplier_new/common/settings.dart';
import 'package:supplier_new/signup/signup.dart';
class PasswordTextBoxesScreen extends StatefulWidget {
var mobileNumber;
PasswordTextBoxesScreen({
this.mobileNumber
});
@override
State<PasswordTextBoxesScreen> createState() => _PasswordTextBoxesScreenState();
}
class _PasswordTextBoxesScreenState extends State<PasswordTextBoxesScreen> {
TextEditingController reEnterPasswordController = TextEditingController();
TextEditingController createPasswordController = TextEditingController();
bool isObscureText=true;
bool isObscureTextForReEnter=true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(24),
child: Column(
children: [
SizedBox(height: MediaQuery.of(context).size.height * .2),
Center(
child: Text("AQUICK SUPPLIER",
style: fontTextStyle(20, Color(0XFF515253), FontWeight.w800)),
),
SizedBox(height: MediaQuery.of(context).size.height * .05),
CircleAvatar(radius: 80, backgroundColor: Color(0XFFF3F1FB)),
SizedBox(height: MediaQuery.of(context).size.height * .05),
Center(
child: Text(
"Welcome to Aquick Supplier",
style: fontTextStyle(20, Color(0XFF343637), FontWeight.w700),
),
),
SizedBox(height: MediaQuery.of(context).size.height * .004),
Center(
child: Text(
"Sign up to be listed as a supplier, start deliveries and track orders",
style: fontTextStyle(12, Color(0XFF7E7F80), FontWeight.w400),
textAlign: TextAlign.center, // Keeps text centered in multiple lines
),
),
SizedBox(height:MediaQuery.of(context).size.height * .016,),
Container(
child: TextFormField(
cursorColor:Color(0XFF8270DB),
obscureText: isObscureText,
obscuringCharacter: '*',
controller: createPasswordController,
decoration: InputDecoration(
filled: false,
fillColor: Colors.white,
labelText: 'Create 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(0XFF8270DB),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: 16,height: 16,):Image.asset('images/open_eye.png',color:Color(0XFF7E7F80),width: 16,height: 16,),
/* Icon(
icon:Image.asset('assets/your_image.png'),
color: isObscureText==true?greyColor:primaryColor,
),*/
onPressed: () {
print("show password");
setState(() {
isObscureText = !isObscureText;
});
},
),
),
style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w400),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .012,),
Container(
child: TextFormField(
cursorColor:Color(0XFF8270DB),
obscureText: isObscureTextForReEnter,
obscuringCharacter: '*',
controller: reEnterPasswordController,
decoration: InputDecoration(
filled: false,
fillColor: Colors.white,
labelText: 'Re Enter 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(0XFF8270DB),width: 2,),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: greyColor),
),
suffixIcon: IconButton(
icon: isObscureTextForReEnter==true?Image.asset('images/eye_icon.png',color: Color(0XFF7E7F80),width: 16,height: 16,):Image.asset('images/open_eye.png',color:Color(0XFF7E7F80),width: 16,height: 16,),
/* Icon(
icon:Image.asset('assets/your_image.png'),
color: isObscureText==true?greyColor:primaryColor,
),*/
onPressed: () {
print("show password");
setState(() {
isObscureTextForReEnter = !isObscureTextForReEnter;
});
},
),
),
style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w400),
),
),
SizedBox(height: MediaQuery.of(context).size.height * .04),
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{
String createPassword = createPasswordController.text.trim();
String reEnterPassword = reEnterPasswordController.text.trim();
if (createPassword.isEmpty || reEnterPassword.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Please fill both password fields")),
);
} else if (createPassword != reEnterPassword) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Passwords do not match")),
);
} else {
// ✅ Passwords match → navigate to next page
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SignUp(mobileNumber: widget.mobileNumber,password: createPasswordController.text,)), // replace with your next page
);
}
},
child: Text(
'Login',
style: fontTextStyle(14, Color(0XFFFFFFFF), FontWeight.w600),
),
)),
SizedBox(height: MediaQuery.of(context).size.height * .012),
],
),
),
)
);
}
}