improvements

design_3.0_latest
Sikander Saleem 11 months ago
parent 08428fc745
commit d89ec1d317

@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/new_views/swipe_module/dialoge/confirm_dialog.dart';
import '../controllers/providers/settings/setting_provider.dart';
@ -13,4 +13,12 @@ extension BuildContextExtension on BuildContext {
bool get isDark => Provider.of<SettingProvider>(this).theme == "dark";
bool get isAr => Provider.of<SettingProvider>(this).language == "ar";
void showConfirmDialog(String message, {String? title, VoidCallback? onTap}) => showDialog(
context: this,
builder: (BuildContext cxt) => ConfirmDialog(
message: message,
onTap: onTap,
),
);
}

@ -193,7 +193,7 @@ class _LoginPageState extends State<LoginPage> {
rememberMe = _settingProvider!.rememberMe;
if (rememberMe) {
_user.userName = _settingProvider!.username;
userNameController.text=_user.userName??'';
userNameController.text = _user.userName ?? '';
_user.password = _settingProvider!.password;
}
}
@ -228,7 +228,7 @@ class _LoginPageState extends State<LoginPage> {
context.translation.signInToYour.customHeadingText(context).custom(color: Colors.white, fontSize: 27, fontWeight: FontWeight.w500),
context.translation.account.customHeadingText(context).custom(color: Colors.white, fontSize: 27, fontWeight: FontWeight.w500),
15.height,
// context.translation.letSignInToAccount.customHeadingText(context).custom(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 12),
// context.translation.letSignInToAccount.customHeadingText(context).custom(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 12),
],
),
),
@ -256,7 +256,7 @@ class _LoginPageState extends State<LoginPage> {
_user.userName = value;
},
),
18.height,
16.height,
AppTextFormField(
initialValue: _user.password ?? "",
showWithoutDecoration: true,
@ -270,9 +270,11 @@ class _LoginPageState extends State<LoginPage> {
// Based on passwordVisible state choose the icon
_passwordVisible ? Icons.visibility : Icons.visibility_off,
color: context.isDark ? AppColor.neutral10 : AppColor.neutral20,
).paddingOnly(end: 12).onPress(() { setState(() {
_passwordVisible = !_passwordVisible;
}); }),
).paddingOnly(end: 12).onPress(() {
setState(() {
_passwordVisible = !_passwordVisible;
});
}),
validator: (value) => Validator.isValidPassword(value!)
? null
: value.isEmpty
@ -282,25 +284,27 @@ class _LoginPageState extends State<LoginPage> {
_user.password = value;
},
),
8.height,
16.height,
Align(
alignment: AlignmentDirectional.centerEnd,
child: InkWell(
onTap: () async {
if(userNameController.text.isNotEmpty){
GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp(context: context, employeeId: userNameController.text);
if( response.isSuccess==true){
Navigator.push(context, MaterialPageRoute(builder: (context)=>ForgetPasswordVerifyOtpView(data: {'employeeId':userNameController.text,'phoneNumber':response.data},)));
// Navigator.push(context, ForgetPasswordVerifyOtpView.routeName);
}else{
Fluttertoast.showToast(msg: response.message ?? context.translation.failedToCompleteRequest);
}
}else{
Fluttertoast.showToast(msg: context.translation.employeeIdIsRequired);
child: context.translation.forgotPassword.bodyText(context).custom(color: AppColor.primary10, fontWeight: FontWeight.w500).onPress(() async {
if (userNameController.text.isNotEmpty) {
GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp(context: context, employeeId: userNameController.text);
if (response.isSuccess == true) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ForgetPasswordVerifyOtpView(
data: {'employeeId': userNameController.text, 'phoneNumber': response.data},
)));
// Navigator.push(context, ForgetPasswordVerifyOtpView.routeName);
} else {
context.showConfirmDialog(response.message ?? context.translation.failedToCompleteRequest);
}
},
child: context.translation.forgotPassword.bodyText(context).custom(color: AppColor.primary10, fontWeight: FontWeight.w500),
),
} else {
Fluttertoast.showToast(msg: context.translation.employeeIdIsRequired);
}
}),
),
Row(
children: [
@ -335,10 +339,7 @@ class _LoginPageState extends State<LoginPage> {
await _settingProvider!.setUser(_userProvider.user!);
(await SharedPreferences.getInstance()).remove(ASettings.localAuth);
await _settingProvider!.setRememberMe(_user.userName!, _user.password!, rememberMe);
/// The below line for the new design
// Navigator.pushNamed(context, LandPage.routeName);
Navigator.pushNamed(context, LandPage.routeName);
Navigator.pushReplacementNamed(context, LandPage.routeName);
} else {
Fluttertoast.showToast(msg: _userProvider.user?.message ?? context.translation.failedToCompleteRequest);
}

@ -147,7 +147,7 @@ class SwipeGeneralUtils {
List<LocationRequest> locationRequestList = <LocationRequest>[locationRequest];
LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList);
StreamSubscription<Location> _streamSubscription;
late StreamSubscription<Location> _streamSubscription;
int requestCode = (await (locationService.requestLocationUpdates(locationRequest)))!;
_streamSubscription = locationService.onLocationData!.listen(
(Location location) async {
@ -155,8 +155,7 @@ class SwipeGeneralUtils {
await locationService.removeLocationUpdates(requestCode);
handleSwipeOperation(swipeType: attendanceType!, context: context, lat: location.latitude??0, long: location.longitude??0);
requestCode = 0;
//TODO cancel this stream when listening done..
// _streamSubscription.cancel();
_streamSubscription.cancel();
},
);
} catch (error) {

Loading…
Cancel
Save