import 'package:chicken/page/amonia.dart';
import 'package:chicken/page/dashboard.dart';
import 'package:chicken/page/jadwal.dart';
import 'package:chicken/page/minum.dart';
import 'package:chicken/page/pakan.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const HomeApp());
}

class HomeApp extends StatefulWidget {
  const HomeApp({super.key});

  @override
  State<HomeApp> createState() => _HomeAppState();
}

class _HomeAppState extends State<HomeApp> {
  int _currentIndex = 0;

  final List<Widget> _pages = [
    Dashboard(),
    pakan(),
    minum(),
    jadwal(),
    AmoniaPage()
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Row(
          children: [
            Image.asset(
              'images/sipetra.png',
              width: 46,
              height: 46,
            ),
          ],
        ),
        backgroundColor: Colors.transparent,
        elevation: 0,
      ),
      body: _pages[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: (index) {
          setState(() {
            _currentIndex = index;
          });
        },
        backgroundColor: Color.fromARGB(255, 255, 79, 4),
        items: [
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Home',
            backgroundColor: Color.fromARGB(255, 255, 79, 4),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.food_bank_sharp),
            label: 'Makan',
            backgroundColor: Color.fromARGB(255, 255, 79, 4),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.water_drop),
            label: 'Minum',
            backgroundColor: Color.fromARGB(255, 255, 79, 4),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.schedule_rounded),
            label: 'Jadwal',
            backgroundColor: Color.fromARGB(255, 255, 79, 4),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.cottage),
            label: 'Kandang',
            backgroundColor: Color.fromARGB(255, 255, 79, 4),
          ),
        ],
      ),
    );
  }
}
