mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
AC devices page implemented
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)
This commit is contained in:
83
lib/features/shared_widgets/devices_default_switch.dart
Normal file
83
lib/features/shared_widgets/devices_default_switch.dart
Normal file
@ -0,0 +1,83 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user