Files
syncrow-app/lib/features/devices/view/widgets/ac_view.dart
Mohammad Salameh abe7072f2d AC devices page implemented
AC Cubit Add
New Devices Cubit Arch will be used
Devices Cubit (for devices categories, and devices page)
{
AC cubit,
Lights cubit.
... }
Replaced AssetsManager with Assets Class (auto generated)
2024-02-26 15:55:22 +03:00

73 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:gap/gap.dart';
import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/a_c_control_unit.dart';
import 'package:syncrow_app/features/devices/view/widgets/devices_temp_widget.dart';
import 'package:syncrow_app/features/devices/view/widgets/universal_a_c_switch.dart';
import 'package:syncrow_app/features/devices/view/widgets/universal_a_c_temp.dart';
import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
class ACView extends StatelessWidget {
const ACView({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => AcCubit(),
child: BlocBuilder<AcCubit, AcState>(
builder: (context, state) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// universal AC controller
const Gap(10),
const BodySmall(text: "All ACs"),
const Gap(5),
const UniversalACSwitch(),
const Gap(10),
const UniversalACTemp(),
const Gap(10),
// other ACs controller
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(0),
itemCount: DevicesCubit.categories[0].devices.length,
itemBuilder: (context, index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BodySmall(
text:
DevicesCubit.categories[0].devices[index].name),
const Gap(5),
DevicesDefaultSwitch(
model: DevicesCubit.categories[0].devices[index],
),
const Gap(10),
DevicesTempWidget(
model: DevicesCubit.categories[0].devices[index],
),
const Gap(10),
ACControlUnit(
model: DevicesCubit.categories[0].devices[index],
),
const Gap(10),
],
);
},
),
],
),
);
},
),
);
}
}