tasktracker/lib/screens/auth_screen.dart
2025-10-07 21:54:06 +05:30

147 lines
4.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'login_screen.dart';
import 'register_screen.dart';
class AuthScreen extends StatefulWidget {
const AuthScreen({super.key});
@override
State<AuthScreen> createState() => _AuthScreenState();
}
class _AuthScreenState extends State<AuthScreen>
with SingleTickerProviderStateMixin {
late TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
return Scaffold(
backgroundColor: Colors.grey[50],
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
// Header Section
Container(
width: double.infinity,
padding: const EdgeInsets.all(32.0),
child: Column(
children: [
const SizedBox(height: 40),
// App Logo/Icon
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Theme.of(context).primaryColor.withValues(alpha: 0.3),
blurRadius: 20,
offset: const Offset(0, 10),
),
],
),
child: const Icon(
Icons.task_alt,
color: Colors.white,
size: 40,
),
),
const SizedBox(height: 24),
Text(
'TaskTracker',
style: GoogleFonts.poppins(
fontSize: 32,
fontWeight: FontWeight.bold,
color: Colors.grey[800],
),
),
const SizedBox(height: 8),
Text(
'Manage your tasks efficiently',
style: GoogleFonts.poppins(
fontSize: 16,
color: Colors.grey[600],
),
),
],
),
),
// Tab Bar
Container(
margin: const EdgeInsets.symmetric(horizontal: 24),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.1),
blurRadius: 10,
offset: const Offset(0, 5),
),
],
),
child: TabBar(
controller: _tabController,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Theme.of(context).primaryColor,
),
indicatorSize: TabBarIndicatorSize.tab, // Make indicator fill the tab
labelColor: Colors.white,
unselectedLabelColor: Colors.grey[600],
labelStyle: GoogleFonts.poppins(
fontWeight: FontWeight.w600,
fontSize: 16,
),
unselectedLabelStyle: GoogleFonts.poppins(
fontWeight: FontWeight.w500,
fontSize: 16,
),
tabs: const [
Tab(text: 'Login'),
Tab(text: 'Register'),
],
),
),
const SizedBox(height: 24),
// Tab Views
SizedBox(
height: screenHeight * 0.8,
child: TabBarView(
controller: _tabController,
children: [
LoginScreen(),
RegisterScreen(),
],
),
),
],
),
),
),
);
}
}