bugs fixes

This commit is contained in:
mohammad
2024-10-03 12:46:56 +03:00
parent cc7af3e4e6
commit d9761168e6
11 changed files with 181 additions and 140 deletions

View File

@ -67,4 +67,7 @@ Map<DeviceType, String> deviceTypeIconMap = {
DeviceType.WH: Assets.waterHeaterIcon,
DeviceType.DS: Assets.doorSensorIcon,
DeviceType.Other: Assets.assetsIconsAC,
DeviceType.OneTouch: Assets.oneGang,
DeviceType.TowTouch: Assets.twoGang,
DeviceType.ThreeTouch: Assets.assetsIconsGang,
};

View File

@ -66,6 +66,12 @@ class DeviceModel {
tempIcon = Assets.waterHeaterIcon;
} else if (type == DeviceType.DS) {
tempIcon = Assets.doorSensorIcon;
} else if (type == DeviceType.OneTouch) {
tempIcon = Assets.oneGang;
} else if (type == DeviceType.TowTouch) {
tempIcon = Assets.twoGang;
} else if (type == DeviceType.ThreeTouch) {
tempIcon = Assets.assetsIcons3GangSwitch;
} else {
tempIcon = Assets.assetsIconsLogo;
}

View File

@ -19,9 +19,11 @@ class OneGangWizard extends StatelessWidget {
List<GroupOneGangModel> groupOneGangModel = [];
return DefaultScaffold(
title: 'Lights',
child: BlocProvider(
create: (context) =>
OneGangBloc(switchCode: '', oneGangId: device?.uuid ?? '')..add(InitialWizardEvent()),
OneGangBloc(switchCode: '', oneGangId: device?.uuid ?? '')
..add(InitialWizardEvent()),
child: BlocBuilder<OneGangBloc, OneGangState>(
builder: (context, state) {
bool allSwitchesOn = false;
@ -32,8 +34,10 @@ class OneGangWizard extends StatelessWidget {
}
return state is LoadingInitialState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: OneGangList(
oneGangList: groupOneGangModel,

View File

@ -20,6 +20,7 @@ class OneTouchWizard extends StatelessWidget {
List<GroupOneTouchModel> groupOneTouchModel = [];
return DefaultScaffold(
title: 'Lights',
child: BlocProvider(
create: (context) =>
OneTouchBloc(switchCode: '', oneTouchId: device?.uuid ?? '')

View File

@ -17,8 +17,10 @@ class ThreeGangWizard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: 'Lights',
child: BlocProvider(
create: (context) => ThreeGangBloc(switchCode: '', threeGangId: device?.uuid ?? '')
create: (context) =>
ThreeGangBloc(switchCode: '', threeGangId: device?.uuid ?? '')
..add(InitialEvent(groupScreen: device != null ? false : true)),
child: BlocBuilder<ThreeGangBloc, ThreeGangState>(
builder: (context, state) {
@ -31,8 +33,10 @@ class ThreeGangWizard extends StatelessWidget {
}
return state is LoadingInitialState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: ThreeGangList(
threeGangList: groupThreeGangModel,

View File

@ -17,8 +17,10 @@ class ThreeTouchWizard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: 'Lights',
child: BlocProvider(
create: (context) => ThreeTouchBloc(switchCode: '', threeTouchId: device?.uuid ?? '')
create: (context) =>
ThreeTouchBloc(switchCode: '', threeTouchId: device?.uuid ?? '')
..add(InitialEvent(groupScreen: device != null ? false : true)),
child: BlocBuilder<ThreeTouchBloc, ThreeTouchState>(
builder: (context, state) {
@ -31,10 +33,13 @@ class ThreeTouchWizard extends StatelessWidget {
}
return state is LoadingInitialState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: ThreeTouchList(
:
ThreeTouchList(
threeTouchList: groupThreeTouchModel,
allSwitches: allSwitchesOn,
);

View File

@ -19,9 +19,11 @@ class TwoGangWizard extends StatelessWidget {
List<GroupTwoGangModel> groupTwoGangModel = [];
return DefaultScaffold(
title: 'Lights',
child: BlocProvider(
create: (context) =>
TwoGangBloc(switchCode: '', twoGangId: device?.uuid ?? '')..add(InitialWizardEvent()),
TwoGangBloc(switchCode: '', twoGangId: device?.uuid ?? '')
..add(InitialWizardEvent()),
child: BlocBuilder<TwoGangBloc, TwoGangState>(
builder: (context, state) {
bool allSwitchesOn = false;
@ -32,8 +34,10 @@ class TwoGangWizard extends StatelessWidget {
}
return state is LoadingInitialState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: TwoGangList(
twoGangList: groupTwoGangModel,

View File

@ -20,9 +20,11 @@ class TwoTouchWizard extends StatelessWidget {
List<GroupTwoTouchModel> groupTwoTouchModel = [];
return DefaultScaffold(
title: 'Lights',
child: BlocProvider(
create: (context) =>
TwoTouchBloc(switchCode: '', twoTouchId: device?.uuid ?? '')..add(InitialWizardEvent()),
TwoTouchBloc(switchCode: '', twoTouchId: device?.uuid ?? '')
..add(InitialWizardEvent()),
child: BlocBuilder<TwoTouchBloc, TwoTouchState>(
builder: (context, state) {
bool allSwitchesOn = false;
@ -33,8 +35,10 @@ class TwoTouchWizard extends StatelessWidget {
}
return state is LoadingInitialState
? const Center(
child:
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
)
: TwoTouchList(
twoTouchList: groupTwoTouchModel,

View File

@ -4,7 +4,10 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class DevicesDefaultSwitch extends StatelessWidget {
const DevicesDefaultSwitch(
{super.key, required this.switchValue, required this.action, this.secondAction});
{super.key,
required this.switchValue,
required this.action,
this.secondAction});
final bool switchValue;
final Function action;
@ -22,7 +25,9 @@ class DevicesDefaultSwitch extends StatelessWidget {
child: Container(
height: 60,
decoration: BoxDecoration(
color: switchValue ? ColorsManager.primaryColor : Colors.white,
color: switchValue
? ColorsManager.switchButton.withOpacity(0.6)
: Colors.white,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15),
bottomLeft: Radius.circular(15),
@ -30,9 +35,10 @@ class DevicesDefaultSwitch extends StatelessWidget {
),
child: Center(
child: BodyMedium(
fontSize: 14,
text: "ON",
fontColor: switchValue ? Colors.white : null,
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w700,
),
),
),
@ -50,7 +56,9 @@ class DevicesDefaultSwitch extends StatelessWidget {
child: Container(
height: 60,
decoration: BoxDecoration(
color: switchValue ? Colors.white : ColorsManager.primaryColor,
color: switchValue
? Colors.white
: ColorsManager.switchButton.withOpacity(0.6),
borderRadius: const BorderRadius.only(
topRight: Radius.circular(15),
bottomRight: Radius.circular(15),
@ -58,9 +66,10 @@ class DevicesDefaultSwitch extends StatelessWidget {
),
child: Center(
child: BodyMedium(
fontSize: 14,
text: "OFF",
fontColor: switchValue ? null : Colors.white,
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w700,
),
),
),

View File

@ -5,7 +5,8 @@ abstract class ColorsManager {
static const Color switchOffColor = Color(0x7F8D99AE);
static const Color primaryColor = Color(0xFF0030CB);
static const Color secondaryTextColor = Color(0xFF848484);
static Color primaryColorWithOpacity = const Color(0xFF023DFE).withOpacity(0.6);
static Color primaryColorWithOpacity =
const Color(0xFF023DFE).withOpacity(0.6);
static const Color onPrimaryColor = Colors.white;
static const Color secondaryColor = Color(0xFF023DFE);
static const Color onSecondaryColor = Color(0xFF023DFE);
@ -27,5 +28,5 @@ abstract class ColorsManager {
static const Color red = Colors.red;
static const Color graysColor = Color(0xffEBEBEB);
static const Color textGray = Color(0xffD5D5D5);
static const Color switchButton = Color(0xff023DFE);
}