This commit is contained in:
Mohammad Salameh
2024-04-04 00:01:02 +03:00
parent 8d02eb2f40
commit 37d2c1b53f
4 changed files with 34 additions and 30 deletions
+21 -25
View File
@@ -35,31 +35,27 @@ class AppLayout extends StatelessWidget {
statusBarIconBrightness: Brightness.light,
),
child: SafeArea(
child: BlocBuilder<HomeCubit, HomeState>(
builder: (context, state) {
return Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: HomeCubit.getInstance().spaces != null
? const DefaultAppBar()
: null,
body: const AppBody(),
bottomNavigationBar: const DefaultNavBar(),
// floatingActionButton: FloatingActionButton(
// onPressed: () {
// Navigator.push(
// context,
// CustomPageRoute(
// builder: (context) =>
// const ThreeGangSwitchesView(),
// ),
// );
// },
// child: const Icon(Icons.arrow_forward_ios_sharp),
// ),
);
},
child: Scaffold(
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: HomeCubit.getInstance().spaces != null
? const DefaultAppBar()
: null,
body: const AppBody(),
bottomNavigationBar: const DefaultNavBar(),
// floatingActionButton: FloatingActionButton(
// onPressed: () {
// Navigator.push(
// context,
// CustomPageRoute(
// builder: (context) =>
// const ThreeGangSwitchesView(),
// ),
// );
// },
// child: const Icon(Icons.arrow_forward_ios_sharp),
// ),
),
),
);
+4 -3
View File
@@ -24,6 +24,7 @@ part 'devices_state.dart';
class DevicesCubit extends Cubit<DevicesState> {
DevicesCubit._() : super(DevicesInitial()) {
print('device cubit created');
if (HomeCubit.getInstance().selectedSpace != null) {
fetchGroups(HomeCubit.getInstance().selectedSpace!.id!);
for (var room in HomeCubit.getInstance().selectedSpace!.rooms!) {
@@ -35,9 +36,9 @@ class DevicesCubit extends Cubit<DevicesState> {
static DevicesCubit? _instance;
static DevicesCubit getInstance() {
// If an instance already exists, return it
_instance ??= DevicesCubit._();
return _instance!;
print('device cubit instance found : ${_instance != null}');
print('selected space : ${HomeCubit.getInstance().selectedSpace != null}');
return _instance ??= DevicesCubit._();
}
DeviceModel? selectedDevice;