feat: introduce core mobile UI components including login screen, IPTV tabs, theme, and scaffold.

This commit is contained in:
Michael committed 2025-12-13 09:04:09 +01:00
1 parent 985a46f777
commit 33fcfe12db
7 files changed
+710 -435

No files matched your search

@@ -1,10 +1,11 @@
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 '../../../../features/auth/providers/auth_provider.dart';
import '../../../../core/theme/app_colors.dart';
import '../../../../core/widgets/glass_container.dart';
import '../../../theme/mobile_theme.dart';
import '../../../../core/widgets/components/ui_components.dart';
class MobileLoginScreen extends ConsumerStatefulWidget {
const MobileLoginScreen({super.key});
@@ -19,6 +20,14 @@ class _MobileLoginScreenState extends ConsumerState<MobileLoginScreen> {
final _passwordController = TextEditingController();
bool _obscurePassword = true;
@override
void initState() {
super.initState();
// Pre-fill for convenience (as requested in original file)
_usernameController.text = 'admin';
_passwordController.text = 'admin';
}
@override
void dispose() {
_usernameController.dispose();
@@ -47,126 +56,212 @@ class _MobileLoginScreenState extends ConsumerState<MobileLoginScreen> {
return Theme(
data: MobileTheme.darkTheme,
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: AppColors.background,
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// Logo
Container(
width: 72,
height: 72,
decoration: BoxDecoration(
color: AppColors.surface,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColors.border),
),
child: const Icon(
Icons.live_tv,
color: AppColors.primary,
size: 36,
),
body: Stack(
fit: StackFit.expand,
children: [
// Cinematic Background Gradient
Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF000000), // Deep Black
Color(0xFF0F0F12), // Subtle Gray
Color(0xFF000000), // Back to Black
],
),
const SizedBox(height: 16),
const Text(
'XtremFlow',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.w800,
color: AppColors.textPrimary,
letterSpacing: -0.5,
),
),
),
// Ambient Glow Top Left
Positioned(
top: -100,
left: -100,
child: Container(
width: 300,
height: 300,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColors.primary.withOpacity(0.15),
boxShadow: [
BoxShadow(
color: AppColors.primary.withOpacity(0.15),
blurRadius: 150,
spreadRadius: 50,
),
],
),
const SizedBox(height: 4),
const Text(
'Mobile Edition',
style: TextStyle(
fontSize: 12,
color: AppColors.textSecondary,
letterSpacing: 1.5,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 48),
// Form
Form(
key: _formKey,
),
),
// Content
Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: GlassContainer(
borderRadius: 24,
opacity: 0.7,
padding: const EdgeInsets.all(32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextFormField(
controller: _usernameController,
style: const TextStyle(color: AppColors.textPrimary),
decoration: const InputDecoration(
labelText: 'Username',
prefixIcon: Icon(Icons.person_outline),
// Logo / Icon
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.1),
shape: BoxShape.circle,
border: Border.all(color: Colors.white24),
),
child: const Icon(
Icons.live_tv_rounded,
color: Colors.white,
size: 40,
),
validator: (value) =>
(value == null || value.trim().isEmpty) ? 'Required' : null,
textInputAction: TextInputAction.next,
),
const SizedBox(height: 16),
TextFormField(
controller: _passwordController,
obscureText: _obscurePassword,
style: const TextStyle(color: AppColors.textPrimary),
decoration: InputDecoration(
labelText: 'Password',
prefixIcon: const Icon(Icons.lock_outline),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
const SizedBox(height: 24),
Text(
'XtremFlow',
style: GoogleFonts.inter(
fontSize: 32,
fontWeight: FontWeight.w700,
color: Colors.white,
letterSpacing: -1.0,
),
),
Text(
'Mobile Edition',
style: GoogleFonts.inter(
fontSize: 14,
color: Colors.white54,
letterSpacing: 0.5,
),
),
const SizedBox(height: 48),
// Form
Form(
key: _formKey,
child: Column(
children: [
_buildInput(
controller: _usernameController,
label: 'Username',
icon: Icons.person_outline_rounded,
),
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
),
),
validator: (value) =>
(value == null || value.isEmpty) ? 'Required' : null,
onFieldSubmitted: (_) => _handleLogin(),
),
if (authState.errorMessage != null) ...[
const SizedBox(height: 16),
Text(
authState.errorMessage!,
style: const TextStyle(color: AppColors.error, fontSize: 12),
textAlign: TextAlign.center,
),
],
const SizedBox(height: 32),
SizedBox(
width: double.infinity,
child: FilledButton(
onPressed: authState.isLoading ? null : _handleLogin,
child: authState.isLoading
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(strokeWidth: 2, color: Colors.black),
)
: const Text('Sign In'),
const SizedBox(height: 16),
_buildInput(
controller: _passwordController,
label: 'Password',
icon: Icons.lock_outline_rounded,
isPassword: true,
obscureText: _obscurePassword,
onTogglePassword: () => setState(() => _obscurePassword = !_obscurePassword),
onSubmitted: (_) => _handleLogin(),
),
if (authState.errorMessage != null) ...[
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: AppColors.error.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColors.error.withOpacity(0.3)),
),
child: Text(
authState.errorMessage!,
style: GoogleFonts.inter(color: AppColors.error, fontSize: 13),
textAlign: TextAlign.center,
),
),
],
const SizedBox(height: 32),
SizedBox(
width: double.infinity,
height: 50,
child: FilledButton(
onPressed: authState.isLoading ? null : _handleLogin,
style: FilledButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
elevation: 0,
).copyWith(
overlayColor: MaterialStateProperty.all(Colors.black12),
),
child: authState.isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(strokeWidth: 2, color: Colors.black),
)
: Text(
'Sign In',
style: GoogleFonts.inter(fontWeight: FontWeight.w600, fontSize: 16),
),
),
),
],
),
),
],
),
),
const SizedBox(height: 24),
const Text(
'Default: admin / admin',
style: TextStyle(
fontSize: 12,
color: AppColors.textTertiary,
fontStyle: FontStyle.italic,
),
),
],
),
),
),
],
),
),
);
}
Widget _buildInput({
required TextEditingController controller,
required String label,
required IconData icon,
bool isPassword = false,
bool obscureText = false,
VoidCallback? onTogglePassword,
Function(String)? onSubmitted,
}) {
return TextFormField(
controller: controller,
obscureText: obscureText,
style: GoogleFonts.inter(color: Colors.white),
decoration: InputDecoration(
labelText: label,
labelStyle: GoogleFonts.inter(color: Colors.white54),
prefixIcon: Icon(icon, color: Colors.white54),
suffixIcon: isPassword
? IconButton(
icon: Icon(obscureText ? Icons.visibility_outlined : Icons.visibility_off_outlined, color: Colors.white38),
onPressed: onTogglePassword,
)
: null,
filled: true,
fillColor: Colors.white.withOpacity(0.1),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: const BorderSide(color: Colors.white, width: 2), // White Focus
),
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
),
validator: (value) => (value == null || value.trim().isEmpty) ? 'Required' : null,
onFieldSubmitted: onSubmitted,
);
}
}