local auth fail handling and improvements.
parent
633c2da82a
commit
262b3aa42f
@ -0,0 +1,68 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/extensions/int_extensions.dart';
|
||||||
|
import 'package:test_sa/extensions/text_extensions.dart';
|
||||||
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||||
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||||
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||||
|
|
||||||
|
class LocalAuthFailedDialog extends StatelessWidget {
|
||||||
|
final String? title;
|
||||||
|
final String? message;
|
||||||
|
final String? okTitle;
|
||||||
|
final String? retryBtnText;
|
||||||
|
final String? loginBtnText;
|
||||||
|
final VoidCallback onRetry;
|
||||||
|
final VoidCallback onLogin;
|
||||||
|
|
||||||
|
const LocalAuthFailedDialog(
|
||||||
|
{Key? key, this.title, this.message = "Authentication Failed, Please try again or login", this.okTitle, required this.onRetry, required this.onLogin, this.retryBtnText, this.loginBtnText})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Dialog(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
shape: const RoundedRectangleBorder(),
|
||||||
|
insetPadding: const EdgeInsets.only(left: 21, right: 21),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
"Confirm",
|
||||||
|
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Colors.black87, height: 35 / 24, letterSpacing: -0.96),
|
||||||
|
).paddingOnly(top: 16, bottom: 8),
|
||||||
|
message != null ? message!.heading5(context).custom(color: AppColor.neutral50) : const SizedBox(),
|
||||||
|
28.height,
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
AppFilledButton(
|
||||||
|
label: retryBtnText ?? "Retry",
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
onRetry();
|
||||||
|
},
|
||||||
|
buttonColor: AppColor.primary90,
|
||||||
|
),
|
||||||
|
16.height,
|
||||||
|
AppFilledButton(
|
||||||
|
label: loginBtnText ?? "Login",
|
||||||
|
buttonColor: Colors.white54,
|
||||||
|
textColor: AppColor.black10,
|
||||||
|
height: 48,
|
||||||
|
showBorder: true,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
onLogin();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue