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/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.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'; 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 isDark => Provider.of<SettingProvider>(this).theme == "dark";
bool get isAr => Provider.of<SettingProvider>(this).language == "ar"; 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,
),
);
} }

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

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

Loading…
Cancel
Save