app/lib/components/otp_body.dart

264 lines
9.8 KiB
Dart
Raw Normal View History

2022-04-29 09:11:05 +02:00
import 'package:flutter/material.dart';
2022-05-13 07:57:43 +02:00
import 'package:flutter/services.dart';
import 'package:lottie/lottie.dart';
2022-04-29 09:11:05 +02:00
class OtpBody extends StatefulWidget {
const OtpBody({Key? key}) : super(key: key);
@override
State<OtpBody> createState() => _OtpBodyState();
}
class _OtpBodyState extends State<OtpBody> {
@override
Widget build(BuildContext context) {
2022-05-13 07:57:43 +02:00
return Container(
padding: const EdgeInsets.all(25),
child: ListView(children: [
Container(
child: Lottie.asset('assets/lottieanims/otp.json'),
),
Container(
2022-05-14 18:44:03 +02:00
padding: const EdgeInsets.only(top: 15),
child: const Text(
2022-05-13 07:57:43 +02:00
'A String of OTP Code Has Been Sent to 08080808080808',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 15, color: Colors.white),
),
),
Form(
child: Container(
2022-05-14 18:44:03 +02:00
padding: const EdgeInsets.only(top: 15),
2022-05-13 07:57:43 +02:00
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
),
child: SizedBox(
height: 50,
width: 50,
child: TextFormField(
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
2022-05-14 18:44:03 +02:00
} else if (value.isEmpty) {
2022-05-13 07:57:43 +02:00
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
2022-05-14 18:44:03 +02:00
decoration: const InputDecoration(
2022-05-13 07:57:43 +02:00
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
2022-05-14 18:44:03 +02:00
style: const TextStyle(color: Colors.white),
2022-05-13 07:57:43 +02:00
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
),
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
),
child: SizedBox(
height: 50,
width: 50,
child: TextFormField(
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
2022-05-14 18:44:03 +02:00
} else if (value.isEmpty) {
2022-05-13 07:57:43 +02:00
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
2022-05-14 18:44:03 +02:00
decoration: const InputDecoration(
2022-05-13 07:57:43 +02:00
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
2022-05-14 18:44:03 +02:00
style: const TextStyle(color: Colors.white),
2022-05-13 07:57:43 +02:00
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
),
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
),
child: SizedBox(
height: 50,
width: 50,
child: TextFormField(
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
2022-05-14 18:44:03 +02:00
} else if (value.isEmpty) {
2022-05-13 07:57:43 +02:00
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
2022-05-14 18:44:03 +02:00
decoration: const InputDecoration(
2022-05-13 07:57:43 +02:00
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
2022-05-14 18:44:03 +02:00
style: const TextStyle(color: Colors.white),
2022-05-13 07:57:43 +02:00
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
),
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
),
child: SizedBox(
height: 50,
width: 50,
child: TextFormField(
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
2022-05-14 18:44:03 +02:00
} else if (value.isEmpty) {
2022-05-13 07:57:43 +02:00
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
2022-05-14 18:44:03 +02:00
decoration: const InputDecoration(
2022-05-13 07:57:43 +02:00
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
2022-05-14 18:44:03 +02:00
style: const TextStyle(color: Colors.white),
2022-05-13 07:57:43 +02:00
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
),
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
),
child: SizedBox(
height: 50,
width: 50,
child: TextFormField(
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
2022-05-14 18:44:03 +02:00
} else if (value.isEmpty) {
2022-05-13 07:57:43 +02:00
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
2022-05-14 18:44:03 +02:00
decoration: const InputDecoration(
2022-05-13 07:57:43 +02:00
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
2022-05-14 18:44:03 +02:00
style: const TextStyle(color: Colors.white),
2022-05-13 07:57:43 +02:00
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
),
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
),
child: SizedBox(
height: 50,
width: 50,
child: TextFormField(
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
2022-05-14 18:44:03 +02:00
} else if (value.isEmpty) {
2022-05-13 07:57:43 +02:00
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
2022-05-14 18:44:03 +02:00
decoration: const InputDecoration(
2022-05-13 07:57:43 +02:00
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
2022-05-14 18:44:03 +02:00
style: const TextStyle(color: Colors.white),
2022-05-13 07:57:43 +02:00
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
),
),
),
],
),
)),
Container(
2022-05-14 18:44:03 +02:00
padding: const EdgeInsets.only(top: 15, bottom: 15),
2022-05-13 07:57:43 +02:00
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
2022-05-14 18:44:03 +02:00
const Text(
2022-05-13 07:57:43 +02:00
"didn't get the code? \t",
style: TextStyle(color: Colors.white),
),
Text(
'Resend code',
style: TextStyle(color: Colors.blue.shade800),
),
],
),
),
ElevatedButton(
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all(const Color(0xff8B0000)),
backgroundColor:
MaterialStateProperty.all(const Color(0xff8B0000)),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: const BorderSide(color: Colors.red)))),
onPressed: () {
Navigator.pushNamed(context, '/login');
2022-05-13 07:57:43 +02:00
},
child: const Text(
'Verify',
style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]),
);
2022-04-29 09:11:05 +02:00
}
}