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.

139 lines
4.1 KiB

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'common/settings.dart';
import 'otp.dart';
class ConfirmMobileScreen extends StatefulWidget {
const ConfirmMobileScreen({super.key});
@override
State<ConfirmMobileScreen> createState() => _ConfirmMobileScreenState();
}
class _ConfirmMobileScreenState extends State<ConfirmMobileScreen> {
final TextEditingController mobileController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white, // ✅ Full white background
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
iconTheme: IconThemeData(color: Color(0XFF2A2A2A)),
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding:
const EdgeInsets.fromLTRB(8, 8, 8, 8), // Add padding if needed
child: Image.asset(
'images/backbutton_appbar.png', // Replace with your image path
fit: BoxFit.contain,
color: Color(0XFF2A2A2A),
height: 24,
width: 24,
),
),
),
title: Text(
"Confirm Mobile Number",
style: fontTextStyle(16, Color(0xFF000000), FontWeight.w800),
),
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 30),
Center(
child: Text(
"Enter registered mobile number",
style: fontTextStyle(16, Color(0xFF101214), FontWeight.w800),
textAlign: TextAlign.center,
),
),
const SizedBox(height: 40),
// Label
Text(
"Mobile Number",
style: fontTextStyle(12, Color(0xFF2F3036), FontWeight.w700),
),
const SizedBox(height: 8),
// TextField
TextField(
controller: mobileController,
keyboardType: TextInputType.phone,
inputFormatters: [
LengthLimitingTextInputFormatter(10), // max 10 digits
FilteringTextInputFormatter.digitsOnly, // only digits
],
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: "Enter your number",
hintStyle: fontTextStyle(14, Color(0xFF2A2A2A), FontWeight.w400),
),
),
const SizedBox(height: 40),
// Continue button
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0XFF101214),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
onPressed: () {
String mobile = mobileController.text.trim();
if (mobile.length == 10) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OtpScreen(
mobileNumber: mobile, // ✅ PASS NUMBER
),
),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Please enter 10 digits ❌"),
),
);
}
},
child: Text(
"Continue",
style: fontTextStyle(
14,
Colors.white,
FontWeight.w600),
),
),
),
],
),
),
);
}
}