diff --git a/assets/icons/gateway_icon.svg b/assets/icons/gateway_icon.svg
new file mode 100644
index 0000000..d64135c
--- /dev/null
+++ b/assets/icons/gateway_icon.svg
@@ -0,0 +1,40 @@
+
diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart
index 48021cc..e0f5ce9 100644
--- a/lib/features/app_layout/bloc/home_cubit.dart
+++ b/lib/features/app_layout/bloc/home_cubit.dart
@@ -1,5 +1,4 @@
import 'dart:io';
-
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
@@ -275,7 +274,7 @@ class HomeCubit extends Cubit {
size: 25,
),
style: ButtonStyle(
- foregroundColor: MaterialStateProperty.all(ColorsManager.textPrimaryColor),
+ foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {
Navigator.push(
@@ -300,7 +299,7 @@ class HomeCubit extends Cubit {
size: 25,
),
style: ButtonStyle(
- foregroundColor: MaterialStateProperty.all(ColorsManager.textPrimaryColor),
+ foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
@@ -310,7 +309,7 @@ class HomeCubit extends Cubit {
size: 25,
),
style: ButtonStyle(
- foregroundColor: MaterialStateProperty.all(ColorsManager.textPrimaryColor),
+ foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
diff --git a/lib/features/auth/view/widgets/login_form.dart b/lib/features/auth/view/widgets/login_form.dart
index 5432a4d..6493800 100644
--- a/lib/features/auth/view/widgets/login_form.dart
+++ b/lib/features/auth/view/widgets/login_form.dart
@@ -85,10 +85,10 @@ class LoginForm extends StatelessWidget {
isDone: state is AuthLoginSuccess,
isLoading: state is AuthLoading,
customButtonStyle: ButtonStyle(
- backgroundColor: MaterialStateProperty.all(
+ backgroundColor: WidgetStateProperty.all(
Colors.black.withOpacity(.25),
),
- foregroundColor: MaterialStateProperty.all(
+ foregroundColor: WidgetStateProperty.all(
Colors.white,
),
),
diff --git a/lib/features/devices/bloc/devices_cubit.dart b/lib/features/devices/bloc/devices_cubit.dart
index 48341df..0f95620 100644
--- a/lib/features/devices/bloc/devices_cubit.dart
+++ b/lib/features/devices/bloc/devices_cubit.dart
@@ -87,8 +87,8 @@ class DevicesCubit extends Cubit {
return const CurtainListView();
// case DeviceType.ThreeGang:
// return const ThreeGangSwitchesView();
- case DeviceType.Gateway:
- return const GateWayView();
+ // case DeviceType.Gateway:
+ // return const GateWayView();
default:
return null;
}
diff --git a/lib/features/devices/bloc/gateway_bloc/gateway_bloc.dart b/lib/features/devices/bloc/gateway_bloc/gateway_bloc.dart
new file mode 100644
index 0000000..7154485
--- /dev/null
+++ b/lib/features/devices/bloc/gateway_bloc/gateway_bloc.dart
@@ -0,0 +1,23 @@
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_event.dart';
+import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_state.dart';
+import 'package:syncrow_app/features/devices/model/device_model.dart';
+import 'package:syncrow_app/services/api/devices_api.dart';
+
+class GatewayBloc extends Bloc {
+ GatewayBloc() : super(GatewayInitialState()) {
+ on(_fetchDevices);
+ }
+
+ void _fetchDevices(GatewayInitial event, Emitter emit) async {
+ emit(GatewayLoadingState());
+ try {
+ List devicesList = await DevicesAPI.getDevicesByGatewayId(event.gatewayId);
+
+ emit(UpdateGatewayState(list: devicesList));
+ } catch (e) {
+ emit(ErrorState(message: e.toString()));
+ return;
+ }
+ }
+}
diff --git a/lib/features/devices/bloc/gateway_bloc/gateway_event.dart b/lib/features/devices/bloc/gateway_bloc/gateway_event.dart
new file mode 100644
index 0000000..cdcf715
--- /dev/null
+++ b/lib/features/devices/bloc/gateway_bloc/gateway_event.dart
@@ -0,0 +1,20 @@
+import 'package:equatable/equatable.dart';
+
+abstract class GatewayEvent extends Equatable {
+ const GatewayEvent();
+
+ @override
+ List