import 'package:flutter/material.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/dashboard/view/widgets/carbon_emission.dart';
import 'package:syncrow_app/features/dashboard/view/widgets/consumption.dart';
import 'package:syncrow_app/features/dashboard/view/widgets/live_monitor_tab.dart';
import 'package:syncrow_app/features/shared_widgets/create_unit.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';

// import 'widgets/energy_usage.dart';

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

  @override
  Widget build(BuildContext context) {
    return HomeCubit.getInstance().spaces?.isEmpty ?? true
        ? const CreateUnitWidget()
        : SingleChildScrollView(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                const TitleMedium(
                  text: StringsManager.dashboard,
                  style: TextStyle(
                    fontSize: 32,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                const LiveMonitorTab(),
                const SizedBox(height: 10),
                // const EnergyUsage(),
                Container(
                  padding: const EdgeInsets.only(top: 20),
                  constraints: const BoxConstraints(
                    minHeight: 220,
                    maxHeight: 240,
                  ),
                  child: const Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Consumption(),
                      SizedBox(height: 20),
                      CarbonEmission(),
                    ],
                  ),
                ),
              ],
            ),
          );
  }
}
