master
Sultan khan 1 day ago
parent 2619998362
commit e76018ba2f

@ -120,7 +120,7 @@ class _MyApp extends State<MyApp> {
@override
Widget build(BuildContext context) {
PlatformBridge.init(context);
AppGlobal.context = context;
// Don't set AppGlobal.context here - it's set after MultiProvider is created
// SystemChrome.setPreferredOrientations([
// DeviceOrientation.portraitUp,
@ -174,6 +174,7 @@ class _MyApp extends State<MyApp> {
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(
builder: (context, mchild) {
AppGlobal.context = context; // Set context here after MultiProvider
AppGlobal.projectViewModelContext = context;
return MediaQuery(
data: MediaQuery.of(context).copyWith(

@ -180,7 +180,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
// user!.editedOn != null
// ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.editedOn!))
// :
user!.createdOn != null ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.createdOn!)) : '--',
user!.createdOn != null && user!.createdOn !='null'? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user!.createdOn!)) : '--',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48),
),
],

@ -217,7 +217,7 @@ class _AppDrawerState extends State<AppDrawer> {
children: <Widget>[
(user!.isFamily == null || user!.isFamily == false)
? InkWell(
child: DrawerItem(TranslationBase.of(context).family, SvgPicture.asset("assets/images/new/family_files.svg"),
child: DrawerItem(TranslationBase.of(context).family, SvgPicture.asset("assets/images/new/family_files.svg", width: 20, height: 20),
isImageIcon: true,
bottomLine: false,
textColor: CustomColors.black,
@ -259,7 +259,7 @@ class _AppDrawerState extends State<AppDrawer> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: SvgPicture.asset("assets/images/new/family_files.svg"),
child: SvgPicture.asset("assets/images/new/family_files.svg", width: 20, height: 20),
),
Expanded(
flex: 7,
@ -389,7 +389,7 @@ class _AppDrawerState extends State<AppDrawer> {
children: [
DrawerItem(
TranslationBase.of(context).notification,
SvgPicture.asset("assets/images/new/notifications.svg"),
SvgPicture.asset("assets/images/new/notifications.svg", width: 20, height: 20),
isImageIcon: true,
bottomLine: false,
letterSpacing: -0.84,
@ -430,7 +430,7 @@ class _AppDrawerState extends State<AppDrawer> {
),
if (projectProvider!.havePrivilege(3))
InkWell(
child: DrawerItem(TranslationBase.of(context).appsetting, SvgPicture.asset("assets/images/new/app_setting.svg"),
child: DrawerItem(TranslationBase.of(context).appsetting, SvgPicture.asset("assets/images/new/app_setting.svg", width: 20, height: 20),
isImageIcon: true, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider),
onTap: () {
Navigator.of(context).pushNamed(
@ -452,7 +452,7 @@ class _AppDrawerState extends State<AppDrawer> {
},
),
InkWell(
child: DrawerItem(TranslationBase.of(context).logout, SvgPicture.asset("assets/images/new/logout.svg"),
child: DrawerItem(TranslationBase.of(context).logout, SvgPicture.asset("assets/images/new/logout.svg", width: 20, height: 20),
isImageIcon: true, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider),
onTap: () {
logout();
@ -461,7 +461,7 @@ class _AppDrawerState extends State<AppDrawer> {
],
)
: InkWell(
child: DrawerItem(TranslationBase.of(context).loginregister, SvgPicture.asset("assets/images/new/logout.svg"),
child: DrawerItem(TranslationBase.of(context).loginregister, SvgPicture.asset("assets/images/new/logout.svg", width: 20, height: 20),
isImageIcon: true, letterSpacing: -0.84, fontSize: 14, bottomLine: false, projectProvider: projectProvider),
onTap: () {
login();

@ -32,6 +32,8 @@ class SMSOTP {
static bool? _loading;
bool _isDialogActive = false;
SMSOTP(
this.context,
this.type,
@ -90,7 +92,12 @@ class SMSOTP {
// }
return showDialog(
// Reset state for fresh dialog
_isDialogActive = true;
remainingTime = 120;
displayTime = '';
var result = await showDialog(
context: context,
barrierColor: Colors.black.withOpacity(0.63),
builder: (context) {
@ -129,7 +136,10 @@ class SMSOTP {
icon: Icon(Icons.close),
constraints: BoxConstraints(),
onPressed: () {
Navigator.pop(context);
_isDialogActive = false;
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
this.onFailure();
},
@ -186,6 +196,11 @@ class SMSOTP {
}),
);
});
// Clean up when dialog is dismissed
_isDialogActive = false;
return result;
}
TextStyle buildTextStyle() {
@ -263,27 +278,38 @@ class SMSOTP {
}
startTimer(setState) {
if (!_isDialogActive) return; // Don't proceed if dialog is no longer active
this.remainingTime--;
setState(() {
displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
});
// Check again before calling setState to ensure dialog is still active
if (_isDialogActive) {
setState(() {
displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
});
}
timer = Future.delayed(Duration(seconds: 1), () {
if (this.remainingTime > 0) {
if (_isDialogActive && this.remainingTime > 0) {
startTimer(setState);
} else {
Navigator.pop(context);
} else if (_isDialogActive && this.remainingTime <= 0) {
_isDialogActive = false;
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
});
}
static void hideSMSBox(context) {
Navigator.pop(context);
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
_onOtpCallBack(String otpCode, bool isAutofill) {
if (otpCode.length == 4) {
_isDialogActive = false; // Stop the timer when OTP is entered
onSuccess(otpCode);
}
}

Loading…
Cancel
Save