260 lines
9.0 KiB
Dart
260 lines
9.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import '../widgets/animated_button.dart';
|
|
import 'login_page.dart';
|
|
import 'about_page.dart';
|
|
import 'privacy_page.dart';
|
|
|
|
class HomePage extends StatelessWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final alturaTela = MediaQuery.of(context).size.height;
|
|
|
|
return Scaffold(
|
|
body: Stack(
|
|
children: [
|
|
// Fundo
|
|
Container(
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('assets/images/background.png'),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
|
|
// Conteúdo scrollável
|
|
SafeArea(
|
|
child: Stack(
|
|
children: [
|
|
SingleChildScrollView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints(minHeight: alturaTela * 0.9),
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const SizedBox(height: 80),
|
|
|
|
// Textos superiores
|
|
Text(
|
|
'BEM-VINDO À BIBLIOTECA DIGITAL',
|
|
style: GoogleFonts.fredoka(
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.orangeAccent,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 50),
|
|
Text(
|
|
'MAKER BOOK',
|
|
style: GoogleFonts.fredoka(
|
|
fontSize: 45,
|
|
color: Colors.deepOrangeAccent,
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
),
|
|
const SizedBox(height: 60),
|
|
|
|
// Botão com mão
|
|
Stack(
|
|
clipBehavior: Clip.none,
|
|
alignment: Alignment.center,
|
|
children: [
|
|
AnimatedButton(
|
|
onTap: () {},
|
|
child: ElevatedButton(
|
|
onPressed: () async {
|
|
await Future.delayed(const Duration(milliseconds: 250));
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (context) => const LoginPage()),
|
|
);
|
|
},
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.orange,
|
|
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(30),
|
|
),
|
|
),
|
|
child: Text(
|
|
'ACESSAR LIVRO',
|
|
style: GoogleFonts.fredoka(
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
right: -30,
|
|
bottom: -25,
|
|
child: const AnimatedHand(size: 50),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 100),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// Botões no canto inferior esquerdo
|
|
Positioned(
|
|
left: 20,
|
|
bottom: 30,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
_bottomButton(
|
|
icon: Icons.lock_outline,
|
|
text: 'POLÍTICA DE PRIVACIDADE',
|
|
color: Colors.green[200],
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (_) => const PrivacyPage()));
|
|
},
|
|
),
|
|
const SizedBox(height: 10),
|
|
_bottomButton(
|
|
icon: Icons.info_outline,
|
|
text: 'SOBRE O APP',
|
|
color: Colors.blue[200],
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (_) => const AboutPage()));
|
|
},
|
|
),
|
|
const SizedBox(height: 10),
|
|
_bottomButton(
|
|
icon: Icons.exit_to_app,
|
|
text: 'SAIR DO APLICATIVO',
|
|
color: Colors.pink[200],
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (_) => AlertDialog(
|
|
title: const Text('Confirmação'),
|
|
content: const Text('Deseja realmente sair do aplicativo?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(context),
|
|
child: const Text('Cancelar'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => SystemNavigator.pop(),
|
|
child: const Text('Sair'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// Mascote
|
|
Positioned(
|
|
right: -90,
|
|
bottom: 0,
|
|
child: Image.asset(
|
|
'assets/images/robot.png',
|
|
width: 250,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
|
|
Widget _bottomButton({required IconData icon, required String text, required Color? color, required VoidCallback onTap}) {
|
|
return SizedBox(
|
|
width: 240, // ✅ Largura fixa para padronizar
|
|
child: AnimatedButton(
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
|
decoration: BoxDecoration(
|
|
color: color ?? Colors.white,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, color: Colors.black),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
text,
|
|
style: GoogleFonts.fredoka(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class AnimatedHand extends StatefulWidget {
|
|
final double size;
|
|
|
|
const AnimatedHand({super.key, this.size = 50});
|
|
|
|
@override
|
|
State<AnimatedHand> createState() => _AnimatedHandState();
|
|
}
|
|
|
|
class _AnimatedHandState extends State<AnimatedHand> with SingleTickerProviderStateMixin {
|
|
late AnimationController _controller;
|
|
late Animation<double> _animation;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
_controller = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(milliseconds: 800),
|
|
)..repeat(reverse: true); // vai e volta
|
|
|
|
_animation = Tween<double>(begin: 0.9, end: 1.2).animate(
|
|
CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ScaleTransition(
|
|
scale: _animation,
|
|
child: Image.asset(
|
|
'assets/images/hand.png',
|
|
width: widget.size,
|
|
height: widget.size,
|
|
),
|
|
);
|
|
}
|
|
}
|