bug fixes and read sensors states

This commit is contained in:
Abdullah Alassaf
2024-06-06 11:14:25 +03:00
parent 631ba53d7a
commit 76f5c6d325
20 changed files with 561 additions and 547 deletions
@@ -5,7 +5,6 @@ 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_controls.dart';
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_temp_unit.dart';
import 'package:syncrow_app/generated/assets.dart';
class AcInterface extends StatelessWidget {
const AcInterface({super.key, required this.ac});
@@ -31,43 +30,30 @@ class AcInterface extends StatelessWidget {
// extendBodyBehindAppBar: true,
// extendBody: true,
// body:
Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
Assets.assetsImagesBackground,
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 380,
),
child: AcInterfaceTempUnit(
acDevice: ac,
),
),
fit: BoxFit.cover,
opacity: 0.4,
),
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 380,
),
child: AcInterfaceTempUnit(
acDevice: ac,
),
const SizedBox(
height: 10,
),
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 130,
),
const SizedBox(
height: 10,
child: AcInterfaceControls(
deviceModel: ac,
),
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 130,
),
child: AcInterfaceControls(
deviceModel: ac,
),
),
],
),
),
],
),
);
// );
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.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';
@@ -8,9 +9,11 @@ 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/features/shared_widgets/text_widgets/body_large.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';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
class ACsView extends StatelessWidget {
final DeviceModel? deviceModel;
@@ -27,17 +30,28 @@ class ACsView extends StatelessWidget {
// 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 ?? '',
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
),
body: SafeArea(
child: Container(
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
centerTitle: true,
title: BodyLarge(
text: deviceModel?.name ?? "",
fontColor: ColorsManager.primaryColor,
fontWeight: FontsManager.bold,
),
),
body: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
padding: const EdgeInsets.all(Constants.defaultPadding),
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
@@ -47,21 +61,16 @@ class ACsView extends StatelessWidget {
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(),
),
),
child: state is AcsLoadingState
? const Center(
child: DefaultContainer(
width: 50, height: 50, child: CircularProgressIndicator()),
)
: Container(
padding: const EdgeInsets.only(top: 25),
alignment: AlignmentDirectional.center,
child: deviceModel != null ? AcInterface(ac: deviceModel!) : ACsList(),
),
),
),
);
@@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/utils/context_extension.dart';