88 lines
2.8 KiB
Dart

import 'dart:math' as math;
import 'package:flutter/material.dart';
import '../core/app_theme.dart';
class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppTheme.navy,
body: Stack(
fit: StackFit.expand,
children: [
CustomPaint(painter: _FamilyCanvasPainter()),
SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 88,
height: 88,
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: .12),
borderRadius: BorderRadius.circular(28),
),
child: const Icon(
Icons.cloud_upload_rounded,
color: Colors.white,
size: 46,
),
),
const SizedBox(height: 28),
const Text(
'Welcome to',
style: TextStyle(color: Colors.white70, fontSize: 18),
),
const SizedBox(height: 8),
const Text(
'Metatroncube\nDigital Family',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w800,
fontSize: 32,
height: 1.1,
),
),
const SizedBox(height: 34),
const SizedBox(
width: 28,
height: 28,
child: CircularProgressIndicator(
strokeWidth: 2.5,
color: AppTheme.mint,
),
),
],
),
),
),
),
],
),
);
}
}
class _FamilyCanvasPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()..style = PaintingStyle.fill;
for (var i = 0; i < 18; i++) {
final x = (math.sin(i * 2.7) + 1) * size.width / 2;
final y = (math.cos(i * 1.9) + 1) * size.height / 2;
paint.color = (i.isEven ? AppTheme.blue : AppTheme.mint).withValues(
alpha: .12,
);
canvas.drawCircle(Offset(x, y), 12 + (i % 5) * 8, paint);
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}