mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 10:06:16 +00:00
Bug fixes
This commit is contained in:
@ -253,7 +253,7 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
emit(AuthLoginError(message: 'Something went wrong'));
|
emit(AuthLoginError(message: 'Something went wrong'));
|
||||||
}
|
}
|
||||||
} catch (failure) {
|
} catch (failure) {
|
||||||
emit(AuthLoginError(message: failure.toString()));
|
emit(AuthLoginError(message: 'Something went wrong'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
(Route route) => false,
|
(Route route) => false,
|
||||||
);
|
);
|
||||||
} catch (failure) {
|
} catch (failure) {
|
||||||
emit(AuthLogoutError(message: failure.toString()));
|
emit(AuthLogoutError(message: 'Something went wrong'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
class OtpView extends StatefulWidget {
|
class OtpView extends StatefulWidget {
|
||||||
final bool isForgetPage;
|
final bool isForgetPage;
|
||||||
const OtpView({super.key,this.isForgetPage=false});
|
const OtpView({super.key, this.isForgetPage = false});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<OtpView> createState() => _OtpViewState();
|
State<OtpView> createState() => _OtpViewState();
|
||||||
@ -121,9 +121,13 @@ class _OtpViewState extends State<OtpView> {
|
|||||||
if (state is AuthOtpSuccess) {
|
if (state is AuthOtpSuccess) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
widget.isForgetPage?
|
widget.isForgetPage
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const CreateNewPasswordPage(),)):
|
? Navigator.push(
|
||||||
Navigator.popAndPushNamed(context, Routes.homeRoute);
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const CreateNewPasswordPage(),
|
||||||
|
))
|
||||||
|
: Navigator.popAndPushNamed(context, Routes.homeRoute);
|
||||||
}
|
}
|
||||||
if (state is ResendOtpSuccess) {
|
if (state is ResendOtpSuccess) {
|
||||||
startTimer(30);
|
startTimer(30);
|
||||||
@ -194,8 +198,7 @@ class _OtpViewState extends State<OtpView> {
|
|||||||
},
|
},
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text:
|
text: 'We have sent the verification code to',
|
||||||
'We have sent the verification codeWe have sent the verification code to',
|
|
||||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(
|
style: Theme.of(context).textTheme.titleSmall!.copyWith(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontsManager.regular,
|
fontWeight: FontsManager.regular,
|
||||||
|
@ -10,6 +10,7 @@ class DeviceModel {
|
|||||||
String? model;
|
String? model;
|
||||||
String? name;
|
String? name;
|
||||||
String? icon;
|
String? icon;
|
||||||
|
String? type;
|
||||||
bool? isOnline;
|
bool? isOnline;
|
||||||
List<StatusModel> status = [];
|
List<StatusModel> status = [];
|
||||||
String? productName;
|
String? productName;
|
||||||
@ -19,21 +20,21 @@ class DeviceModel {
|
|||||||
DeviceType? productType;
|
DeviceType? productType;
|
||||||
bool isSelected = false;
|
bool isSelected = false;
|
||||||
late List<FunctionModel> functions;
|
late List<FunctionModel> functions;
|
||||||
DeviceModel({
|
DeviceModel(
|
||||||
this.activeTime,
|
{this.activeTime,
|
||||||
// this.id,
|
// this.id,
|
||||||
this.localKey,
|
this.localKey,
|
||||||
this.model,
|
this.model,
|
||||||
this.name,
|
this.name,
|
||||||
this.isOnline,
|
this.isOnline,
|
||||||
required this.status,
|
required this.status,
|
||||||
this.productName,
|
this.productName,
|
||||||
this.timeZone,
|
this.timeZone,
|
||||||
this.updateTime,
|
this.updateTime,
|
||||||
this.uuid,
|
this.uuid,
|
||||||
this.productType,
|
this.productType,
|
||||||
this.icon,
|
this.icon,
|
||||||
}) {
|
this.type}) {
|
||||||
functions = getFunctions(productType!);
|
functions = getFunctions(productType!);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +44,7 @@ class DeviceModel {
|
|||||||
|
|
||||||
if (type == DeviceType.LightBulb) {
|
if (type == DeviceType.LightBulb) {
|
||||||
tempIcon = Assets.assetsIconsLight;
|
tempIcon = Assets.assetsIconsLight;
|
||||||
} else if (type == DeviceType.CeilingSensor ||
|
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
|
||||||
type == DeviceType.WallSensor) {
|
|
||||||
tempIcon = Assets.assetsIconsSensors;
|
tempIcon = Assets.assetsIconsSensors;
|
||||||
} else if (type == DeviceType.AC) {
|
} else if (type == DeviceType.AC) {
|
||||||
tempIcon = Assets.assetsIconsAC;
|
tempIcon = Assets.assetsIconsAC;
|
||||||
@ -72,6 +72,7 @@ class DeviceModel {
|
|||||||
updateTime: json['updateTime'],
|
updateTime: json['updateTime'],
|
||||||
uuid: json['uuid'],
|
uuid: json['uuid'],
|
||||||
productType: type,
|
productType: type,
|
||||||
|
type: json['productType'],
|
||||||
status: [],
|
status: [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -92,6 +93,5 @@ class DeviceModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
List<FunctionModel> getFunctions(DeviceType type) =>
|
List<FunctionModel> getFunctions(DeviceType type) => devicesFunctionsMap[productType] ?? [];
|
||||||
devicesFunctionsMap[productType] ?? [];
|
|
||||||
}
|
}
|
||||||
|
@ -160,19 +160,19 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Flexible(
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
const Flexible(child: BodySmall(text: 'Sports Para')),
|
children: [
|
||||||
Flexible(
|
const BodySmall(text: 'Sports Para'),
|
||||||
child: BodyLarge(
|
BodyLarge(
|
||||||
text: '0',
|
text: '0',
|
||||||
style: context.bodyLarge.copyWith(
|
style: context.bodyLarge.copyWith(
|
||||||
fontWeight: FontsManager.bold,
|
fontWeight: FontsManager.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
@ -182,24 +182,23 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
color: ColorsManager.greyColor,
|
color: ColorsManager.greyColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Flexible(
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
const Flexible(
|
children: [
|
||||||
child: BodySmall(
|
const BodySmall(
|
||||||
text: 'Detection Range',
|
text: 'Detection Range',
|
||||||
textOverflow: TextOverflow.ellipsis,
|
textOverflow: TextOverflow.ellipsis,
|
||||||
)),
|
),
|
||||||
Flexible(
|
BodyLarge(
|
||||||
child: BodyLarge(
|
|
||||||
text: '0.0M',
|
text: '0.0M',
|
||||||
textOverflow: TextOverflow.ellipsis,
|
textOverflow: TextOverflow.ellipsis,
|
||||||
style: context.bodyLarge.copyWith(
|
style: context.bodyLarge.copyWith(
|
||||||
fontWeight: FontsManager.bold,
|
fontWeight: FontsManager.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
@ -209,24 +208,23 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
color: ColorsManager.greyColor,
|
color: ColorsManager.greyColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Flexible(
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
const Flexible(
|
children: [
|
||||||
child: BodySmall(
|
const BodySmall(
|
||||||
text: 'Movement',
|
text: 'Movement',
|
||||||
textOverflow: TextOverflow.ellipsis,
|
textOverflow: TextOverflow.ellipsis,
|
||||||
)),
|
),
|
||||||
Flexible(
|
BodyLarge(
|
||||||
child: BodyLarge(
|
|
||||||
text: 'none',
|
text: 'none',
|
||||||
textOverflow: TextOverflow.ellipsis,
|
textOverflow: TextOverflow.ellipsis,
|
||||||
style: context.bodyLarge.copyWith(
|
style: context.bodyLarge.copyWith(
|
||||||
fontWeight: FontsManager.bold,
|
fontWeight: FontsManager.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
@ -55,7 +55,7 @@ class RoomPageSwitch extends StatelessWidget {
|
|||||||
Flexible(
|
Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
device.name ?? "",
|
device.type ?? "",
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
style: context.bodyLarge.copyWith(
|
style: context.bodyLarge.copyWith(
|
||||||
@ -109,8 +109,7 @@ void showDeviceInterface(DeviceModel device, BuildContext context) {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
PageRouteBuilder(
|
PageRouteBuilder(
|
||||||
pageBuilder: (context, animation1, animation2) => DoorInterface(doorLock: device))
|
pageBuilder: (context, animation1, animation2) => DoorInterface(doorLock: device)));
|
||||||
);
|
|
||||||
// navigateToInterface(DoorInterface(doorlock: device), context);
|
// navigateToInterface(DoorInterface(doorlock: device), context);
|
||||||
break;
|
break;
|
||||||
case DeviceType.Gateway:
|
case DeviceType.Gateway:
|
||||||
|
@ -48,6 +48,7 @@ class TimerScreen extends StatelessWidget {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
Duration duration = Duration.zero;
|
Duration duration = Duration.zero;
|
||||||
int countNum = 0;
|
int countNum = 0;
|
||||||
|
int tabNum = 0;
|
||||||
if (state is UpdateTimerState) {
|
if (state is UpdateTimerState) {
|
||||||
countNum = state.seconds;
|
countNum = state.seconds;
|
||||||
} else if (state is TimerRunInProgress) {
|
} else if (state is TimerRunInProgress) {
|
||||||
@ -57,6 +58,10 @@ class TimerScreen extends StatelessWidget {
|
|||||||
} else if (state is LoadingNewSate) {
|
} else if (state is LoadingNewSate) {
|
||||||
countNum = 0;
|
countNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state is ChangeSlidingSegmentState) {
|
||||||
|
tabNum = state.value;
|
||||||
|
}
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvoked: (didPop) {
|
onPopInvoked: (didPop) {
|
||||||
@ -129,35 +134,38 @@ class TimerScreen extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
countNum > 0
|
if (tabNum == 0)
|
||||||
? BodyLarge(
|
countNum > 0
|
||||||
text: _formatDuration(countNum),
|
? BodyLarge(
|
||||||
fontColor: ColorsManager.slidingBlueColor,
|
text: _formatDuration(countNum),
|
||||||
fontSize: 40,
|
fontColor: ColorsManager.slidingBlueColor,
|
||||||
)
|
fontSize: 40,
|
||||||
: CupertinoTimerPicker(
|
)
|
||||||
mode: CupertinoTimerPickerMode.hm,
|
: CupertinoTimerPicker(
|
||||||
onTimerDurationChanged: (Duration newDuration) {
|
mode: CupertinoTimerPickerMode.hm,
|
||||||
duration = newDuration;
|
onTimerDurationChanged: (Duration newDuration) {
|
||||||
},
|
duration = newDuration;
|
||||||
),
|
},
|
||||||
GestureDetector(
|
),
|
||||||
onTap: () {
|
if (tabNum == 0)
|
||||||
if (state is LoadingNewSate) {
|
GestureDetector(
|
||||||
return;
|
onTap: () {
|
||||||
}
|
if (state is LoadingNewSate) {
|
||||||
if (countNum > 0) {
|
return;
|
||||||
BlocProvider.of<ThreeGangBloc>(context).add(
|
}
|
||||||
SetCounterValue(
|
if (countNum > 0) {
|
||||||
deviceCode: deviceCode, duration: Duration.zero));
|
BlocProvider.of<ThreeGangBloc>(context).add(
|
||||||
} else if (duration != Duration.zero) {
|
SetCounterValue(
|
||||||
BlocProvider.of<ThreeGangBloc>(context).add(
|
deviceCode: deviceCode,
|
||||||
SetCounterValue(
|
duration: Duration.zero));
|
||||||
deviceCode: deviceCode, duration: duration));
|
} else if (duration != Duration.zero) {
|
||||||
}
|
BlocProvider.of<ThreeGangBloc>(context).add(
|
||||||
},
|
SetCounterValue(
|
||||||
child: SvgPicture.asset(
|
deviceCode: deviceCode, duration: duration));
|
||||||
countNum > 0 ? Assets.pauseIcon : Assets.playIcon))
|
}
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
countNum > 0 ? Assets.pauseIcon : Assets.playIcon))
|
||||||
],
|
],
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@ class AssignDeviceView extends StatelessWidget {
|
|||||||
child: BlocConsumer<ManageUnitBloc, ManageUnitState>(listener: (context, state) {
|
child: BlocConsumer<ManageUnitBloc, ManageUnitState>(listener: (context, state) {
|
||||||
if (state is FetchDeviceByRoomIdState) {
|
if (state is FetchDeviceByRoomIdState) {
|
||||||
if (state.allDevices.isEmpty) {
|
if (state.allDevices.isEmpty) {
|
||||||
CustomSnackBar.displaySnackBar('No devices available for this user');
|
CustomSnackBar.displaySnackBar('You do not have the permission to assign devices');
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,16 @@ class StringHelpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String toTitleCase(String text) {
|
static String toTitleCase(String text) {
|
||||||
return text
|
if (text.contains(' ')) {
|
||||||
.split(' ')
|
//remove empty elements
|
||||||
.map((word) => word[0].toUpperCase() + word.substring(1))
|
String title = text.split(' ').where((element) => element.isNotEmpty).join(' ');
|
||||||
.join(' ');
|
String result = title
|
||||||
|
.split(' ')
|
||||||
|
.map((element) => element[0].toUpperCase() + element.substring(1))
|
||||||
|
.join(' ');
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return text.toUpperCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user