Your changes
This commit is contained in:
@@ -21,16 +21,20 @@ class _SignupScreenState extends State<SignupScreen> {
|
||||
bool sending = false;
|
||||
|
||||
void _sendOtp() async {
|
||||
// We don't call backend for OTP here per your flow - OTP is default 123456.
|
||||
// Validate minimal
|
||||
if (cName.text.trim().isEmpty || cCompany.text.trim().isEmpty || cEmail.text.trim().isEmpty || cMobile.text.trim().isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Please fill the required fields')));
|
||||
if (cName.text.trim().isEmpty ||
|
||||
cCompany.text.trim().isEmpty ||
|
||||
cEmail.text.trim().isEmpty ||
|
||||
cMobile.text.trim().isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Please fill the required fields')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => sending = true);
|
||||
await Future.delayed(const Duration(milliseconds: 600)); // UI feel
|
||||
await Future.delayed(const Duration(milliseconds: 600));
|
||||
setState(() => sending = false);
|
||||
// Navigate to OTP screen with collected data
|
||||
|
||||
final data = {
|
||||
'customer_name': cName.text.trim(),
|
||||
'company_name': cCompany.text.trim(),
|
||||
@@ -40,40 +44,152 @@ class _SignupScreenState extends State<SignupScreen> {
|
||||
'address': cAddress.text.trim(),
|
||||
'pincode': cPincode.text.trim(),
|
||||
};
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_) => OtpScreen(signupPayload: data)));
|
||||
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => OtpScreen(signupPayload: data),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pad = MediaQuery.of(context).size.width * 0.06;
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text("Create Account")),
|
||||
backgroundColor: const Color(0xFFE8F0FF), // Same as Login background
|
||||
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: pad),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
const SizedBox(height: 16),
|
||||
RoundedInput(controller: cName, hint: "Customer name"),
|
||||
const SizedBox(height: 12),
|
||||
RoundedInput(controller: cCompany, hint: "Company name"),
|
||||
const SizedBox(height: 12),
|
||||
RoundedInput(controller: cDesignation, hint: "Designation (optional)"),
|
||||
const SizedBox(height: 12),
|
||||
RoundedInput(controller: cEmail, hint: "Email", keyboardType: TextInputType.emailAddress),
|
||||
const SizedBox(height: 12),
|
||||
RoundedInput(controller: cMobile, hint: "Mobile", keyboardType: TextInputType.phone),
|
||||
const SizedBox(height: 12),
|
||||
RoundedInput(controller: cAddress, hint: "Address", maxLines: 3),
|
||||
const SizedBox(height: 12),
|
||||
RoundedInput(controller: cPincode, hint: "Pincode", keyboardType: TextInputType.number),
|
||||
const SizedBox(height: 20),
|
||||
PrimaryButton(label: "Send OTP", onTap: _sendOtp, busy: sending),
|
||||
const SizedBox(height: 14),
|
||||
]),
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
|
||||
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/// 🔵 Back Button (scrolls with form)
|
||||
Material(
|
||||
elevation: 6,
|
||||
shape: const CircleBorder(),
|
||||
color: Colors.indigo.shade700,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Icon(Icons.arrow_back, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
/// 📦 White Elevated Signup Box
|
||||
Center(
|
||||
child: Container(
|
||||
width: width * 0.88,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 28, horizontal: 22),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
blurRadius: 18,
|
||||
spreadRadius: 2,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
"Create Account",
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.indigo.shade700,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 25),
|
||||
|
||||
_blueInput(cName, "Customer name"),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_blueInput(cCompany, "Company name"),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_blueInput(cDesignation, "Designation (optional)"),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_blueInput(
|
||||
cEmail,
|
||||
"Email",
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_blueInput(
|
||||
cMobile,
|
||||
"Mobile",
|
||||
keyboardType: TextInputType.phone,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_blueInput(
|
||||
cAddress,
|
||||
"Address",
|
||||
maxLines: 3,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_blueInput(
|
||||
cPincode,
|
||||
"Pincode",
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
|
||||
const SizedBox(height: 25),
|
||||
|
||||
PrimaryButton(
|
||||
label: "Send OTP",
|
||||
onTap: _sendOtp,
|
||||
busy: sending,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 🔵 Blue soft background input wrapper (same as Login)
|
||||
Widget _blueInput(
|
||||
TextEditingController controller,
|
||||
String hint, {
|
||||
TextInputType? keyboardType,
|
||||
int maxLines = 1,
|
||||
}) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFD8E7FF),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: RoundedInput(
|
||||
controller: controller,
|
||||
hint: hint,
|
||||
// keyboardType: keyboardType,
|
||||
maxLines: maxLines,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user