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

- Refactor device control logic in the app to improve readability and maintainability. - Add temperature modes (hot, cold, wind) and fan speeds (auto, low, middle, high) enums. - Update icon mappings and utility functions for temperature modes and fan speeds.
68 lines
2.4 KiB
Dart
68 lines
2.4 KiB
Dart
import 'package:flutter/material.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/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class LightBrightness extends StatelessWidget {
|
|
const LightBrightness({
|
|
super.key,
|
|
required this.light,
|
|
});
|
|
|
|
final DeviceModel light;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return GestureDetector(
|
|
// onHorizontalDragUpdate: (details) => DevicesCubit.getInstance().get(context)
|
|
// .onHorizontalDragUpdate(light, details.localPosition.dx,
|
|
// MediaQuery.of(context).size.width - 15),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
const DefaultContainer(
|
|
height: 60,
|
|
child: SizedBox.expand(),
|
|
),
|
|
AnimatedPositioned(
|
|
left: 0,
|
|
duration: const Duration(milliseconds: 0),
|
|
child: Container(
|
|
height: 60,
|
|
// width: (MediaQuery.of(context).size.width - 30) *
|
|
// light.brightness /
|
|
// 100,
|
|
decoration: BoxDecoration(
|
|
color: ColorsManager.primaryColor.withOpacity(0.6),
|
|
borderRadius:
|
|
// light.brightness != 100 ?
|
|
const BorderRadius.only(
|
|
topLeft: Radius.circular(20),
|
|
bottomLeft: Radius.circular(20),
|
|
)
|
|
// : BorderRadius.circular(20),
|
|
),
|
|
),
|
|
),
|
|
BodyLarge(
|
|
// text: "${light.brightness}%",
|
|
text: '100%',
|
|
style: context.bodyLarge.copyWith(
|
|
color: Colors.black,
|
|
fontSize: 23,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|