mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
pull to refresh
This commit is contained in:
@ -63,20 +63,25 @@ class ACsView extends StatelessWidget {
|
|||||||
opacity: 0.4,
|
opacity: 0.4,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: state is AcsLoadingState
|
child: state is AcsLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
width: 50, height: 50, child: CircularProgressIndicator()),
|
width: 50, height: 50, child: CircularProgressIndicator()),)
|
||||||
)
|
: RefreshIndicator(
|
||||||
: Container(
|
onRefresh: () async {
|
||||||
padding: const EdgeInsets.only(top: 40),
|
BlocProvider.of<ACsBloc>(context).add(AcsInitial(allAcs: deviceModel != null ? false : true));
|
||||||
alignment: AlignmentDirectional.center,
|
},
|
||||||
child:
|
child:ListView(
|
||||||
deviceModel != null ? AcInterface(ac: deviceModel!) : const ACsList(),
|
children: [
|
||||||
),
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 40),
|
||||||
|
alignment: AlignmentDirectional.center,
|
||||||
|
child: deviceModel != null ? AcInterface(ac: deviceModel!) : const ACsList(),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),),
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -29,297 +29,314 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
// .firstWhere((element) => element.code == "presence_state")
|
// .firstWhere((element) => element.code == "presence_state")
|
||||||
// .value
|
// .value
|
||||||
// .toString();
|
// .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,
|
|
||||||
),
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: state is LoadingInitialState
|
|
||||||
? const Center(
|
|
||||||
child: RefreshProgressIndicator(),
|
|
||||||
)
|
|
||||||
: SafeArea(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
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,
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
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: 2,
|
|
||||||
child: ListView(
|
|
||||||
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) {
|
return BlocProvider(
|
||||||
// Navigator.push(
|
create: (context) =>
|
||||||
// context,
|
CeilingSensorBloc(deviceId: ceilingSensor.uuid ?? '')..add(InitialEvent()),
|
||||||
// MaterialPageRoute(
|
child: BlocBuilder<CeilingSensorBloc, CeilingSensorState>(builder: (context, state) {
|
||||||
// builder: (context) =>
|
CeilingSensorModel ceilingSensorModel =
|
||||||
// ceilingSensorButtons[index]['page'] as Widget,
|
CeilingSensorModel(presenceState: 'none', sensitivity: 1, checkingResult: '');
|
||||||
// ),
|
if (state is UpdateState) {
|
||||||
// );
|
ceilingSensorModel = state.ceilingSensorModel;
|
||||||
// }
|
} else if (state is LoadingNewSate) {
|
||||||
},
|
ceilingSensorModel = state.ceilingSensorModel;
|
||||||
child: Row(
|
}
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
return AnnotatedRegion(
|
||||||
children: [
|
value: SystemUiOverlayStyle(
|
||||||
Row(
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||||
children: [
|
statusBarIconBrightness: Brightness.light,
|
||||||
SvgPicture.asset(
|
),
|
||||||
ceilingSensorButtons()[index]['icon'] as String,
|
child: Scaffold(
|
||||||
// width: 30,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
// height: 50,
|
extendBodyBehindAppBar: true,
|
||||||
),
|
extendBody: true,
|
||||||
const SizedBox(
|
appBar: DeviceAppbar(
|
||||||
width: 25,
|
deviceName: ceilingSensor.name!,
|
||||||
),
|
deviceUuid: ceilingSensor.uuid!,
|
||||||
BodyMedium(
|
),
|
||||||
text: ceilingSensorButtons()[index]['title']
|
body: Container(
|
||||||
as String,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
style: context.bodyMedium.copyWith(
|
height: MediaQuery.sizeOf(context).height,
|
||||||
fontWeight: FontsManager.bold,
|
padding: const EdgeInsets.all(Constants.defaultPadding),
|
||||||
),
|
decoration: const BoxDecoration(
|
||||||
),
|
image: DecorationImage(
|
||||||
],
|
image: AssetImage(
|
||||||
),
|
Assets.assetsImagesBackground,
|
||||||
if (ceilingSensorButtons()[index]['withArrow'] == true)
|
),
|
||||||
Row(
|
fit: BoxFit.cover,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
opacity: 0.4,
|
||||||
children: [
|
),
|
||||||
Text(ceilingSensorButtons(
|
),
|
||||||
sensitivity_val: ceilingSensorModel
|
child: state is LoadingInitialState
|
||||||
.sensitivity
|
? const Center(
|
||||||
.toString())[index]['val']
|
child: RefreshProgressIndicator(),
|
||||||
.toString()),
|
) : SafeArea(
|
||||||
const Icon(
|
child:
|
||||||
Icons.arrow_forward_ios,
|
RefreshIndicator(
|
||||||
color: ColorsManager.greyColor,
|
onRefresh: () async {
|
||||||
size: 15,
|
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:
|
||||||
|
// ),
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
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(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
) ,
|
||||||
),
|
)
|
||||||
)),
|
|
||||||
),
|
)),
|
||||||
);
|
),
|
||||||
}),
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +39,8 @@ class GateWayView extends StatelessWidget {
|
|||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar:DeviceAppbar(
|
appBar:DeviceAppbar(
|
||||||
deviceName: 'Gateway',
|
deviceName: 'Gateway',
|
||||||
deviceUuid: gatewayObj.uuid!,
|
deviceUuid: gatewayObj.uuid!,),
|
||||||
),
|
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
@ -55,81 +54,95 @@ class GateWayView extends StatelessWidget {
|
|||||||
opacity: 0.4,
|
opacity: 0.4,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: RefreshIndicator(
|
||||||
child: Column(
|
onRefresh:()async {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
BlocProvider.of<GatewayBloc>(context).add(GatewayInitial(gatewayId: gatewayObj.uuid ?? ''));
|
||||||
|
},
|
||||||
|
child: ListView(
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: MediaQuery.sizeOf(context).height * 0.3,
|
height: MediaQuery.of(context).size.height,
|
||||||
width: MediaQuery.sizeOf(context).width,
|
child: SafeArea(
|
||||||
alignment: AlignmentDirectional.center,
|
child: Column(
|
||||||
child: Stack(children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
SvgPicture.asset(
|
children: [
|
||||||
Assets.gatewayIcon,
|
Container(
|
||||||
width: 125,
|
height: MediaQuery.sizeOf(context).height * 0.3,
|
||||||
height: 125,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
),
|
alignment: AlignmentDirectional.center,
|
||||||
Positioned(
|
child: Stack(children: [
|
||||||
right: 30,
|
SvgPicture.asset(
|
||||||
top: 15,
|
Assets.gatewayIcon,
|
||||||
child: Container(
|
width: 125,
|
||||||
width: 12,
|
height: 125,
|
||||||
height: 12,
|
),
|
||||||
decoration: const BoxDecoration(
|
Positioned(
|
||||||
color: ColorsManager.lightGreen,
|
right: 30,
|
||||||
shape: BoxShape.circle,
|
top: 15,
|
||||||
|
child: Container(
|
||||||
|
width: 12,
|
||||||
|
height: 12,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: ColorsManager.lightGreen,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
),
|
if (devicesList.isEmpty && state is UpdateGatewayState)
|
||||||
),
|
Container(
|
||||||
]),
|
width: MediaQuery.sizeOf(context).width,
|
||||||
),
|
alignment: AlignmentDirectional.center,
|
||||||
if (devicesList.isEmpty && state is UpdateGatewayState)
|
child: const BodyMedium(
|
||||||
Container(
|
text: 'No devices found',
|
||||||
width: MediaQuery.sizeOf(context).width,
|
fontSize: 15,
|
||||||
alignment: AlignmentDirectional.center,
|
fontWeight: FontWeight.w700,
|
||||||
child: const BodyMedium(
|
),
|
||||||
text: 'No devices found',
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (devicesList.isNotEmpty)
|
|
||||||
const BodyMedium(
|
|
||||||
text: 'Zigbee Devices',
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
state is GatewayLoadingState
|
|
||||||
? Center(
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(top: 20),
|
|
||||||
height: 50,
|
|
||||||
width: 50,
|
|
||||||
child: const RefreshProgressIndicator()),
|
|
||||||
)
|
|
||||||
: Expanded(
|
|
||||||
child: GridView.builder(
|
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 2,
|
|
||||||
crossAxisSpacing: 10,
|
|
||||||
mainAxisSpacing: 10,
|
|
||||||
childAspectRatio: 1.5,
|
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.only(top: 10),
|
if (devicesList.isNotEmpty)
|
||||||
shrinkWrap: true,
|
const BodyMedium(
|
||||||
itemCount: devicesList.length,
|
text: 'Zigbee Devices',
|
||||||
itemBuilder: (context, index) {
|
fontSize: 15,
|
||||||
return RoomPageSwitch(device: devicesList[index]);
|
fontWeight: FontWeight.w700,
|
||||||
},
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
),
|
),
|
||||||
)
|
state is GatewayLoadingState
|
||||||
|
? Center(
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.only(top: 20),
|
||||||
|
height: 50,
|
||||||
|
width: 50,
|
||||||
|
child: const RefreshProgressIndicator()),
|
||||||
|
)
|
||||||
|
: Expanded(
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
crossAxisSpacing: 10,
|
||||||
|
mainAxisSpacing: 10,
|
||||||
|
childAspectRatio: 1.5,
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.only(top: 10),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: devicesList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return RoomPageSwitch(device: devicesList[index]);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)));
|
)
|
||||||
|
));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,14 @@ class DoorInterface extends StatelessWidget {
|
|||||||
? const Center(
|
? const Center(
|
||||||
child: RefreshProgressIndicator(),
|
child: RefreshProgressIndicator(),
|
||||||
)
|
)
|
||||||
: Column(
|
:
|
||||||
|
|
||||||
|
RefreshIndicator(
|
||||||
|
onRefresh: () async {
|
||||||
|
BlocProvider.of<SmartDoorBloc>(context).add(InitialEvent());
|
||||||
|
},
|
||||||
|
child:
|
||||||
|
ListView(
|
||||||
children: [
|
children: [
|
||||||
DoorLockStatusBar(
|
DoorLockStatusBar(
|
||||||
smartDoorModel: smartDoorModel,
|
smartDoorModel: smartDoorModel,
|
||||||
@ -120,7 +127,7 @@ class DoorInterface extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -55,326 +55,341 @@ class ThreeGangScreen extends StatelessWidget {
|
|||||||
threeGangList: groupThreeGangModel,
|
threeGangList: groupThreeGangModel,
|
||||||
allSwitches: allSwitchesOn,
|
allSwitches: allSwitchesOn,
|
||||||
)
|
)
|
||||||
: Column(
|
: RefreshIndicator(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
onRefresh:()async {
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
BlocProvider.of<ThreeGangBloc>(context).add(InitialEvent(groupScreen: device != null ? false : true));
|
||||||
|
},
|
||||||
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
const Expanded(child: SizedBox.shrink()),
|
SizedBox(
|
||||||
Row(
|
height: MediaQuery.of(context).size.height,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
GangSwitch(
|
|
||||||
threeGangSwitch: device!,
|
|
||||||
value: threeGangModel.firstSwitch,
|
|
||||||
action: () {
|
|
||||||
BlocProvider.of<ThreeGangBloc>(context).add(
|
|
||||||
ChangeFirstSwitchStatusEvent(
|
|
||||||
value: threeGangModel.firstSwitch));
|
|
||||||
},
|
|
||||||
// control: DeviceControlModel(
|
|
||||||
// deviceId: device.uuid,
|
|
||||||
// // code: 'switch_1',
|
|
||||||
// code: device.status[0].code,
|
|
||||||
// // value: true,
|
|
||||||
// value: device.status[0].value,
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
const SizedBox(
|
|
||||||
width: 70,
|
|
||||||
child: BodySmall(
|
|
||||||
text: "Bedside Light",
|
|
||||||
fontColor: ColorsManager.textPrimaryColor,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
GangSwitch(
|
|
||||||
threeGangSwitch: device!,
|
|
||||||
value: threeGangModel.secondSwitch,
|
|
||||||
action: () {
|
|
||||||
BlocProvider.of<ThreeGangBloc>(context).add(
|
|
||||||
ChangeSecondSwitchStatusEvent(
|
|
||||||
value: threeGangModel.secondSwitch));
|
|
||||||
},
|
|
||||||
// control: DeviceControlModel(
|
|
||||||
// // deviceId: 'bfe10693d4fd263206ocq9',
|
|
||||||
// // code: 'switch_2',
|
|
||||||
// // value: true,
|
|
||||||
// deviceId: device.uuid,
|
|
||||||
// code: device.status[1].code,
|
|
||||||
// value: device.status[1].value,
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
const SizedBox(
|
|
||||||
width: 70,
|
|
||||||
child: BodySmall(
|
|
||||||
text: "Ceiling Light",
|
|
||||||
fontColor: ColorsManager.textPrimaryColor,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
GangSwitch(
|
|
||||||
threeGangSwitch: device!,
|
|
||||||
value: threeGangModel.thirdSwitch,
|
|
||||||
action: () {
|
|
||||||
BlocProvider.of<ThreeGangBloc>(context).add(
|
|
||||||
ChangeThirdSwitchStatusEvent(
|
|
||||||
value: threeGangModel.thirdSwitch));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
const SizedBox(
|
|
||||||
width: 70,
|
|
||||||
child: BodySmall(
|
|
||||||
text: "Spotlight",
|
|
||||||
fontColor: ColorsManager.textPrimaryColor,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Center(
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
const Expanded(child: SizedBox.shrink()),
|
||||||
mainAxisSize: MainAxisSize.min,
|
Expanded(
|
||||||
children: [
|
child: Row(
|
||||||
Card(
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
elevation: 3,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
shape: RoundedRectangleBorder(
|
children: [
|
||||||
borderRadius: BorderRadius.circular(100),
|
Column(
|
||||||
|
children: [
|
||||||
|
GangSwitch(
|
||||||
|
threeGangSwitch: device!,
|
||||||
|
value: threeGangModel.firstSwitch,
|
||||||
|
action: () {
|
||||||
|
BlocProvider.of<ThreeGangBloc>(context).add(
|
||||||
|
ChangeFirstSwitchStatusEvent(
|
||||||
|
value: threeGangModel.firstSwitch));
|
||||||
|
},
|
||||||
|
// control: DeviceControlModel(
|
||||||
|
// deviceId: device.uuid,
|
||||||
|
// // code: 'switch_1',
|
||||||
|
// code: device.status[0].code,
|
||||||
|
// // value: true,
|
||||||
|
// value: device.status[0].value,
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const SizedBox(
|
||||||
|
width: 70,
|
||||||
|
child: BodySmall(
|
||||||
|
text: "Bedside Light",
|
||||||
|
fontColor: ColorsManager.textPrimaryColor,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: GestureDetector(
|
Column(
|
||||||
onTap: () {
|
children: [
|
||||||
// DevicesCubit.getInstance().deviceControl(
|
GangSwitch(
|
||||||
// DeviceControlModel(
|
threeGangSwitch: device!,
|
||||||
// deviceId: device.uuid,
|
value: threeGangModel.secondSwitch,
|
||||||
// code: 'switch_1',
|
action: () {
|
||||||
// value: true,
|
BlocProvider.of<ThreeGangBloc>(context).add(
|
||||||
// ),
|
ChangeSecondSwitchStatusEvent(
|
||||||
// device.uuid!,
|
value: threeGangModel.secondSwitch));
|
||||||
// );
|
},
|
||||||
// DevicesCubit.getInstance().deviceControl(
|
// control: DeviceControlModel(
|
||||||
// DeviceControlModel(
|
// // deviceId: 'bfe10693d4fd263206ocq9',
|
||||||
// deviceId: device.uuid,
|
// // code: 'switch_2',
|
||||||
// code: 'switch_2',
|
// // value: true,
|
||||||
// value: true,
|
// deviceId: device.uuid,
|
||||||
// ),
|
// code: device.status[1].code,
|
||||||
// device.uuid!,
|
// value: device.status[1].value,
|
||||||
// );
|
// ),
|
||||||
// DevicesCubit.getInstance().deviceControl(
|
),
|
||||||
// DeviceControlModel(
|
const SizedBox(height: 20),
|
||||||
// deviceId: device.uuid,
|
const SizedBox(
|
||||||
// code: 'switch_3',
|
width: 70,
|
||||||
// value: true,
|
child: BodySmall(
|
||||||
// ),
|
text: "Ceiling Light",
|
||||||
// device.uuid!,
|
fontColor: ColorsManager.textPrimaryColor,
|
||||||
// );
|
textAlign: TextAlign.center,
|
||||||
BlocProvider.of<ThreeGangBloc>(context).add(AllOnEvent());
|
),
|
||||||
},
|
),
|
||||||
child: Stack(
|
],
|
||||||
alignment: Alignment.center,
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
GangSwitch(
|
||||||
|
threeGangSwitch: device!,
|
||||||
|
value: threeGangModel.thirdSwitch,
|
||||||
|
action: () {
|
||||||
|
BlocProvider.of<ThreeGangBloc>(context).add(
|
||||||
|
ChangeThirdSwitchStatusEvent(
|
||||||
|
value: threeGangModel.thirdSwitch));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const SizedBox(
|
||||||
|
width: 70,
|
||||||
|
child: BodySmall(
|
||||||
|
text: "Spotlight",
|
||||||
|
fontColor: ColorsManager.textPrimaryColor,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Card(
|
||||||
width: 60,
|
elevation: 3,
|
||||||
height: 60,
|
shape: RoundedRectangleBorder(
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.grey[300],
|
|
||||||
borderRadius: BorderRadius.circular(100),
|
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(
|
const SizedBox(height: 10),
|
||||||
width: 40,
|
BodySmall(
|
||||||
height: 40,
|
text: "All On",
|
||||||
decoration: BoxDecoration(
|
style: context.bodyMedium.copyWith(
|
||||||
color: Colors.white,
|
color: ColorsManager.textPrimaryColor,
|
||||||
borderRadius: BorderRadius.circular(100),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: BodySmall(
|
|
||||||
text: "On",
|
|
||||||
style: context.bodyMedium.copyWith(
|
|
||||||
color: ColorsManager.primaryColorWithOpacity,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
),
|
width: 20,
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
BodySmall(
|
Column(
|
||||||
text: "All On",
|
mainAxisSize: MainAxisSize.min,
|
||||||
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: [
|
children: [
|
||||||
Container(
|
Card(
|
||||||
width: 60,
|
elevation: 3,
|
||||||
height: 60,
|
shape: RoundedRectangleBorder(
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.grey[300],
|
|
||||||
borderRadius: BorderRadius.circular(100),
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Container(
|
const SizedBox(height: 10),
|
||||||
width: 40,
|
BodySmall(
|
||||||
height: 40,
|
text: "Timer",
|
||||||
decoration: BoxDecoration(
|
style: context.bodyMedium.copyWith(
|
||||||
color: Colors.white,
|
color: ColorsManager.textPrimaryColor,
|
||||||
borderRadius: BorderRadius.circular(100),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Icon(
|
|
||||||
Icons.access_time,
|
|
||||||
color: ColorsManager.primaryColorWithOpacity,
|
|
||||||
size: 25,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
),
|
width: 20,
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
BodySmall(
|
Column(
|
||||||
text: "Timer",
|
mainAxisSize: MainAxisSize.min,
|
||||||
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: [
|
children: [
|
||||||
Container(
|
Card(
|
||||||
width: 60,
|
elevation: 3,
|
||||||
height: 60,
|
shape: RoundedRectangleBorder(
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.grey[300],
|
|
||||||
borderRadius: BorderRadius.circular(100),
|
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(
|
const SizedBox(height: 10),
|
||||||
width: 40,
|
BodySmall(
|
||||||
height: 40,
|
text: "All Off",
|
||||||
decoration: BoxDecoration(
|
style: context.bodyMedium.copyWith(
|
||||||
color: Colors.white,
|
color: ColorsManager.textPrimaryColor,
|
||||||
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())
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -79,21 +79,34 @@ class WallMountedInterface extends StatelessWidget {
|
|||||||
child: RefreshProgressIndicator(),
|
child: RefreshProgressIndicator(),
|
||||||
)
|
)
|
||||||
: SafeArea(
|
: SafeArea(
|
||||||
child: Column(
|
child: RefreshIndicator(
|
||||||
|
onRefresh: () async {
|
||||||
|
BlocProvider.of<WallSensorBloc>(context).add(InitialEvent());
|
||||||
|
},
|
||||||
|
child:
|
||||||
|
ListView(
|
||||||
children: [
|
children: [
|
||||||
PresenceIndicator(
|
Container(
|
||||||
state: wallSensorModel.presenceState,
|
height: MediaQuery.of(context).size.height,
|
||||||
),
|
child: Column(
|
||||||
ParametersList(
|
|
||||||
wallSensor: deviceModel,
|
children: [
|
||||||
presenceSensorsModel: wallSensorModel,
|
PresenceIndicator(
|
||||||
|
state: wallSensorModel.presenceState,
|
||||||
|
),
|
||||||
|
ParametersList(
|
||||||
|
wallSensor: deviceModel,
|
||||||
|
presenceSensorsModel: wallSensorModel,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user