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

6
.vscode/launch.json vendored
View File

@ -11,6 +11,12 @@
"type": "dart", "type": "dart",
"deviceId": "0147FC23-3D6C-406A-BE2C-9E67BAF3DA9B" "deviceId": "0147FC23-3D6C-406A-BE2C-9E67BAF3DA9B"
}, },
{
"name": "Iphone 15 Pro",
"request": "launch",
"type": "dart",
"deviceId": "9C9E6EEF-0E9C-4FA9-B201-CBA8AFB0D1D8"
},
{ {
"name": "Iphone SE", "name": "Iphone SE",
"request": "launch", "request": "launch",

View File

@ -1,5 +1,6 @@
#Wed Apr 03 23:37:40 EET 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip zipStoreBase=GRADLE_USER_HOME

View File

@ -35,31 +35,27 @@ class AppLayout extends StatelessWidget {
statusBarIconBrightness: Brightness.light, statusBarIconBrightness: Brightness.light,
), ),
child: SafeArea( child: SafeArea(
child: BlocBuilder<HomeCubit, HomeState>( child: Scaffold(
builder: (context, state) { backgroundColor: ColorsManager.backgroundColor,
return Scaffold( extendBodyBehindAppBar: true,
backgroundColor: ColorsManager.backgroundColor, extendBody: true,
extendBodyBehindAppBar: true, appBar: HomeCubit.getInstance().spaces != null
extendBody: true, ? const DefaultAppBar()
appBar: HomeCubit.getInstance().spaces != null : null,
? const DefaultAppBar() body: const AppBody(),
: null, bottomNavigationBar: const DefaultNavBar(),
body: const AppBody(), // floatingActionButton: FloatingActionButton(
bottomNavigationBar: const DefaultNavBar(), // onPressed: () {
// floatingActionButton: FloatingActionButton( // Navigator.push(
// onPressed: () { // context,
// Navigator.push( // CustomPageRoute(
// context, // builder: (context) =>
// CustomPageRoute( // const ThreeGangSwitchesView(),
// builder: (context) => // ),
// const ThreeGangSwitchesView(), // );
// ), // },
// ); // child: const Icon(Icons.arrow_forward_ios_sharp),
// }, // ),
// child: const Icon(Icons.arrow_forward_ios_sharp),
// ),
);
},
), ),
), ),
); );

View File

@ -24,6 +24,7 @@ part 'devices_state.dart';
class DevicesCubit extends Cubit<DevicesState> { class DevicesCubit extends Cubit<DevicesState> {
DevicesCubit._() : super(DevicesInitial()) { DevicesCubit._() : super(DevicesInitial()) {
print('device cubit created');
if (HomeCubit.getInstance().selectedSpace != null) { if (HomeCubit.getInstance().selectedSpace != null) {
fetchGroups(HomeCubit.getInstance().selectedSpace!.id!); fetchGroups(HomeCubit.getInstance().selectedSpace!.id!);
for (var room in HomeCubit.getInstance().selectedSpace!.rooms!) { for (var room in HomeCubit.getInstance().selectedSpace!.rooms!) {
@ -35,9 +36,9 @@ class DevicesCubit extends Cubit<DevicesState> {
static DevicesCubit? _instance; static DevicesCubit? _instance;
static DevicesCubit getInstance() { static DevicesCubit getInstance() {
// If an instance already exists, return it print('device cubit instance found : ${_instance != null}');
_instance ??= DevicesCubit._(); print('selected space : ${HomeCubit.getInstance().selectedSpace != null}');
return _instance!; return _instance ??= DevicesCubit._();
} }
DeviceModel? selectedDevice; DeviceModel? selectedDevice;