feat: Add splash screen and update routing to include it
This commit is contained in:
65
lib/screens/splash_screen.dart
Normal file
65
lib/screens/splash_screen.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
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
|
||||
Timer(Duration(seconds: 2), () {
|
||||
Navigator.pushReplacementNamed(context, '/');
|
||||
});
|
||||
}
|
||||
|
||||
@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)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user