mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00

- Update device status handling from 'status' to 'isOnline' for consistency - Remove unused imports and redundant code related to light switches - Refactor UI components to use 'isOnline' instead of 'status' for device status
84 lines
3.1 KiB
Dart
84 lines
3.1 KiB
Dart
import 'dart:ffi';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
|
import 'package:syncrow_app/features/app_layout/view/widgets/app_body.dart';
|
|
import 'package:syncrow_app/features/app_layout/view/widgets/default_app_bar.dart';
|
|
import 'package:syncrow_app/features/app_layout/view/widgets/default_nav_bar.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_switches.dart';
|
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class AppLayout extends StatelessWidget {
|
|
const AppLayout({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider(
|
|
create: (context) => HomeCubit(),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => DevicesCubit(),
|
|
),
|
|
],
|
|
child: BlocListener<HomeCubit, HomeState>(
|
|
listener: (context, state) {
|
|
if (state is GetSpacesError) {
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
content: Text(state.errMessage),
|
|
),
|
|
);
|
|
Navigator.of(context)
|
|
.popUntil((route) => route.settings.name == Routes.authLogin);
|
|
}
|
|
},
|
|
child: BlocBuilder<HomeCubit, HomeState>(
|
|
builder: (context, state) {
|
|
return AnnotatedRegion(
|
|
value: SystemUiOverlayStyle(
|
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
|
statusBarIconBrightness: Brightness.light,
|
|
),
|
|
child: SafeArea(
|
|
child: BlocBuilder<HomeCubit, HomeState>(
|
|
builder: (context, state) {
|
|
return const Scaffold(
|
|
backgroundColor: ColorsManager.backgroundColor,
|
|
extendBodyBehindAppBar: true,
|
|
extendBody: true,
|
|
appBar: DefaultAppBar(),
|
|
body: AppBody(),
|
|
bottomNavigationBar: DefaultNavBar(),
|
|
// floatingActionButton: FloatingActionButton(
|
|
// onPressed: () {
|
|
// Navigator.push(
|
|
// context,
|
|
// CustomPageRoute(
|
|
// builder: (context) =>
|
|
// const ThreeGangSwitchesView(),
|
|
// ),
|
|
// );
|
|
// },
|
|
// child: const Icon(Icons.arrow_forward_ios_sharp),
|
|
// ),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|