mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
73 lines
3.0 KiB
Dart
73 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/category_view_app_bar.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
|
|
class ACsView extends StatelessWidget {
|
|
final DeviceModel? deviceModel;
|
|
const ACsView({this.deviceModel, super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (context) => ACsBloc(acId: deviceModel?.uuid ?? '')..add(AcsInitial()),
|
|
child: BlocBuilder<ACsBloc, AcsState>(
|
|
builder: (context, state) {
|
|
// BlocProvider.of<ACsBloc>(context).add(AcsInitial());
|
|
// DeviceModel? selectedAC;
|
|
// if (DevicesCubit.getInstance().getSelectedDevice() is DeviceModel) {
|
|
// selectedAC = DevicesCubit.getInstance().getSelectedDevice() as DeviceModel;
|
|
// }
|
|
return Scaffold(
|
|
backgroundColor: ColorsManager.backgroundColor,
|
|
// extendBodyBehindAppBar: true,
|
|
// extendBody: true,
|
|
appBar: CategoryViewAppBar(
|
|
title: deviceModel?.name ?? '',
|
|
),
|
|
body: SafeArea(
|
|
child: Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
height: MediaQuery.sizeOf(context).height,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
Assets.assetsImagesBackground,
|
|
),
|
|
fit: BoxFit.cover,
|
|
opacity: 0.4,
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: Constants.defaultPadding,
|
|
left: Constants.defaultPadding,
|
|
right: Constants.defaultPadding,
|
|
),
|
|
child: state is AcsLoadingState
|
|
? const Center(
|
|
child: DefaultContainer(
|
|
width: 50, height: 50, child: CircularProgressIndicator()),
|
|
)
|
|
: SizedBox.expand(
|
|
child: deviceModel != null ? AcInterface(ac: deviceModel!) : ACsList(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|