Files
mcbeno-app/lib/screens/splash_screen.dart

66 lines
2.0 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
late AnimationController _ctrl;
@override
void initState() {
super.initState();
_ctrl = AnimationController(vsync: this, duration: Duration(seconds: 3))..repeat(reverse: true);
// simulate load then navigate depending on token presence
Timer(Duration(seconds: 1), () {
Navigator.pushReplacementNamed(context, '/home');
});
}
@override
void dispose() {
_ctrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF0c0a0a),
body: Center(
child: AnimatedBuilder(
animation: _ctrl,
builder: (ctx, child) {
final t = _ctrl.value;
return Stack(
alignment: Alignment.center,
children: [
// liquid-ish blurred circles
Container(
width: 220 + 40 * t,
height: 220 + 40 * (1 - t),
decoration: BoxDecoration(
gradient: RadialGradient(colors: [Color(0xFFB388FF).withOpacity(0.25), Colors.transparent]),
shape: BoxShape.circle,
),
),
Container(
width: 140 + 60 * (1 - t),
height: 140 + 60 * t,
decoration: BoxDecoration(
gradient: RadialGradient(colors: [Color(0xFFA24BFA).withOpacity(0.6), Color(0xFF5E2FD3).withOpacity(0.2)]),
shape: BoxShape.circle,
),
),
Text('mcbeno', style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold, color: Colors.white)),
],
);
},
),
),
);
}
}