pin static method
Widget
pin({
- required dynamic onChanged(),
- required int length,
- required VoidCallback onTap,
- required String buttonText,
- required bool isLoading,
- required bool isComplete,
- dynamic onCompleted()?,
- String description = 'Masukkan PIN Transaksi Anda',
- String buttonType = 'default',
- TextInputType keyboardType = TextInputType.number,
- bool obscureText = true,
- BorderRadius? borderRadius,
- Color? inactiveColor,
- Color? activeColor,
- PinCodeFieldShape pinCodeFieldShape = PinCodeFieldShape.box,
- MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
- CrossAxisAlignment crossAxisAlignmen = CrossAxisAlignment.stretch,
Implementation
static Widget pin({
required Function(String) onChanged,
required int length,
required VoidCallback onTap,
required String buttonText,
required bool isLoading,
required bool isComplete,
Function(String)? onCompleted,
String description = 'Masukkan PIN Transaksi Anda',
String buttonType = 'default',
TextInputType keyboardType = TextInputType.number,
bool obscureText = true,
BorderRadius? borderRadius,
Color? inactiveColor,
Color? activeColor,
PinCodeFieldShape pinCodeFieldShape = PinCodeFieldShape.box,
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
CrossAxisAlignment crossAxisAlignmen = CrossAxisAlignment.stretch,
}) {
return Column(
crossAxisAlignment: crossAxisAlignmen,
mainAxisAlignment: mainAxisAlignment,
children: [
SizedBox(height: 10.h),
Center(
child: Texts.caption(description),
),
SizedBox(height: 20.h),
PinCodeTextField(
appContext: Get.context!,
length: 6,
onChanged: (value) {},
onCompleted: onCompleted,
keyboardType: keyboardType,
obscureText: obscureText,
pinTheme: PinTheme(
shape: pinCodeFieldShape,
borderRadius: BorderRadius.circular(10.r),
inactiveColor: Get.theme.shadowColor,
activeColor: Get.theme.primaryColor,
selectedColor: Get.theme.primaryColor,
),
),
isLoading
? Padding(
padding: EdgeInsets.only(top: 10.h),
child: LoadingActivity.platformLoading(
color: Get.theme.primaryColor,
size: 40.sp,
),
)
: AbsorbPointer(
absorbing: !isComplete,
child: Buttons.defaultButton(
fillColor: isComplete
? Get.theme.primaryColor
: Get.theme.shadowColor,
handler: onTap,
widget: Texts.button('Submit'),
),
),
],
);
}