mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00

- Fixed Scrolling wasent working in login screen - Changed Home page to indexed based view instead of PageView
72 lines
2.9 KiB
Dart
72 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/category_view_app_bar.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/lights/light_interface.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/lights/lights_view_list.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class LightsView extends StatelessWidget {
|
|
const LightsView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (context) => DevicesCubit(),
|
|
child: BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
DeviceModel? selectedLight;
|
|
if (DevicesCubit.get(context).getSelectedDevice()
|
|
is DeviceModel) {
|
|
selectedLight = DevicesCubit.get(context).getSelectedDevice()
|
|
as DeviceModel;
|
|
}
|
|
List<DeviceModel> lights = [];
|
|
if (DevicesCubit.allCategories![1].devices != null) {
|
|
for (var device in DevicesCubit.allCategories![1].devices!) {
|
|
lights.add(device);
|
|
}
|
|
}
|
|
return AnnotatedRegion(
|
|
value: SystemUiOverlayStyle(
|
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
|
statusBarIconBrightness: Brightness.light,
|
|
),
|
|
child: SafeArea(
|
|
child: Scaffold(
|
|
backgroundColor: ColorsManager.backgroundColor,
|
|
extendBodyBehindAppBar: true,
|
|
extendBody: true,
|
|
appBar: const CategoryViewAppBar(),
|
|
body: Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
height: MediaQuery.sizeOf(context).height,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
Assets.imagesBackground,
|
|
),
|
|
fit: BoxFit.cover,
|
|
opacity: 0.4,
|
|
),
|
|
),
|
|
child: selectedLight != null
|
|
? LightInterface(light: selectedLight)
|
|
: LightsViewList(lights: lights),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|