updated add to room, and verify to space

This commit is contained in:
hannathkadher
2024-11-05 12:27:27 +04:00
parent 34536e6584
commit 52f6be3db0
8 changed files with 121 additions and 26 deletions
@@ -44,7 +44,8 @@ class JoinHomeView extends StatelessWidget {
controller: textEditingController,
decoration: InputDecoration(
hintText: 'Invitatoin code',
hintStyle: context.bodyMedium.copyWith(color: Colors.grey),
hintStyle:
context.bodyMedium.copyWith(color: Colors.grey),
border: InputBorder.none,
),
),
@@ -52,10 +53,12 @@ class JoinHomeView extends StatelessWidget {
IconButton(
onPressed: () async {
if (textEditingController.text.isEmpty) {
CustomSnackBar.displaySnackBar('Please enter the invitation code');
CustomSnackBar.displaySnackBar(
'Please enter the invitation code');
return;
}
if (await HomeCubit.getInstance().joinAUnit(textEditingController.text)) {
if (await HomeCubit.getInstance()
.joinAUnit(textEditingController.text)) {
CustomSnackBar.displaySnackBar('Done successfully');
Navigator.of(context).pop();
} else {
@@ -77,10 +77,25 @@ class AssignDeviceView extends StatelessWidget {
),
GestureDetector(
onTap: () {
if (state.roomDevicesId[state
.allDevices[index]
.uuid!] ??
false == false) {
bool isAssigned =
state.roomDevicesId[state
.allDevices[index]
.uuid!] ??
false;
if (isAssigned) {
BlocProvider.of<
ManageUnitBloc>(
context)
.add(UnassignRoomEvent(
deviceId: state
.allDevices[
index]
.uuid ??
'',
unit: unit,
roomId: roomId));
} else {
// Tick (assign) the device
BlocProvider.of<
ManageUnitBloc>(
context)