mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 01:35:23 +00:00

AC Cubit Add New Devices Cubit Arch will be used Devices Cubit (for devices categories, and devices page) { AC cubit, Lights cubit. ... } Replaced AssetsManager with Assets Class (auto generated)
84 lines
2.5 KiB
Dart
84 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class DevicesDefaultSwitch extends StatefulWidget {
|
|
const DevicesDefaultSwitch({
|
|
super.key,
|
|
required this.model,
|
|
});
|
|
|
|
final ACModel model;
|
|
|
|
@override
|
|
State<DevicesDefaultSwitch> createState() => _DevicesDefaultSwitchState();
|
|
}
|
|
|
|
class _DevicesDefaultSwitchState extends State<DevicesDefaultSwitch> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
// isOn = !isOn;
|
|
widget.model.status = !widget.model.status;
|
|
});
|
|
},
|
|
child: Container(
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: widget.model.status
|
|
? ColorsManager.primaryColor
|
|
: Colors.white,
|
|
borderRadius: const BorderRadius.only(
|
|
topLeft: Radius.circular(15),
|
|
bottomLeft: Radius.circular(15),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: BodyMedium(
|
|
text: "ON",
|
|
fontColor: widget.model.status ? Colors.white : null,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
widget.model.status = !widget.model.status;
|
|
});
|
|
},
|
|
child: Container(
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: widget.model.status
|
|
? Colors.white
|
|
: ColorsManager.primaryColor,
|
|
borderRadius: const BorderRadius.only(
|
|
topRight: Radius.circular(15),
|
|
bottomRight: Radius.circular(15),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: BodyMedium(
|
|
text: "OFF",
|
|
fontColor: widget.model.status ? null : Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|