You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.2 KiB
Dart
103 lines
3.2 KiB
Dart
import 'package:car_provider_app/classes/colors.dart';
|
|
import 'package:car_provider_app/theme/colors.dart';
|
|
import 'package:car_provider_app/utils/navigator.dart';
|
|
import 'package:car_provider_app/utils/utils.dart';
|
|
import 'package:car_provider_app/widgets/show_fill_button.dart';
|
|
import 'package:car_provider_app/extensions/string_extensions.dart';
|
|
import 'package:car_provider_app/extensions/int_extensions.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../otp_widget.dart';
|
|
|
|
class OtpDialog extends StatelessWidget {
|
|
Function(String) onClick;
|
|
|
|
|
|
OtpDialog({required this.onClick});
|
|
String code="";
|
|
final TextEditingController _pinPutController = TextEditingController();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
color: Colors.white,
|
|
padding: EdgeInsets.all(24),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
"Please insert OTP Code".toText24(),
|
|
20.height,
|
|
OTPWidget(
|
|
autoFocus: true,
|
|
controller: _pinPutController,
|
|
defaultBorderColor: const Color(0xffD8D8D8),
|
|
maxLength: 4,
|
|
onTextChanged: (text) {},
|
|
pinBoxColor: Colors.white,
|
|
onDone: (code) => _onOtpCallBack(code, null),
|
|
textBorderColor: const Color(0xffD8D8D8),
|
|
pinBoxWidth: 60,
|
|
pinBoxHeight: 60,
|
|
pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor),
|
|
pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition,
|
|
pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300),
|
|
pinBoxRadius: 10,
|
|
keyboardType: TextInputType.number,
|
|
),
|
|
// Row(
|
|
// children: [
|
|
// Expanded(
|
|
// child: Container(
|
|
// width: double.infinity,
|
|
// height: 60,
|
|
// color: accentColor.withOpacity(0.3),
|
|
// ),
|
|
// ),
|
|
// 12.width,
|
|
// Expanded(
|
|
// child: Container(
|
|
// width: double.infinity,
|
|
// height: 60,
|
|
// color: accentColor.withOpacity(0.3),
|
|
// ),
|
|
// ),
|
|
// 12.width,
|
|
// Expanded(
|
|
// child: Container(
|
|
// width: double.infinity,
|
|
// height: 60,
|
|
// color: accentColor.withOpacity(0.3),
|
|
// ),
|
|
// ),
|
|
// 12.width,
|
|
// Expanded(
|
|
// child: Container(
|
|
// width: double.infinity,
|
|
// height: 60,
|
|
// color: accentColor.withOpacity(0.3),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
40.height,
|
|
ShowFillButton(
|
|
title: "Check Code",
|
|
width: double.infinity,
|
|
onPressed: () {
|
|
onClick(code);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
_onOtpCallBack(String otpCode, bool? isAutofill) {
|
|
if (otpCode.length == 4) {
|
|
// onSuccess(otpCode);
|
|
code=otpCode;
|
|
}
|
|
}
|
|
}
|