feat: Establish initial application structure, theming, responsive utilities, and core feature screens.

This commit is contained in:
Michael committed 2025-12-06 16:38:15 +01:00
1 parent 33239ca11e
commit d2c92215e9
10 files changed
+1754 -332

No files matched your search

+198 -124
View File
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import '../providers/auth_provider.dart';
import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/widgets/components/ui_components.dart';
class LoginScreen extends ConsumerStatefulWidget {
const LoginScreen({super.key});
@@ -44,156 +46,228 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
return Scaffold(
body: Container(
decoration: BoxDecoration(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.blue.shade900,
Colors.black,
Color(0xFF0F1923), // Deep dark blue
AppColors.background,
Color(0xFF0A1628), // Navy accent
],
stops: [0.0, 0.5, 1.0],
),
),
child: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: Stack(
children: [
// Glow effect top
Positioned(
top: -100,
left: -100,
child: Container(
constraints: const BoxConstraints(maxWidth: 400),
padding: const EdgeInsets.all(32.0),
child: Form(
key: _formKey,
width: 300,
height: 300,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
AppColors.primary.withOpacity(0.1),
Colors.transparent,
],
),
),
),
),
// Glow effect bottom
Positioned(
bottom: -150,
right: -150,
child: Container(
width: 400,
height: 400,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
AppColors.secondary.withOpacity(0.08),
Colors.transparent,
],
),
),
),
),
// Main content
Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Container(
constraints: const BoxConstraints(maxWidth: 400),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Icon(
Icons.live_tv_rounded,
size: 64,
color: Colors.blue.shade700,
// Logo and title
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
gradient: AppColors.primaryGradient,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: AppColors.primary.withOpacity(0.4),
blurRadius: 30,
offset: const Offset(0, 10),
),
],
),
child: const Icon(
Icons.live_tv,
color: Colors.black,
size: 40,
),
),
const SizedBox(height: 16),
Text(
'XtremFlow IPTV',
style: GoogleFonts.roboto(
fontSize: 28,
fontWeight: FontWeight.bold,
const SizedBox(height: 24),
ShaderMask(
shaderCallback: (bounds) =>
AppColors.primaryGradient.createShader(bounds),
child: const Text(
'XtremFlow',
style: TextStyle(
fontSize: 36,
fontWeight: FontWeight.w800,
color: Colors.white,
),
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'Admin Access',
style: GoogleFonts.roboto(
'Streaming IPTV Premium',
style: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
color: AppColors.textSecondary,
letterSpacing: 1,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 32),
TextFormField(
controller: _usernameController,
decoration: InputDecoration(
labelText: 'Username',
prefixIcon: const Icon(Icons.person),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return 'Username required';
}
return null;
},
autofocus: true,
textInputAction: TextInputAction.next,
),
const SizedBox(height: 16),
TextFormField(
controller: _passwordController,
obscureText: _obscurePassword,
decoration: InputDecoration(
labelText: 'Password',
prefixIcon: const Icon(Icons.lock),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword
? Icons.visibility
: Icons.visibility_off,
),
onPressed: () {
setState(() {
_obscurePassword = !_obscurePassword;
});
},
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Password required';
}
return null;
},
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) => _handleLogin(),
),
if (authState.errorMessage != null) ...[
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.red.shade50,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.red.shade200),
),
child: Row(
const SizedBox(height: 48),
// Login form
GlassCard(
padding: const EdgeInsets.all(24),
borderRadius: AppTheme.radiusLg,
child: Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Icon(Icons.error_outline, color: Colors.red.shade700),
const SizedBox(width: 8),
Expanded(
child: Text(
authState.errorMessage!,
style: TextStyle(color: Colors.red.shade700),
Text(
'Connexion',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
),
),
const SizedBox(height: 24),
TextFormField(
controller: _usernameController,
decoration: InputDecoration(
labelText: 'Nom d\'utilisateur',
prefixIcon: Icon(
Icons.person_outline,
color: AppColors.textSecondary,
),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return 'Nom d\'utilisateur requis';
}
return null;
},
autofocus: true,
textInputAction: TextInputAction.next,
),
const SizedBox(height: 16),
TextFormField(
controller: _passwordController,
obscureText: _obscurePassword,
decoration: InputDecoration(
labelText: 'Mot de passe',
prefixIcon: Icon(
Icons.lock_outline,
color: AppColors.textSecondary,
),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
color: AppColors.textSecondary,
),
onPressed: () {
setState(() {
_obscurePassword = !_obscurePassword;
});
},
),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Mot de passe requis';
}
return null;
},
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) => _handleLogin(),
),
if (authState.errorMessage != null) ...[
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: AppColors.error.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: AppColors.error.withOpacity(0.3),
),
),
child: Row(
children: [
Icon(
Icons.error_outline,
color: AppColors.error,
size: 20,
),
const SizedBox(width: 8),
Expanded(
child: Text(
authState.errorMessage!,
style: TextStyle(
color: AppColors.error,
fontSize: 13,
),
),
),
],
),
),
],
const SizedBox(height: 24),
GradientButton(
label: 'Se connecter',
icon: Icons.login,
isLoading: authState.isLoading,
isExpanded: true,
onPressed: _handleLogin,
),
],
),
),
],
const SizedBox(height: 24),
ElevatedButton(
onPressed: authState.isLoading ? null : _handleLogin,
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: authState.isLoading
? const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Text(
'Login',
style: TextStyle(fontSize: 16),
),
),
const SizedBox(height: 16),
const SizedBox(height: 24),
Text(
'Default credentials: admin / admin',
style: GoogleFonts.roboto(
'Identifiants par défaut: admin / admin',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade500,
color: AppColors.textDisabled,
fontStyle: FontStyle.italic,
),
textAlign: TextAlign.center,
@@ -203,7 +277,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
),
),
),
),
],
),
),
);