import 'package:flutter/material.dart'; import 'chat_list_screen.dart'; import 'signup_screen.dart'; class LoginScreen extends StatefulWidget { const LoginScreen({super.key}); @override State createState() => _LoginScreenState(); } class _LoginScreenState extends State { final _emailController = TextEditingController(); final _passwordController = TextEditingController(); void _login() { // Navigate to chat list on successful login Navigator.pushReplacement( context, MaterialPageRoute(builder: (context) => const ChatListScreen()), ); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: SingleChildScrollView( padding: const EdgeInsets.all(24.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const Icon( Icons.chat_bubble_outline, size: 100, color: Color(0xFF2AABEE), ), const SizedBox(height: 32), const Text( 'Log in to Messenger', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), textAlign: TextAlign.center, ), const SizedBox(height: 8), const Text( 'Please enter your email and password.', style: TextStyle(color: Colors.grey), textAlign: TextAlign.center, ), const SizedBox(height: 32), TextField( controller: _emailController, keyboardType: TextInputType.emailAddress, decoration: const InputDecoration( labelText: 'Email', border: OutlineInputBorder(), prefixIcon: Icon(Icons.email), ), ), const SizedBox(height: 16), TextField( controller: _passwordController, obscureText: true, decoration: const InputDecoration( labelText: 'Password', border: OutlineInputBorder(), prefixIcon: Icon(Icons.lock), ), ), const SizedBox(height: 24), ElevatedButton( onPressed: _login, style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF2AABEE), foregroundColor: Colors.white, padding: const EdgeInsets.symmetric(vertical: 16), ), child: const Text('Log In', style: TextStyle(fontSize: 16)), ), const SizedBox(height: 16), TextButton( onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const SignupScreen()), ); }, child: const Text('Don\'t have an account? Sign up'), ), ], ), ), ), ); } }