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

Simplify UI structure in curtain_view.dart and light_interface.dart by rearranging the widget tree for better readability and maintainability.
59 lines
2.2 KiB
Dart
59 lines
2.2 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/lights/light_interface_contols.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/lights/light_interface_switch.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/lights/light_interface_timer.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
|
|
|
class LightInterface extends StatelessWidget {
|
|
const LightInterface({super.key, required this.light});
|
|
|
|
final DeviceModel light;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return AnnotatedRegion(
|
|
value: SystemUiOverlayStyle(
|
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
|
statusBarIconBrightness: Brightness.light,
|
|
),
|
|
child: Scaffold(
|
|
backgroundColor: ColorsManager.backgroundColor,
|
|
extendBodyBehindAppBar: true,
|
|
extendBody: true,
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.transparent,
|
|
centerTitle: true,
|
|
title: BodyLarge(
|
|
text: light.name ?? "",
|
|
fontColor: ColorsManager.primaryColor,
|
|
fontWeight: FontsManager.bold,
|
|
),
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.only(top: 70, right: 20, left: 20),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
LightInterfaceSwitch(light: light),
|
|
LightInterfaceContols(light: light),
|
|
const LightInterfaceTimer(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|