TKK_E32230206/lib/features/landing/landing_page.dart

192 lines
5.9 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/routes.dart';
class LandingPage extends StatefulWidget {
const LandingPage({super.key});
@override
State<LandingPage> createState() => _LandingPageState();
}
class _LandingPageState extends State<LandingPage>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _fadeAnimation;
late Animation<Offset> _slideAnimation;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 900),
);
_fadeAnimation = Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeIn),
);
_slideAnimation = Tween<Offset>(
begin: const Offset(0, 0.3),
end: Offset.zero,
).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeOut),
);
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
Future.delayed(const Duration(milliseconds: 900), () {
if (mounted) {
_controller.forward();
}
});
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: FadeTransition(
opacity: _fadeAnimation,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/// HERO LOGO
Hero(
tag: "appLogo",
child: Image.asset(
'assets/images/logo_jamur.png',
height: 140,
width: 140,
fit: BoxFit.contain,
),
),
const SizedBox(height: 16),
/// TITLE
const Text(
"Selamat Datang di\nJamur Tiram Antirogo",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 16),
/// DESCRIPTION
const Text(
"Solusi IoT cerdas untuk monitoring dan kendali budidaya jamur tiram secara real-time, efisien, akurat, berbasis teknologi otomatis modern.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Colors.black54,
height: 1.5,
),
),
const SizedBox(height: 50),
/// BUTTON SECTION (Slide Up)
SlideTransition(
position: _slideAnimation,
child: Column(
children: [
/// LOGIN BUTTON
SizedBox(
width: double.infinity,
height: 55,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF3E5F6F),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
onPressed: () {
Navigator.pushNamed(context, AppRoutes.login);
},
child: const Text(
"Masuk",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
),
),
const SizedBox(height: 16),
/// REGISTER BUTTON
SizedBox(
width: double.infinity,
height: 55,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
side: const BorderSide(
color: Color(0xFF3E5F6F),
width: 1.5,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
onPressed: () {
Navigator.pushNamed(context, AppRoutes.register);
},
child: const Text(
"Belum ada akun? Daftar dulu",
style: TextStyle(
fontSize: 16,
color: Color(0xFF3E5F6F),
fontWeight: FontWeight.w500,
),
),
),
),
],
),
),
const Spacer(),
/// TERMS
const Padding(
padding: EdgeInsets.only(bottom: 16),
child: Text(
"Dengan masuk atau mendaftar, kamu menyetujui\nKetentuan Layanan dan Kebijakan Privasi",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
color: Colors.black45,
),
),
),
],
),
),
),
),
);
}
}