123 lines
3.8 KiB
Dart
123 lines
3.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../screens/features/absensi_screen.dart';
|
|
import '../screens/features/nilai_screen.dart';
|
|
import '../screens/features/kesehatan_screen.dart';
|
|
import '../screens/features/prestasi_screen.dart';
|
|
import '../screens/features/pelanggaran_screen.dart';
|
|
import '../screens/features/berita_screen.dart';
|
|
import '../screens/features/alumni_screen.dart';
|
|
import '../screens/features/pembayaran_screen.dart';
|
|
|
|
class FeatureGrid extends StatelessWidget {
|
|
final String token;
|
|
|
|
const FeatureGrid({super.key, required this.token});
|
|
|
|
final List<_FeatureItem> _items = const [
|
|
_FeatureItem('Absensi', Icons.how_to_reg),
|
|
_FeatureItem('Nilai', Icons.grade),
|
|
_FeatureItem('Kesehatan', Icons.local_hospital),
|
|
_FeatureItem('Prestasi', Icons.emoji_events),
|
|
_FeatureItem('Pelanggaran', Icons.report),
|
|
_FeatureItem('Berita', Icons.article),
|
|
_FeatureItem('Alumni', Icons.people),
|
|
_FeatureItem('Pembayaran', Icons.attach_money),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GridView.builder(
|
|
itemCount: _items.length,
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 4,
|
|
crossAxisSpacing: 12,
|
|
mainAxisSpacing: 12,
|
|
),
|
|
itemBuilder: (context, index) {
|
|
final item = _items[index];
|
|
|
|
return GestureDetector(
|
|
onTap: () {
|
|
Widget? destination;
|
|
|
|
switch (item.label) {
|
|
case 'Absensi':
|
|
destination = AbsensiScreen(token: token);
|
|
break;
|
|
case 'Nilai':
|
|
destination = NilaiScreen(token: token);
|
|
break;
|
|
case 'Kesehatan':
|
|
destination = KesehatanScreen(token: token);
|
|
break;
|
|
case 'Prestasi':
|
|
destination = PrestasiScreen(token: token);
|
|
break;
|
|
case 'Pelanggaran':
|
|
destination = PelanggaranScreen(token: token);
|
|
break;
|
|
case 'Berita':
|
|
destination = BeritaScreen(token: token);
|
|
break;
|
|
case 'Alumni':
|
|
destination = AlumniScreen(token: token);
|
|
break;
|
|
case 'Pembayaran':
|
|
destination = PembayaranScreen(token: token);
|
|
break;
|
|
}
|
|
|
|
if (destination != null) {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (_) => destination!),
|
|
);
|
|
}
|
|
},
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
gradient: const LinearGradient(
|
|
colors: [Color(0xFF43A047), Color(0xFFFFEB3B)],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
borderRadius: BorderRadius.circular(16),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.08),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(item.icon, size: 32, color: Colors.white),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
item.label,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class _FeatureItem {
|
|
final String label;
|
|
final IconData icon;
|
|
|
|
const _FeatureItem(this.label, this.icon);
|
|
}
|