MIF_E31222379_MOBILE/lib/screen/auth/otp_screen.dart

206 lines
7.5 KiB
Dart

import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:rijig_mobile/core/guide.dart';
class VerifotpScreen extends StatefulWidget {
const VerifotpScreen({super.key});
@override
State<VerifotpScreen> createState() => _VerifotpScreenState();
}
class _VerifotpScreenState extends State<VerifotpScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: whiteColor,
body: SafeArea(
child: SizedBox(
width: double.infinity,
child: Padding(
padding: PaddingCustom().paddingHorizontalVertical(16, 30),
child: SingleChildScrollView(
child: Column(
children: [
Gap(16),
Text("OTP Verification", style: Tulisan.heading),
Gap(8),
const Text(
"kode otp tela dikirim ke whatsapp 6287874****** \ndan akan kadaluarsa dalam 00:30",
textAlign: TextAlign.center,
style: TextStyle(color: Color(0xFF757575)),
),
// const SizedBox(height: 16),
GapCustom().gapValue(12, true),
SizedBox(height: MediaQuery.of(context).size.height * 0.1),
const OtpForm(),
SizedBox(height: MediaQuery.of(context).size.height * 0.2),
TextButton(
onPressed: () {},
child: const Text(
"tidak menerima kode otp?\nkirim ulang kode otp",
style: TextStyle(color: Color(0xFF757575)),
textAlign: TextAlign.center,
),
),
],
),
),
),
),
),
);
}
}
const authOutlineInputBorder = OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFF757575)),
borderRadius: BorderRadius.all(Radius.circular(12)),
);
class OtpForm extends StatelessWidget {
const OtpForm({super.key});
@override
Widget build(BuildContext context) {
return Form(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: 64,
width: 64,
child: TextFormField(
onSaved: (pin) {},
onChanged: (pin) {
if (pin.isNotEmpty) {
FocusScope.of(context).nextFocus();
}
},
textInputAction: TextInputAction.next,
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
decoration: InputDecoration(
hintStyle: const TextStyle(color: Color(0xFF757575)),
border: authOutlineInputBorder,
enabledBorder: authOutlineInputBorder,
focusedBorder: authOutlineInputBorder.copyWith(
borderSide: const BorderSide(color: Color(0xFF00BF6D)),
),
),
),
),
SizedBox(
height: 64,
width: 64,
child: TextFormField(
onSaved: (pin) {},
onChanged: (pin) {
if (pin.isNotEmpty) {
FocusScope.of(context).nextFocus();
}
},
textInputAction: TextInputAction.next,
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
decoration: InputDecoration(
hintStyle: const TextStyle(color: Color(0xFF757575)),
border: authOutlineInputBorder,
enabledBorder: authOutlineInputBorder,
focusedBorder: authOutlineInputBorder.copyWith(
borderSide: const BorderSide(color: Color(0xFF00BF6D)),
),
),
),
),
SizedBox(
height: 64,
width: 64,
child: TextFormField(
onSaved: (pin) {},
onChanged: (pin) {
if (pin.isNotEmpty) {
FocusScope.of(context).nextFocus();
}
},
textInputAction: TextInputAction.next,
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
decoration: InputDecoration(
hintStyle: const TextStyle(color: Color(0xFF757575)),
border: authOutlineInputBorder,
enabledBorder: authOutlineInputBorder,
focusedBorder: authOutlineInputBorder.copyWith(
borderSide: const BorderSide(color: Color(0xFF00BF6D)),
),
),
),
),
SizedBox(
height: 64,
width: 64,
child: TextFormField(
onSaved: (pin) {},
onChanged: (pin) {
if (pin.isNotEmpty) {
FocusScope.of(context).nextFocus();
}
},
textInputAction: TextInputAction.next,
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly,
],
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
decoration: InputDecoration(
hintStyle: const TextStyle(color: Color(0xFF757575)),
border: authOutlineInputBorder,
enabledBorder: authOutlineInputBorder,
focusedBorder: authOutlineInputBorder.copyWith(
borderSide: const BorderSide(color: Color(0xFF00BF6D)),
),
),
),
),
],
),
const SizedBox(height: 24),
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
elevation: 0,
backgroundColor: const Color(0xFF00BF6D),
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 48),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16)),
),
),
child: const Text("Continue"),
),
],
),
);
}
}