mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-20 05:28:05 +02:00
Replaces the Projector Noir palette with "Warm Cinema" and rebuilds the web players around a shared, event-driven engine. Design - app_colors: warm charcoal (#0B0908), cream (#F3E9DF), ember (#D9541F); adds posterScrim/heroScrim gradients, lift()/emberFocus() shadows, const cream-alpha tokens replacing Colors.whiteNN, and primaryFill, a deeper ember reserved for text-bearing fills so white labels clear the 4.5:1 AA threshold that #D9541F alone does not - app_theme / mobile_theme: Fraunces (display serif) + Karla (body), tighter radii, 20+ component themes - glass_container: opaque layered surfaces replace the blurred glass - themed_loading_screen restyled; players and boot splash follow Performance - drop every BackdropFilter: backdrop blur forced a full framebuffer read per frame per card, the main source of scroll jank - bundle Fraunces/Karla as assets so google_fonts stops fetching from fonts.gstatic.com at startup - bound image decode size on 12 sites: a 40-poster grid drops from ~240 MB to a few tens of MB of GPU memory Players (new shared engine: web/xf-player-core.js) - start on media events instead of polling the buffer every 100-200 ms - hls.js/mpegts.js loaded on demand, so ~213 KB of mpegts is never fetched for HLS streams - liveSyncDurationCount 10 -> 2, startFragPrefetch on, testBandwidth off, MPEG-TS initial stash 512 KB -> 64 KB - adaptive escalation fast -> balanced -> safe after repeated stalls in a 60 s window, applied live for HLS so there is no visible cut Preserved from the recent streaming work on main: server-side quality selection, stable player viewId, the turbo direct MPEG-TS path, vendored library cache headers and the CI/Docker changes. Only the theme layer and the player front-end were replaced; GlassCard stays in ui_components. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
278 lines
11 KiB
Dart
278 lines
11 KiB
Dart
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';
|
|
|
|
class MobileLoginScreen extends ConsumerStatefulWidget {
|
|
const MobileLoginScreen({super.key});
|
|
|
|
@override
|
|
ConsumerState<MobileLoginScreen> createState() => _MobileLoginScreenState();
|
|
}
|
|
|
|
class _MobileLoginScreenState extends ConsumerState<MobileLoginScreen> {
|
|
final _formKey = GlobalKey<FormState>();
|
|
final _usernameController = TextEditingController();
|
|
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();
|
|
_passwordController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
Future<void> _handleLogin() async {
|
|
if (!_formKey.currentState!.validate()) return;
|
|
|
|
final auth = ref.read(authProvider.notifier);
|
|
final success = await auth.login(
|
|
_usernameController.text.trim(),
|
|
_passwordController.text,
|
|
);
|
|
|
|
if (success && mounted) {
|
|
context.go('/playlists');
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final authState = ref.watch(authProvider);
|
|
|
|
return Theme(
|
|
data: MobileTheme.darkTheme,
|
|
child: Scaffold(
|
|
resizeToAvoidBottomInset: false,
|
|
backgroundColor: AppColors.background,
|
|
body: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
// Cinematic Background Gradient
|
|
Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
AppColors.baseLevel0,
|
|
AppColors.surfaceContainerLowest,
|
|
AppColors.baseLevel0,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
// 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,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
// Content
|
|
Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: GlassContainer.floating(
|
|
borderRadius: 24,
|
|
padding: const EdgeInsets.all(32),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// Logo / Icon
|
|
Container(
|
|
width: 80,
|
|
height: 80,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surfaceContainer,
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: AppColors.outlineVariant),
|
|
),
|
|
child: const Icon(
|
|
Icons.live_tv_rounded,
|
|
color: AppColors.onSurface,
|
|
size: 40,
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
'XtremFlow',
|
|
style: GoogleFonts.fraunces(
|
|
fontSize: 32,
|
|
fontWeight: FontWeight.w700,
|
|
color: AppColors.onSurface,
|
|
letterSpacing: -1.0,
|
|
),
|
|
),
|
|
Text(
|
|
'Mobile Edition',
|
|
style: GoogleFonts.karla(
|
|
fontSize: 14,
|
|
color: AppColors.onSurfaceVariant,
|
|
letterSpacing: 0.5,
|
|
),
|
|
),
|
|
const SizedBox(height: 48),
|
|
|
|
// Form
|
|
Form(
|
|
key: _formKey,
|
|
child: Column(
|
|
children: [
|
|
_buildInput(
|
|
controller: _usernameController,
|
|
label: 'Username',
|
|
icon: Icons.person_outline_rounded,
|
|
),
|
|
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.karla(color: AppColors.error, fontSize: 13),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
],
|
|
|
|
const SizedBox(height: 32),
|
|
|
|
Container(
|
|
width: double.infinity,
|
|
height: 50,
|
|
decoration: BoxDecoration(
|
|
gradient: AppColors.primaryGradient,
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: AppColors.glowPrimary(0.4),
|
|
blurRadius: 16,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
),
|
|
child: FilledButton(
|
|
onPressed: authState.isLoading ? null : _handleLogin,
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: Colors.transparent,
|
|
foregroundColor: AppColors.onSurface,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
elevation: 0,
|
|
).copyWith(
|
|
overlayColor: WidgetStateProperty.all(AppColors.onSurface.withOpacity(0.1)),
|
|
),
|
|
child: authState.isLoading
|
|
? const SizedBox(
|
|
width: 24,
|
|
height: 24,
|
|
child: CircularProgressIndicator(strokeWidth: 2, color: AppColors.onSurface),
|
|
)
|
|
: Text(
|
|
'Sign In',
|
|
style: GoogleFonts.karla(fontWeight: FontWeight.w600, fontSize: 16, color: AppColors.onSurface),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
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.karla(color: AppColors.onSurface),
|
|
decoration: InputDecoration(
|
|
labelText: label,
|
|
labelStyle: GoogleFonts.karla(color: AppColors.onSurfaceVariant),
|
|
prefixIcon: Icon(icon, color: AppColors.onSurfaceVariant),
|
|
suffixIcon: isPassword
|
|
? IconButton(
|
|
icon: Icon(obscureText ? Icons.visibility_outlined : Icons.visibility_off_outlined, color: AppColors.outline),
|
|
onPressed: onTogglePassword,
|
|
)
|
|
: null,
|
|
filled: true,
|
|
fillColor: AppColors.surfaceContainerLow,
|
|
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: AppColors.primaryContainer, width: 2),
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
),
|
|
validator: (value) => (value == null || value.trim().isEmpty) ? 'Required' : null,
|
|
onFieldSubmitted: onSubmitted,
|
|
);
|
|
}
|
|
}
|