import 'package:flutter/material.dart'; import '../theme/app_color.dart'; class LandingPage extends StatefulWidget { const LandingPage({super.key}); @override State createState() => _LandingPageState(); } class _LandingPageState extends State { final PageController _pageController = PageController(); int _currentPage = 0; @override void dispose() { _pageController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColor.background, body: SafeArea( child: Column( children: [ Expanded( child: PageView( controller: _pageController, physics: const BouncingScrollPhysics(), onPageChanged: (index) { setState(() { _currentPage = index; }); }, children: [_buildPage1(context), _buildPage2(context)], ), ), // Page Indicator Padding( padding: const EdgeInsets.only(bottom: 20), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: List.generate( 2, (index) => Container( margin: const EdgeInsets.symmetric(horizontal: 4), width: 8, height: 8, decoration: BoxDecoration( shape: BoxShape.circle, color: _currentPage == index ? AppColor.primary : AppColor.primary.withOpacity(0.3), ), ), ), ), ), ], ), ), ); } Widget _buildPage1(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const Spacer(), // Logo Container( width: 120, height: 120, padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: AppColor.primary.withOpacity(0.1), shape: BoxShape.circle, ), child: ClipOval( child: Image.asset( 'assets/images/logo_apsgo.png', fit: BoxFit.contain, errorBuilder: (context, error, stackTrace) { return Icon(Icons.eco, size: 60, color: AppColor.primary); }, ), ), ), const SizedBox(height: 40), Text( "ApsGo", style: TextStyle( fontSize: 32, fontWeight: FontWeight.bold, color: AppColor.primary, ), ), const SizedBox(height: 16), Text( "Kelola Hidupmu\nDengan Lebih Mudah", textAlign: TextAlign.center, style: TextStyle( fontSize: 18, fontWeight: FontWeight.w500, color: AppColor.textDark.withOpacity(0.7), height: 1.5, ), ), const SizedBox(height: 12), Text( "Semua yang kamu butuhkan dalam satu aplikasi", textAlign: TextAlign.center, style: TextStyle( fontSize: 14, color: AppColor.textDark.withOpacity(0.5), height: 1.4, ), ), const SizedBox(height: 60), // Tombol Next SizedBox( width: double.infinity, height: 56, child: ElevatedButton( onPressed: () { _pageController.nextPage( duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, ); }, style: ElevatedButton.styleFrom( backgroundColor: AppColor.primary, foregroundColor: Colors.white, elevation: 2, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), ), child: const Text( "Selanjutnya", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ), ), const Spacer(), ], ), ); } Widget _buildPage2(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const Spacer(), // Icon Features Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( color: AppColor.primary.withOpacity(0.1), shape: BoxShape.circle, ), child: Icon( Icons.rocket_launch_rounded, size: 80, color: AppColor.primary, ), ), const SizedBox(height: 40), Text( "Siap Memulai?", style: TextStyle( fontSize: 32, fontWeight: FontWeight.bold, color: AppColor.primary, ), ), const SizedBox(height: 16), Text( "Bergabunglah Dengan Kami\nDan Rasakan Kemudahannya", textAlign: TextAlign.center, style: TextStyle( fontSize: 18, fontWeight: FontWeight.w500, color: AppColor.textDark.withOpacity(0.7), height: 1.5, ), ), const SizedBox(height: 12), Text( "Daftar sekarang dan mulai perjalananmu", textAlign: TextAlign.center, style: TextStyle( fontSize: 14, color: AppColor.textDark.withOpacity(0.5), height: 1.4, ), ), const SizedBox(height: 60), // Tombol Get Started SizedBox( width: double.infinity, height: 56, child: ElevatedButton( onPressed: () { Navigator.pushNamed(context, '/login'); }, style: ElevatedButton.styleFrom( backgroundColor: AppColor.primary, foregroundColor: Colors.white, elevation: 2, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), ), child: const Text( "Get Started", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ), ), const Spacer(), ], ), ); } }