amazonssimulation/lib/screens/login_screen.dart
2025-05-17 23:31:54 +03:00

133 lines
4.7 KiB
Dart

import 'package:flutter/material.dart';
import '/theme/app_theme.dart';
import '/widgets/logo_widget.dart';
import '/screens/verification_screen.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
final TextEditingController _phoneController = TextEditingController();
final _formKey = GlobalKey<FormState>();
void _connect() {
if (_formKey.currentState!.validate()) {
// Simulate API call or processing
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
VerificationScreen(phoneNumber: _phoneController.text),
),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(20.0),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Card(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const AmazonsLogo(),
const SizedBox(height: 30),
Text(
"Sign in here",
style: Theme.of(
context,
).textTheme.displayLarge?.copyWith(fontSize: 22),
),
const SizedBox(height: 20),
TextFormField(
controller: _phoneController,
keyboardType: TextInputType.phone,
decoration: const InputDecoration(
hintText: "Enter your phone number",
prefixIcon: Icon(Icons.phone_outlined),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your phone number';
}
if (value.length < 10) {
// Basic validation
return 'Phone number too short';
}
return null;
},
),
const SizedBox(height: 25),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: _connect,
child: const Text("Connect"),
),
),
const SizedBox(height: 30),
Text(
"Customer Service",
style: Theme.of(
context,
).textTheme.titleLarge?.copyWith(fontSize: 16),
),
const SizedBox(height: 5),
Text(
"0702026544 | 0790882866",
style: Theme.of(
context,
).textTheme.bodyMedium?.copyWith(
color: AppColors.primaryBlue,
fontWeight: FontWeight.w500,
),
),
],
),
),
),
const SizedBox(height: 40), // Space before footer
],
),
),
),
),
),
bottomNavigationBar: Container(
padding: const EdgeInsets.all(16.0),
child: Text(
"© 2025 Lence Amazons LLC. All rights reserved.",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 12),
),
),
);
}
@override
void dispose() {
_phoneController.dispose();
super.dispose();
}
}