Documentação

This commit is contained in:
Carlos Correia
2026-05-03 23:31:31 +01:00
commit d24cb3242a
167 changed files with 14263 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
import 'dart:async';
import 'package:flutter/material.dart';
class HelloSplashScreen extends StatefulWidget {
const HelloSplashScreen({super.key, required this.onFinished, this.duration = const Duration(seconds: 5)});
final Duration duration;
final VoidCallback onFinished;
@override
State<HelloSplashScreen> createState() => _HelloSplashScreenState();
}
class _HelloSplashScreenState extends State<HelloSplashScreen> with SingleTickerProviderStateMixin {
late final AnimationController _controller;
late final Animation<double> _opacity;
Timer? _fadeTimer;
Timer? _doneTimer;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 500),
);
_opacity = CurvedAnimation(
parent: _controller,
curve: Curves.easeInOut,
);
_controller.value = 1.0;
final int fadeMs = (widget.duration.inMilliseconds - 500).clamp(0, widget.duration.inMilliseconds);
_fadeTimer = Timer(Duration(milliseconds: fadeMs), () {
if (!mounted) return;
_controller.reverse();
});
_doneTimer = Timer(widget.duration, () {
if (!mounted) return;
widget.onFinished();
});
}
@override
void dispose() {
_fadeTimer?.cancel();
_doneTimer?.cancel();
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.sizeOf(context);
return Scaffold(
body: FadeTransition(
opacity: _opacity,
child: Container(
width: size.width,
height: size.height,
color: const Color(0xFFFFC9DF),
child: SafeArea(
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const [
Text(
'Olá',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 64,
fontWeight: FontWeight.w900,
color: Colors.white,
height: 1.0,
),
),
],
),
),
),
),
),
);
}
}