Compare commits

..

2 Commits

18 changed files with 48 additions and 97 deletions

View File

@ -38,7 +38,7 @@ abstract final class EnergyManagementChartsHelper {
sideTitles: SideTitles(
showTitles: true,
maxIncluded: false,
minIncluded: false,
minIncluded: true,
interval: leftTitlesInterval,
reservedSize: 110,
getTitlesWidget: (value, meta) => Padding(

View File

@ -78,7 +78,7 @@ class CustomWebTextField extends StatelessWidget {
controller: controller,
style: const TextStyle(color: Colors.black),
decoration: textBoxDecoration()!.copyWith(
errorStyle: const TextStyle(height: 0.01),
errorStyle: const TextStyle(height: 0),
hintStyle: context.textTheme.titleSmall!
.copyWith(color: Colors.grey, fontSize: 12),
hintText: hintText ?? 'Please enter'),

View File

@ -1,7 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/bloc/setting_bloc_bloc.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/sub_space_dialog.dart';
@ -66,14 +69,25 @@ class DeviceManagementContent extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(10.0),
child: InkWell(
onTap: () {
showSubSpaceDialog(
onTap: () async {
final selectedSubSpace = await showSubSpaceDialog(
context,
communityUuid: device.community!.uuid!,
spaceUuid: device.spaces!.first.uuid!,
subSpaces: subSpaces,
selected: device.subspace!.uuid,
selected: deviceInfo.subspace.uuid,
);
if (selectedSubSpace != null) {
Future.delayed(const Duration(milliseconds: 500), () {
context.read<SettingDeviceBloc>().add(
SettingBlocAssignRoom(
communityUuid: device.community!.uuid!,
spaceUuid: device.spaces!.first.uuid!,
subSpaceUuid: selectedSubSpace.id ?? '',
),
);
});
}
},
child: infoRow(
label: 'Sub-Space:',

View File

@ -9,13 +9,11 @@ import 'package:syncrow_web/utils/extension/build_context_x.dart';
class SubSpaceDialog extends StatefulWidget {
final List<SubSpaceModel> subSpaces;
final String? selected;
final void Function(SubSpaceModel?) onConfirmed;
const SubSpaceDialog({
Key? key,
required this.subSpaces,
this.selected,
required this.onConfirmed,
}) : super(key: key);
@override
@ -86,30 +84,21 @@ class _SubSpaceDialogState extends State<SubSpaceDialog> {
}
}
void showSubSpaceDialog(
Future<SubSpaceModel?> showSubSpaceDialog(
BuildContext context, {
required List<SubSpaceModel> subSpaces,
String? selected,
required String communityUuid,
required String spaceUuid,
}) {
showDialog(
return showDialog<SubSpaceModel>(
context: context,
barrierDismissible: true,
builder: (ctx) => SubSpaceDialog(
subSpaces: subSpaces,
selected: selected,
onConfirmed: (selectedModel) {
if (selectedModel != null) {
context.read<SettingDeviceBloc>().add(
SettingBlocAssignRoom(
communityUuid: communityUuid,
spaceUuid: spaceUuid,
subSpaceUuid: selectedModel.id ?? '',
),
);
}
},
builder: (ctx) => BlocProvider.value(
value: BlocProvider.of<SettingDeviceBloc>(context),
child: SubSpaceDialog(
subSpaces: subSpaces,
selected: selected,
),
),
);
}

View File

@ -1,6 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/bloc/setting_bloc_bloc.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/sub_space_dialog.dart';
import 'package:syncrow_web/utils/color_manager.dart';
@ -62,11 +60,12 @@ class SubSpaceDialogButtons extends StatelessWidget {
? null
: () {
final selectedModel = widget.subSpaces.firstWhere(
(space) => space.id == _selectedId,
orElse: () =>
SubSpaceModel(id: null, name: '', devices: []));
widget.onConfirmed(selectedModel);
Navigator.of(context).pop();
(space) => space.id == _selectedId,
orElse: () =>
SubSpaceModel(id: null, name: '', devices: []),
);
Navigator.of(context)
.pop(selectedModel);
},
child: Text(
'Confirm',
@ -84,31 +83,3 @@ class SubSpaceDialogButtons extends StatelessWidget {
);
}
}
void showSubSpaceDialog(
BuildContext context, {
required List<SubSpaceModel> subSpaces,
String? selected,
required String communityUuid,
required String spaceUuid,
}) {
showDialog(
context: context,
barrierDismissible: true,
builder: (ctx) => SubSpaceDialog(
subSpaces: subSpaces,
selected: selected,
onConfirmed: (selectedModel) {
if (selectedModel != null) {
context.read<SettingDeviceBloc>().add(
SettingBlocAssignRoom(
communityUuid: communityUuid,
spaceUuid: spaceUuid,
subSpaceUuid: selectedModel.id ?? '',
),
);
}
},
),
);
}

View File

@ -40,7 +40,7 @@ class HomeCard extends StatelessWidget {
child: Text(
name,
style: const TextStyle(
fontSize: 30,
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold,
),

View File

@ -97,7 +97,7 @@ class _HomeWebPageState extends State<HomeWebPage> {
itemCount: homeBloc.homeItems.length,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, // Adjust as needed.
crossAxisCount: 3, // Adjust as needed.
crossAxisSpacing: 20.0,
mainAxisSpacing: 20.0,
childAspectRatio: 1.5,

View File

@ -118,7 +118,6 @@ class DeviceDialogHelper {
uniqueCustomId: data['uniqueCustomId'],
deviceSelectedFunctions: deviceSelectedFunctions,
device: data['device'],
dialogType: dialogType,
);
case 'NCPS':
return FlushPresenceSensor.showFlushFunctionsDialog(

View File

@ -65,9 +65,7 @@ class ACHelper {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(dialogType == 'THEN'
? 'AC Functions'
: 'AC Conditions'),
const DialogHeader('AC Functions'),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,

View File

@ -96,9 +96,7 @@ class _WallPresenceSensorState extends State<FlushPresenceSensor> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(widget.dialogType == 'THEN'
? 'Presence Sensor Functions'
: 'Presence Sensor Condition'),
const DialogHeader('Presence Sensor Condition'),
Expanded(child: _buildMainContent(context, state)),
_buildDialogFooter(context, state),
],

View File

@ -16,10 +16,9 @@ class GatewayDialog extends StatefulWidget {
required this.functions,
required this.deviceSelectedFunctions,
required this.device,
required this.dialogType,
super.key,
});
final String dialogType;
final String? uniqueCustomId;
final List<DeviceFunction> functions;
final List<DeviceFunctionData> deviceSelectedFunctions;
@ -56,9 +55,7 @@ class _GatewayDialogState extends State<GatewayDialog> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(widget.dialogType == 'THEN'
? 'Gateway Functions'
: 'Gateway Conditions'),
const DialogHeader('Gateway Conditions'),
Expanded(child: _buildMainContent(context, state)),
_buildDialogFooter(context, state),
],

View File

@ -14,7 +14,6 @@ abstract final class GatewayHelper {
required String? uniqueCustomId,
required List<DeviceFunctionData> deviceSelectedFunctions,
required AllDevicesModel? device,
required String dialogType,
}) async {
return showDialog(
context: context,
@ -28,7 +27,6 @@ abstract final class GatewayHelper {
functions: functions,
deviceSelectedFunctions: deviceSelectedFunctions,
device: device,
dialogType:dialogType,
),
),
);

View File

@ -59,9 +59,7 @@ class OneGangSwitchHelper {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(dialogType == 'THEN'
? '1 Gang Light Switch Functions'
: '1 Gang Light Switch Condition'),
const DialogHeader('1 Gang Light Switch Condition'),
Expanded(
child: Row(
children: [
@ -248,9 +246,9 @@ class OneGangSwitchHelper {
withSpecialChar: false,
currentCondition: selectedFunctionData?.condition,
dialogType: dialogType,
sliderRange: (0, 43200),
sliderRange: (0, 43200),
displayedValue: (initialValue ?? 0).toString(),
initialValue: (initialValue ?? 0).toString(),
initialValue: (initialValue ?? 0).toString(),
onConditionChanged: (condition) {
context.read<FunctionBloc>().add(
AddFunction(

View File

@ -98,9 +98,7 @@ class _EnergyClampDialogState extends State<EnergyClampDialog> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(widget.dialogType == 'THEN'
? 'Energy Clamp Functions'
: 'Energy Clamp Conditions'),
const DialogHeader('Energy Clamp Conditions'),
Expanded(
child: Visibility(
visible: _functions.isNotEmpty,

View File

@ -58,9 +58,7 @@ class ThreeGangSwitchHelper {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(dialogType == 'THEN'
? '3 Gangs Light Switch Functions'
: '3 Gangs Light Switch Condition'),
const DialogHeader('3 Gangs Light Switch Condition'),
Expanded(
child: Row(
children: [

View File

@ -59,9 +59,7 @@ class TwoGangSwitchHelper {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(dialogType == 'THEN'
? '2 Gangs Light Switch Functions'
: '2 Gangs Light Switch Condition'),
const DialogHeader('2 Gangs Light Switch Condition'),
Expanded(
child: Row(
children: [

View File

@ -63,8 +63,7 @@ class _WallPresenceSensorState extends State<WallPresenceSensor> {
@override
void initState() {
super.initState();
_wpsFunctions =
widget.functions.whereType<WpsFunctions>().where((function) {
_wpsFunctions = widget.functions.whereType<WpsFunctions>().where((function) {
if (widget.dialogType == 'THEN') {
return function.type == 'THEN' || function.type == 'BOTH';
}
@ -98,9 +97,7 @@ class _WallPresenceSensorState extends State<WallPresenceSensor> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(widget.dialogType == 'THEN'
? 'Presence Sensor Functions'
: 'Presence Sensor Condition'),
const DialogHeader('Presence Sensor Condition'),
Expanded(child: _buildMainContent(context, state)),
_buildDialogFooter(context, state),
],

View File

@ -93,9 +93,7 @@ class _WaterHeaterDialogRoutinesState extends State<WaterHeaterDialogRoutines> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DialogHeader(widget.dialogType == 'THEN'
? 'Water Heater Funtions'
: 'Water Heater Condition'),
const DialogHeader('Water Heater Condition'),
Expanded(child: _buildMainContent(context, state)),
_buildDialogFooter(context, state),
],