import 'package:flutter/material.dart';
import 'Gaji.dart';
import 'Kasbon.dart';

const _bg        = Color(0xFFF9FAFB);
const _bg1       = Color(0xFFFFFFFF);
const _amber     = Color(0xFFF59E0B);
const _rose      = Color(0xFFEF4444);
const _t1        = Color(0xFF111827);
const _t2        = Color(0xFF6B7280);

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

  @override
  State<FinanceMainScreen> createState() => _FinanceMainScreenState();
}

class _FinanceMainScreenState extends State<FinanceMainScreen> with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: _bg,
      appBar: AppBar(
        elevation: 0,
        backgroundColor: _bg1,
        title: const Text('Keuangan Teknisi', 
          style: TextStyle(fontSize: 16, fontWeight: FontWeight.w800, color: _t1)),
        bottom: TabBar(
          controller: _tabController,
          indicatorColor: _amber,
          indicatorWeight: 3,
          labelColor: _t1,
          unselectedLabelColor: _t2,
          labelStyle: const TextStyle(fontWeight: FontWeight.w800, fontSize: 13, letterSpacing: 0.5),
          tabs: const [
            Tab(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Icon(Icons.payments_rounded, size: 18),
                  SizedBox(width: 8),
                  Text('RIWAYAT GAJI'),
                ],
              ),
            ),
            Tab(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Icon(Icons.account_balance_wallet_rounded, size: 18),
                  SizedBox(width: 8),
                  Text('RINCIAN KASBON'),
                ],
              ),
            ),
          ],
        ),
      ),
      body: TabBarView(
        controller: _tabController,
        children: const [
          GajiRiwayatScreen(),
          KasbonRiwayatScreen(),
        ],
      ),
    );
  }
}
