Fixed design issues

This commit is contained in:
Abdullah Alassaf
2024-07-04 10:26:18 +03:00
parent 38af926d64
commit f2dc9cc11c
6 changed files with 628 additions and 622 deletions
@@ -28,60 +28,61 @@ class ACsView extends StatelessWidget {
child: BlocBuilder<ACsBloc, AcsState>(
builder: (context, state) {
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
),
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: deviceModel != null
? DeviceAppbar(
deviceName: deviceModel!.name!,
deviceUuid: deviceModel!.uuid!,
)
: AppBar(
backgroundColor: Colors.transparent,
centerTitle: true,
title: BodyLarge(
text: deviceModel?.name ?? "ACs",
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(
Assets.assetsImagesBackground,
),
fit: BoxFit.cover,
opacity: 0.4,
),
),
child: state is AcsLoadingState
? const Center(
child: DefaultContainer(
width: 50, height: 50, child: CircularProgressIndicator()),)
: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<ACsBloc>(context).add(AcsInitial(allAcs: deviceModel != null ? false : true));
},
child:ListView(
children: [
Container(
padding: const EdgeInsets.only(top: 40),
alignment: AlignmentDirectional.center,
child: deviceModel != null ? AcInterface(ac: deviceModel!) : const ACsList(),
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
),
],
),),
),
));
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: deviceModel != null
? DeviceAppbar(
deviceName: deviceModel!.name!,
deviceUuid: deviceModel!.uuid!,
)
: AppBar(
backgroundColor: Colors.transparent,
centerTitle: true,
title: BodyLarge(
text: deviceModel?.name ?? "ACs",
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(
Assets.assetsImagesBackground,
),
fit: BoxFit.cover,
opacity: 0.4,
),
),
child: state is AcsLoadingState
? const Center(
child: DefaultContainer(
width: 50, height: 50, child: CircularProgressIndicator()),
)
: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<ACsBloc>(context)
.add(AcsInitial(allAcs: deviceModel != null ? false : true));
},
child: Container(
padding: const EdgeInsets.only(top: 40),
alignment: AlignmentDirectional.center,
child: deviceModel != null
? AcInterface(ac: deviceModel!)
: const ACsList(),
),
),
),
));
},
),
);
@@ -30,313 +30,318 @@ class CeilingSensorInterface extends StatelessWidget {
// .value
// .toString();
return BlocProvider(
create: (context) =>
CeilingSensorBloc(deviceId: ceilingSensor.uuid ?? '')..add(InitialEvent()),
child: BlocBuilder<CeilingSensorBloc, CeilingSensorState>(builder: (context, state) {
CeilingSensorModel ceilingSensorModel =
CeilingSensorModel(presenceState: 'none', sensitivity: 1, checkingResult: '');
if (state is UpdateState) {
ceilingSensorModel = state.ceilingSensorModel;
} else if (state is LoadingNewSate) {
ceilingSensorModel = state.ceilingSensorModel;
}
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
return BlocProvider(
create: (context) =>
CeilingSensorBloc(deviceId: ceilingSensor.uuid ?? '')..add(InitialEvent()),
child: BlocBuilder<CeilingSensorBloc, CeilingSensorState>(builder: (context, state) {
CeilingSensorModel ceilingSensorModel =
CeilingSensorModel(presenceState: 'none', sensitivity: 1, checkingResult: '');
if (state is UpdateState) {
ceilingSensorModel = state.ceilingSensorModel;
} else if (state is LoadingNewSate) {
ceilingSensorModel = state.ceilingSensorModel;
}
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
),
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: DeviceAppbar(
deviceName: ceilingSensor.name!,
deviceUuid: ceilingSensor.uuid!,
),
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: DeviceAppbar(
deviceName: ceilingSensor.name!,
deviceUuid: ceilingSensor.uuid!,
),
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(
Assets.assetsImagesBackground,
),
fit: BoxFit.cover,
opacity: 0.4,
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(
Assets.assetsImagesBackground,
),
fit: BoxFit.cover,
opacity: 0.4,
),
child: state is LoadingInitialState
? const Center(
child: RefreshProgressIndicator(),
) : SafeArea(
child:
RefreshIndicator(
onRefresh: () async {
BlocProvider.of<CeilingSensorBloc>(context).add(InitialEvent());
},
child:Container(
child: ListView(
shrinkWrap: true,
children: [
Container(
height: MediaQuery.of(context).size.height,
),
child: state is LoadingInitialState
? const Center(
child: RefreshProgressIndicator(),
)
: SafeArea(
child: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<CeilingSensorBloc>(context).add(InitialEvent());
},
child: Container(
child: ListView(
shrinkWrap: true,
children: [
Container(
height: MediaQuery.of(context).size.height,
child: Column(
children: [
Expanded(
child: Column(
children: [
// InkWell(
// onTap: () {
// if ((ceilingSensor.isOnline ?? false) == false) {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// content: Text(
// 'Device is offline',
// ),
// backgroundColor: Colors.red,
// ),
// );
// return;
// }
// String controlCode = 'sensitivity';
// showDialog(
// context: context,
// builder: (context) => ParameterControlDialog(
// title: 'Sensitivity',
// sensor: ceilingSensor,
// controlCode: controlCode,
// value: ceilingSensor.status
// .firstWhere((element) => element.code == controlCode)
// .value as int,
// min: ceilingSensor.functions
// .firstWhere((element) => element.code == controlCode)
// .values
// ?.min ??
// 0,
// max: ceilingSensor.functions
// .firstWhere((element) => element.code == controlCode)
// .values
// ?.max ??
// 0,
// ),
// );
// },
// child:
// ),
child: Column(
children: [
Expanded(
child: Column(
children: [
// InkWell(
// onTap: () {
// if ((ceilingSensor.isOnline ?? false) == false) {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// content: Text(
// 'Device is offline',
// ),
// backgroundColor: Colors.red,
// ),
// );
// return;
// }
// String controlCode = 'sensitivity';
// showDialog(
// context: context,
// builder: (context) => ParameterControlDialog(
// title: 'Sensitivity',
// sensor: ceilingSensor,
// controlCode: controlCode,
// value: ceilingSensor.status
// .firstWhere((element) => element.code == controlCode)
// .value as int,
// min: ceilingSensor.functions
// .firstWhere((element) => element.code == controlCode)
// .values
// ?.min ??
// 0,
// max: ceilingSensor.functions
// .firstWhere((element) => element.code == controlCode)
// .values
// ?.max ??
// 0,
// ),
// );
// },
// child:
SvgPicture.asset(
ceilingSensorModel.presenceState.toLowerCase() ==
'motion'
? Assets
.assetsIconsPresenceSensorAssetsPresenceSensorMotion
: Assets.assetsIconsPresenceSensorAssetsPresence,
width: 100,
height: 100,
// colorFilter: ColorFilter.mode(
// (ceilingSensor.isOnline ?? false)
// ? ColorsManager.primaryColor
// : Colors.grey.withOpacity(0.9),
// BlendMode.srcIn,
// ),
SvgPicture.asset(
ceilingSensorModel.presenceState.toLowerCase() == 'motion'
? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion
: Assets.assetsIconsPresenceSensorAssetsPresence,
width: 100,
height: 100,
// colorFilter: ColorFilter.mode(
// (ceilingSensor.isOnline ?? false)
// ? ColorsManager.primaryColor
// : Colors.grey.withOpacity(0.9),
// BlendMode.srcIn,
// ),
),
const SizedBox(
height: 10,
),
BodyMedium(
text: StringHelpers.toTitleCase(
ceilingSensorModel.presenceState),
// (ceilingSensor.isOnline ?? false)
// ? StringHelpers.toTitleCase(ceilingSensor.status
// .firstWhere((element) =>
// element.code == 'presence_state')
// .value
// .toString())
// : "Offline",
style: context.bodyMedium.copyWith(
fontWeight: FontsManager.bold,
),
const SizedBox(
height: 10,
),
BodyMedium(
text:
StringHelpers.toTitleCase(ceilingSensorModel.presenceState),
// (ceilingSensor.isOnline ?? false)
// ? StringHelpers.toTitleCase(ceilingSensor.status
// .firstWhere((element) =>
// element.code == 'presence_state')
// .value
// .toString())
// : "Offline",
style: context.bodyMedium.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
),
],
),
Expanded(
flex: 3,
child: Column(
children: [
DefaultContainer(
padding: const EdgeInsets.symmetric(
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BodySmall(text: 'Sports Para'),
BodyLarge(
text: '0',
style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Container(
width: 1,
height: 45,
color: ColorsManager.greyColor,
),
),
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BodySmall(
text: 'Detection Range',
textOverflow: TextOverflow.ellipsis,
),
BodyLarge(
text: '0.0M',
textOverflow: TextOverflow.ellipsis,
style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Container(
width: 1,
height: 45,
color: ColorsManager.greyColor,
),
),
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BodySmall(
text: 'Movement',
textOverflow: TextOverflow.ellipsis,
),
BodyLarge(
text: 'none',
textOverflow: TextOverflow.ellipsis,
style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
),
],
)),
const SizedBox(
height: 15,
),
...List.generate(
ceilingSensorButtons().length,
(index) => DefaultContainer(
margin: const EdgeInsets.only(bottom: 5),
padding:
const EdgeInsets.symmetric(vertical: 12, horizontal: 20),
onTap: () async {
if (ceilingSensorButtons()[index]['title'] == 'Sensitivity') {
final result = await showDialog(
context: context,
builder: (context) {
return ParameterControlDialog(
title: ceilingSensorButtons()[index]['title']
.toString(),
sensor: ceilingSensor,
value: ceilingSensorModel.sensitivity,
min: 0,
max: 10,
);
},
);
if (result != null) {
BlocProvider.of<CeilingSensorBloc>(context).add(
ChangeValueEvent(
value: result, code: 'sensitivity'));
}
}
// if (ceilingSensorButtons[index]['page'] != null) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// ceilingSensorButtons[index]['page'] as Widget,
// ),
// );
// }
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
),
Expanded(
flex: 3,
child: Column(
children: [
DefaultContainer(
padding: const EdgeInsets.symmetric(
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
ceilingSensorButtons()[index]['icon'] as String,
// width: 30,
// height: 50,
),
const SizedBox(
width: 25,
),
BodyMedium(
text: ceilingSensorButtons()[index]['title']
as String,
style: context.bodyMedium.copyWith(
const BodySmall(text: 'Sports Para'),
BodyLarge(
text: '0',
style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
if (ceilingSensorButtons()[index]['withArrow'] == true)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(ceilingSensorButtons(
sensitivity_val: ceilingSensorModel
.sensitivity
.toString())[index]['val']
.toString()),
const Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 10),
child: Container(
width: 1,
height: 45,
color: ColorsManager.greyColor,
),
),
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BodySmall(
text: 'Detection Range',
textOverflow: TextOverflow.ellipsis,
),
BodyLarge(
text: '0.0M',
textOverflow: TextOverflow.ellipsis,
style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold,
),
],
),
],
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 10),
child: Container(
width: 1,
height: 45,
color: ColorsManager.greyColor,
),
),
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BodySmall(
text: 'Movement',
textOverflow: TextOverflow.ellipsis,
),
BodyLarge(
text: 'none',
textOverflow: TextOverflow.ellipsis,
style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
),
],
)),
const SizedBox(
height: 15,
),
for (int index = 0;
index < ceilingSensorButtons().length;
index++)
DefaultContainer(
margin: const EdgeInsets.only(bottom: 5),
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 20),
onTap: () async {
if (ceilingSensorButtons()[index]['title'] ==
'Sensitivity') {
final result = await showDialog(
context: context,
builder: (context) {
return ParameterControlDialog(
title: ceilingSensorButtons()[index]
['title']
.toString(),
sensor: ceilingSensor,
value: ceilingSensorModel.sensitivity,
min: 0,
max: 10,
);
},
);
if (result != null) {
BlocProvider.of<CeilingSensorBloc>(context).add(
ChangeValueEvent(
value: result, code: 'sensitivity'));
}
}
// if (ceilingSensorButtons[index]['page'] != null) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// ceilingSensorButtons[index]['page'] as Widget,
// ),
// );
// }
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SvgPicture.asset(
ceilingSensorButtons()[index]['icon']
as String,
// width: 30,
// height: 50,
),
],
),
const SizedBox(
width: 25,
),
BodyMedium(
text: ceilingSensorButtons()[index]['title']
as String,
style: context.bodyMedium.copyWith(
fontWeight: FontsManager.bold,
),
),
],
),
if (ceilingSensorButtons()[index]['withArrow'] ==
true)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(ceilingSensorButtons(
sensitivity_val: ceilingSensorModel
.sensitivity
.toString())[index]['val']
.toString()),
const Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
),
],
),
],
),
),
],
),
],
),
],
),
),
],
),
],
),
) ,
)
)),
),
);
}),
),
],
),
),
))),
),
);
}),
);
}
@@ -53,7 +53,6 @@ class ThreeGangInterface extends StatelessWidget {
child: SafeArea(
child: Padding(
padding: EdgeInsets.only(
top: Constants.appBarHeight,
left: Constants.defaultPadding,
right: Constants.defaultPadding,
bottom: Constants.bottomNavBarHeight,
@@ -56,14 +56,15 @@ class ThreeGangScreen extends StatelessWidget {
allSwitches: allSwitchesOn,
)
: RefreshIndicator(
onRefresh:()async {
BlocProvider.of<ThreeGangBloc>(context).add(InitialEvent(groupScreen: device != null ? false : true));
},
child: ListView(
children: [
SizedBox(
height: MediaQuery.of(context).size.height,
child: Column(
onRefresh: () async {
BlocProvider.of<ThreeGangBloc>(context)
.add(InitialEvent(groupScreen: device != null ? false : true));
},
child: ListView(
children: [
SizedBox(
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -157,239 +158,242 @@ class ThreeGangScreen extends StatelessWidget {
],
),
),
Expanded(
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: GestureDetector(
onTap: () {
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_1',
// value: true,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_2',
// value: true,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_3',
// value: true,
// ),
// device.uuid!,
// );
BlocProvider.of<ThreeGangBloc>(context).add(AllOnEvent());
},
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(100),
Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: GestureDetector(
onTap: () {
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_1',
// value: true,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_2',
// value: true,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_3',
// value: true,
// ),
// device.uuid!,
// );
BlocProvider.of<ThreeGangBloc>(context)
.add(AllOnEvent());
},
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(100),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: BodySmall(
text: "On",
style: context.bodyMedium.copyWith(
color: ColorsManager
.primaryColorWithOpacity,
fontWeight: FontWeight.bold),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: BodySmall(
text: "On",
style: context.bodyMedium.copyWith(
color: ColorsManager.primaryColorWithOpacity,
fontWeight: FontWeight.bold),
),
),
],
),
),
),
const SizedBox(height: 10),
BodySmall(
text: "All On",
style: context.bodyMedium.copyWith(
color: ColorsManager.textPrimaryColor,
),
),
],
),
const SizedBox(
width: 20,
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: GestureDetector(
onTap: () {
Navigator.push(
context,
PageRouteBuilder(
pageBuilder:
(context, animation1, animation2) =>
ScheduleScreen(
device: device!,
)));
},
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(100),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: Icon(
Icons.access_time,
color:
ColorsManager.primaryColorWithOpacity,
size: 25,
),
),
],
),
),
],
),
),
const SizedBox(height: 10),
BodySmall(
text: "All On",
style: context.bodyMedium.copyWith(
color: ColorsManager.textPrimaryColor,
),
),
const SizedBox(height: 10),
BodySmall(
text: "Timer",
style: context.bodyMedium.copyWith(
color: ColorsManager.textPrimaryColor,
),
],
),
const SizedBox(
width: 20,
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: GestureDetector(
onTap: () {
Navigator.push(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
ScheduleScreen(
device: device!,
)));
},
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(100),
),
],
),
const SizedBox(
width: 20,
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: GestureDetector(
onTap: () {
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_1',
// value: false,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_2',
// value: false,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_3',
// value: false,
// ),
// device.uuid!,
// );
BlocProvider.of<ThreeGangBloc>(context)
.add(AllOffEvent());
},
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(100),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: BodySmall(
text: "Off",
style: context.bodyMedium.copyWith(
color: ColorsManager
.primaryColorWithOpacity,
fontWeight: FontWeight.bold),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: Icon(
Icons.access_time,
color: ColorsManager.primaryColorWithOpacity,
size: 25,
),
),
),
],
),
),
],
),
),
const SizedBox(height: 10),
BodySmall(
text: "Timer",
style: context.bodyMedium.copyWith(
color: ColorsManager.textPrimaryColor,
),
),
const SizedBox(height: 10),
BodySmall(
text: "All Off",
style: context.bodyMedium.copyWith(
color: ColorsManager.textPrimaryColor,
),
],
),
const SizedBox(
width: 20,
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: GestureDetector(
onTap: () {
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_1',
// value: false,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_2',
// value: false,
// ),
// device.uuid!,
// );
// DevicesCubit.getInstance().deviceControl(
// DeviceControlModel(
// deviceId: device.uuid,
// code: 'switch_3',
// value: false,
// ),
// device.uuid!,
// );
BlocProvider.of<ThreeGangBloc>(context)
.add(AllOffEvent());
},
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(100),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: BodySmall(
text: "Off",
style: context.bodyMedium.copyWith(
color: ColorsManager.primaryColorWithOpacity,
fontWeight: FontWeight.bold),
),
),
),
],
),
),
),
const SizedBox(height: 10),
BodySmall(
text: "All Off",
style: context.bodyMedium.copyWith(
color: ColorsManager.textPrimaryColor,
),
),
],
),
],
),
),
],
),
],
),
),
Expanded(child: SizedBox())
],
),
),
],
),
);
),
],
),
);
},
),
);
@@ -53,7 +53,6 @@ class ParametersList extends StatelessWidget {
0,
),
);
print('result=== $result');
if (result != null) {
BlocProvider.of<WallSensorBloc>(context)
.add(ChangeValueEvent(value: result, code: controlCode));
@@ -49,64 +49,62 @@ class WallMountedInterface extends StatelessWidget {
wallSensorModel = state.wallSensorModel;
}
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
),
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: DeviceAppbar(
deviceName: deviceModel.name!,
deviceUuid: deviceModel.uuid!,
value: SystemUiOverlayStyle(
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
statusBarIconBrightness: Brightness.light,
),
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(
Assets.assetsImagesBackground,
),
fit: BoxFit.cover,
opacity: 0.4,
),
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: DeviceAppbar(
deviceName: deviceModel.name!,
deviceUuid: deviceModel.uuid!,
),
child: state is LoadingInitialState
? const Center(
child: RefreshProgressIndicator(),
)
: SafeArea(
child: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<WallSensorBloc>(context).add(InitialEvent());
},
child:
ListView(
children: [
Container(
height: MediaQuery.of(context).size.height,
child: Column(
children: [
PresenceIndicator(
state: wallSensorModel.presenceState,
),
ParametersList(
wallSensor: deviceModel,
presenceSensorsModel: wallSensorModel,
),
],
),
),
],
),
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(
Assets.assetsImagesBackground,
),
),
),
));
fit: BoxFit.cover,
opacity: 0.4,
),
),
child: state is LoadingInitialState
? const Center(
child: RefreshProgressIndicator(),
)
: SafeArea(
child: RefreshIndicator(
onRefresh: () async {
BlocProvider.of<WallSensorBloc>(context).add(InitialEvent());
},
child: ListView(
children: [
Container(
height: MediaQuery.of(context).size.height,
child: Column(
children: [
PresenceIndicator(
state: wallSensorModel.presenceState,
),
ParametersList(
wallSensor: deviceModel,
presenceSensorsModel: wallSensorModel,
),
],
),
),
],
),
),
),
),
));
}),
);
}