import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
import 'package:krezus/domains/budget/budget_bloc.dart';
import 'package:krezus/pages/budgets/widgets/budget_cards.dart';
import 'package:krezus/pages/budgets/widgets/budget_compare_selector.dart';
import 'package:krezus/pages/budgets/widgets/budget_radar.dart';
import 'package:krezus/pages/common/titled_container.dart';

class BudgetComparator extends StatelessWidget {
  const BudgetComparator({super.key});

  @override
  Widget build(BuildContext context) {
    bool smallVerticalScreen = MediaQuery.sizeOf(context).width < 800;
    return BlocBuilder<BudgetBloc, BudgetState>(
      builder: (context, state) => TitledContainer(
        title: 'Compare', 
        child: smallVerticalScreen 
        ? const Column(
          children: [
            BudgetCompareSelector(),
            SizedBox(
              height: 500,
              child: BudgetRadar(),
            ),
            SizedBox(
              height: 10,
            ),
            SizedBox(
              height: 500,
              child: BudgetCards(),
            ),
          ],
        )
        : const Column(
          children: [
            BudgetCompareSelector(),
            Row(
              children: [
                BudgetCards(),
                BudgetRadar(),
              ],
            )
          ]
        ),
      )
    );
  }
}