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.WH: Assets.waterHeaterIcon,
DeviceType.DS: Assets.doorSensorIcon, DeviceType.DS: Assets.doorSensorIcon,
DeviceType.Other: Assets.assetsIconsAC, 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; tempIcon = Assets.waterHeaterIcon;
} else if (type == DeviceType.DS) { } else if (type == DeviceType.DS) {
tempIcon = Assets.doorSensorIcon; 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 { } else {
tempIcon = Assets.assetsIconsLogo; tempIcon = Assets.assetsIconsLogo;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,10 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class DevicesDefaultSwitch extends StatelessWidget { class DevicesDefaultSwitch extends StatelessWidget {
const DevicesDefaultSwitch( 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 bool switchValue;
final Function action; final Function action;
@ -22,7 +25,9 @@ class DevicesDefaultSwitch extends StatelessWidget {
child: Container( child: Container(
height: 60, height: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
color: switchValue ? ColorsManager.primaryColor : Colors.white, color: switchValue
? ColorsManager.switchButton.withOpacity(0.6)
: Colors.white,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15), topLeft: Radius.circular(15),
bottomLeft: Radius.circular(15), bottomLeft: Radius.circular(15),
@ -30,9 +35,10 @@ class DevicesDefaultSwitch extends StatelessWidget {
), ),
child: Center( child: Center(
child: BodyMedium( child: BodyMedium(
fontSize: 14,
text: "ON", text: "ON",
fontColor: switchValue ? Colors.white : null, fontColor: switchValue ? Colors.white : null,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w700,
), ),
), ),
), ),
@ -50,7 +56,9 @@ class DevicesDefaultSwitch extends StatelessWidget {
child: Container( child: Container(
height: 60, height: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
color: switchValue ? Colors.white : ColorsManager.primaryColor, color: switchValue
? Colors.white
: ColorsManager.switchButton.withOpacity(0.6),
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topRight: Radius.circular(15), topRight: Radius.circular(15),
bottomRight: Radius.circular(15), bottomRight: Radius.circular(15),
@ -58,9 +66,10 @@ class DevicesDefaultSwitch extends StatelessWidget {
), ),
child: Center( child: Center(
child: BodyMedium( child: BodyMedium(
fontSize: 14,
text: "OFF", text: "OFF",
fontColor: switchValue ? null : Colors.white, 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 switchOffColor = Color(0x7F8D99AE);
static const Color primaryColor = Color(0xFF0030CB); static const Color primaryColor = Color(0xFF0030CB);
static const Color secondaryTextColor = Color(0xFF848484); 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 onPrimaryColor = Colors.white;
static const Color secondaryColor = Color(0xFF023DFE); static const Color secondaryColor = Color(0xFF023DFE);
static const Color onSecondaryColor = Color(0xFF023DFE); static const Color onSecondaryColor = Color(0xFF023DFE);
@ -27,5 +28,5 @@ abstract class ColorsManager {
static const Color red = Colors.red; static const Color red = Colors.red;
static const Color graysColor = Color(0xffEBEBEB); static const Color graysColor = Color(0xffEBEBEB);
static const Color textGray = Color(0xffD5D5D5); static const Color textGray = Color(0xffD5D5D5);
static const Color switchButton = Color(0xff023DFE);
} }