TKK_E32230814/lib/screens/landing_page.dart

335 lines
10 KiB
Dart

import 'package:flutter/material.dart';
import '../theme/app_color.dart';
class LandingPage extends StatefulWidget {
const LandingPage({super.key});
@override
State<LandingPage> createState() => _LandingPageState();
}
class _LandingPageState extends State<LandingPage> {
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_irrigo.png',
fit: BoxFit.contain,
errorBuilder: (context, error, stackTrace) {
return Icon(Icons.eco, size: 60, color: AppColor.primary);
},
),
),
),
const SizedBox(height: 40),
Text(
"IrriGo",
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: AppColor.primary,
),
),
const SizedBox(height: 16),
Text(
"Siram Tanamanmu\nDengan Lebih Pintar",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: AppColor.textDark.withOpacity(0.7),
height: 1.5,
),
),
const SizedBox(height: 12),
Text(
"Otomatisasi penyiraman untuk menjaga tanaman tetap segar dan sehat setiap hari",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: AppColor.textDark.withOpacity(0.5),
height: 1.4,
),
),
const SizedBox(height: 40),
// 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(),
_buildCollaborationFooter(),
const SizedBox(height: 16),
],
),
);
}
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 Merawat Tanamanmu?",
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: AppColor.primary,
),
),
const SizedBox(height: 16),
Text(
"Pantau kelembapan tanah dan atur jadwal penyiraman dalam satu genggaman",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: AppColor.textDark.withOpacity(0.7),
height: 1.5,
),
),
const SizedBox(height: 12),
Text(
"Mulai otomatisasi sekarang untuk hasil panen terbaik",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: AppColor.textDark.withOpacity(0.5),
height: 1.4,
),
),
const SizedBox(height: 40),
// 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(
"Mulai Dari Sekarang",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
),
),
const Spacer(),
_buildCollaborationFooter(),
const SizedBox(height: 16),
],
),
);
}
Widget _buildCollaborationFooter() {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Kampus Logo (Politeknik Negeri Jember)
Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
'assets/images/logo_polije.png',
height: 24,
errorBuilder: (context, error, stackTrace) {
// Fallback to existing asset logo_apsgo.png
return Image.asset(
'assets/images/logo_poliyey.png',
height: 24,
errorBuilder: (context, error, stackTrace) {
return Icon(
Icons.school,
size: 20,
color: AppColor.primary.withOpacity(0.7),
);
},
);
},
),
const SizedBox(width: 8),
const Text(
"Politeknik Negeri Jember",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: AppColor.textDark,
),
),
],
),
const SizedBox(width: 12),
Container(
height: 16,
width: 1,
color: AppColor.textDark.withOpacity(0.2),
),
const SizedBox(width: 12),
// Partner Logo (Mitra)
Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
'assets/images/logo_mitra.png',
height: 24,
errorBuilder: (context, error, stackTrace) {
// Fallback to existing asset logo_irrigo.png
return Image.asset(
'assets/images/logo_mitra.png',
height: 24,
errorBuilder: (context, error, stackTrace) {
return Icon(
Icons.handshake,
size: 20,
color: AppColor.primary.withOpacity(0.7),
);
},
);
},
),
const SizedBox(width: 8),
const Text(
"YUSUF BIBIT",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: AppColor.textDark,
),
),
],
),
],
),
const SizedBox(height: 6),
Text(
"by: Tugas Akhir",
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
color: AppColor.primary.withOpacity(0.8),
letterSpacing: 0.5,
),
),
],
);
}
}