mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
Switches updated
This commit is contained in:
@ -1,15 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/curtain_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/door_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/gateway/gateway_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/gateway_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/screens/screens_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/screens_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_view.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
|
|
||||||
import '../model/device_category_model.dart';
|
import '../model/device_category_model.dart';
|
||||||
import '../view/widgets/ac_view.dart';
|
import '../view/widgets/ACs/ac_view.dart';
|
||||||
import '../view/widgets/lights_view.dart';
|
import '../view/widgets/lights/lights_view.dart';
|
||||||
|
|
||||||
part 'devices_state.dart';
|
part 'devices_state.dart';
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
|
|
||||||
import '../../../../generated/assets.dart';
|
import '../../../../../generated/assets.dart';
|
||||||
|
|
||||||
class ACControlUnit extends StatefulWidget {
|
class ACControlUnit extends StatefulWidget {
|
||||||
const ACControlUnit({
|
const ACControlUnit({
|
@ -3,10 +3,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart';
|
import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/a_c_control_unit.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/a_c_control_unit.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/universal_a_c_switch.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/universal_a_c_temp.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/devices_temp_widget.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/devices_temp_widget.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/universal_a_c_switch.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/universal_a_c_temp.dart';
|
|
||||||
import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart';
|
import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../utils/resource_manager/color_manager.dart';
|
import '../../../../../utils/resource_manager/color_manager.dart';
|
||||||
import '../../../shared_widgets/text_widgets/body_medium.dart';
|
import '../../../../shared_widgets/text_widgets/body_medium.dart';
|
||||||
import '../../bloc/ac_cubit.dart';
|
import '../../../bloc/ac_cubit.dart';
|
||||||
|
|
||||||
class UniversalACSwitch extends StatelessWidget {
|
class UniversalACSwitch extends StatelessWidget {
|
||||||
const UniversalACSwitch({
|
const UniversalACSwitch({
|
@ -3,10 +3,10 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart';
|
import 'package:syncrow_app/features/devices/bloc/ac_cubit.dart';
|
||||||
import 'package:syncrow_app/utils/context_extension.dart';
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
|
|
||||||
import '../../../../generated/assets.dart';
|
import '../../../../../generated/assets.dart';
|
||||||
import '../../../../utils/resource_manager/color_manager.dart';
|
import '../../../../../utils/resource_manager/color_manager.dart';
|
||||||
import '../../../shared_widgets/default_container.dart';
|
import '../../../../shared_widgets/default_container.dart';
|
||||||
import '../../../shared_widgets/text_widgets/body_large.dart';
|
import '../../../../shared_widgets/text_widgets/body_large.dart';
|
||||||
|
|
||||||
class UniversalACTemp extends StatelessWidget {
|
class UniversalACTemp extends StatelessWidget {
|
||||||
const UniversalACTemp({
|
const UniversalACTemp({
|
@ -4,6 +4,7 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.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/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
import '../../bloc/devices_cubit.dart';
|
import '../../bloc/devices_cubit.dart';
|
||||||
|
|
||||||
@ -31,39 +32,32 @@ class Switches extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => DevicesCubit.get(context).updateCategory(index),
|
onTap: () => DevicesCubit.get(context).updateCategory(index),
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
child: Column(
|
child: Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding:
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
SvgPicture.asset(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
DevicesCubit.categories[index].icon,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
fit: BoxFit.contain,
|
children: [
|
||||||
),
|
SvgPicture.asset(
|
||||||
const SizedBox(
|
DevicesCubit.categories[index].icon,
|
||||||
width: 30,
|
fit: BoxFit.contain,
|
||||||
height: 20,
|
),
|
||||||
child: CustomSwitch(
|
CustomSwitch(),
|
||||||
// value: DevicesCubit
|
],
|
||||||
// .categories[index]
|
),
|
||||||
// .switchValue,
|
BodyLarge(
|
||||||
//
|
text: DevicesCubit.categories[index].name,
|
||||||
// onChanged: (value) => DevicesCubit.get(context)
|
fontWeight: FontsManager.bold,
|
||||||
// .changeSwitchValue( DevicesCubit
|
fontSize: 24,
|
||||||
// .categories[index]
|
fontColor: const Color(0xFF848484),
|
||||||
// .switchValue),
|
)
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
BodyLarge(
|
|
||||||
text: DevicesCubit.categories[index].name,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -18,9 +18,11 @@ class MenuView extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const ProfileTab(),
|
const ProfileTab(),
|
||||||
...MenuCubit.of(context)
|
...MenuCubit.of(context).menuLists.map(
|
||||||
.menuLists
|
(list) => MenuList(
|
||||||
.map((list) => MenuList(listModel: list))
|
listModel: list,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -22,20 +22,24 @@ class _CustomSwitchState extends State<CustomSwitch>
|
|||||||
|
|
||||||
bool value = false;
|
bool value = false;
|
||||||
|
|
||||||
void onChange(bool customValue){
|
void onChange(bool customValue) {
|
||||||
value = customValue ;
|
value = customValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_animationController = AnimationController(
|
_animationController = AnimationController(
|
||||||
vsync: this, duration: const Duration(milliseconds: 100));
|
vsync: this, duration: const Duration(milliseconds: 300));
|
||||||
_circleAnimation = AlignmentTween(
|
_circleAnimation = AlignmentTween(
|
||||||
begin: value ? Alignment.centerRight : Alignment.centerLeft,
|
begin: value ? Alignment.centerRight : Alignment.centerLeft,
|
||||||
end: value ? Alignment.centerLeft : Alignment.centerRight)
|
end: value ? Alignment.centerLeft : Alignment.centerRight,
|
||||||
.animate(CurvedAnimation(
|
).animate(
|
||||||
parent: _animationController!, curve: Curves.linear));
|
CurvedAnimation(
|
||||||
|
parent: _animationController!,
|
||||||
|
curve: Curves.linear,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -49,9 +53,7 @@ class _CustomSwitchState extends State<CustomSwitch>
|
|||||||
_animationController!.isCompleted
|
_animationController!.isCompleted
|
||||||
? _animationController!.reverse()
|
? _animationController!.reverse()
|
||||||
: _animationController!.forward();
|
: _animationController!.forward();
|
||||||
value == false
|
value ? onChange(false) : onChange(true);
|
||||||
? onChange(true)
|
|
||||||
: onChange(false);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -60,20 +62,33 @@ class _CustomSwitchState extends State<CustomSwitch>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(24.0),
|
borderRadius: BorderRadius.circular(24.0),
|
||||||
color: _circleAnimation!.value == Alignment.centerLeft
|
color: _circleAnimation!.value == Alignment.centerLeft
|
||||||
? Colors.grey
|
? Color(0xFFD9D9D9)
|
||||||
: ColorsManager.primaryColor,
|
: ColorsManager.primaryColor,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Center(
|
||||||
padding: const EdgeInsets.all(2.0),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: value
|
width: 40.0,
|
||||||
? Alignment.centerRight
|
height: 23.0,
|
||||||
: Alignment.centerLeft,
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
borderRadius: BorderRadius.circular(24.0),
|
||||||
width: 20.0,
|
color: Colors.white,
|
||||||
height: 20.0,
|
),
|
||||||
decoration: const BoxDecoration(
|
child: Padding(
|
||||||
shape: BoxShape.circle, color: Colors.white),
|
padding: const EdgeInsets.all(2.0),
|
||||||
|
child: Container(
|
||||||
|
alignment:
|
||||||
|
value ? Alignment.centerRight : Alignment.centerLeft,
|
||||||
|
child: Container(
|
||||||
|
width: 20.0,
|
||||||
|
height: 20.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: _circleAnimation!.value == Alignment.centerLeft
|
||||||
|
? Color(0xFFD9D9D9)
|
||||||
|
: ColorsManager.primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -12,6 +12,7 @@ class BodyLarge extends StatelessWidget {
|
|||||||
this.height,
|
this.height,
|
||||||
this.fontWeight,
|
this.fontWeight,
|
||||||
this.fontColor,
|
this.fontColor,
|
||||||
|
this.fontSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String text;
|
final String text;
|
||||||
@ -25,6 +26,8 @@ class BodyLarge extends StatelessWidget {
|
|||||||
|
|
||||||
final Color? fontColor;
|
final Color? fontColor;
|
||||||
|
|
||||||
|
final double? fontSize;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => CustomText(
|
Widget build(BuildContext context) => CustomText(
|
||||||
text,
|
text,
|
||||||
@ -34,6 +37,7 @@ class BodyLarge extends StatelessWidget {
|
|||||||
height: height ?? 1.5,
|
height: height ?? 1.5,
|
||||||
fontWeight: fontWeight,
|
fontWeight: fontWeight,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
|
fontSize: fontSize,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user