-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpin_screen.dart
67 lines (61 loc) · 1.81 KB
/
pin_screen.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import 'package:flutter/material.dart';
import 'package:pinput/pinput.dart';
class PinScreen extends StatefulWidget {
const PinScreen({Key? key}) : super(key: key);
@override
State<PinScreen> createState() => _PinScreenState();
}
class _PinScreenState extends State<PinScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('pin put auto fill'),
),
body: Center(
child: Column(
children: [
const Spacer(),
Pinput(
length: 4,
defaultPinTheme: defaultPinTheme,
focusedPinTheme: focusedPinTheme,
submittedPinTheme: submittedPinTheme,
validator: (s) {
return s == '2222' ? null : 'Pin is incorrect';
},
pinputAutovalidateMode: PinputAutovalidateMode.onSubmit,
showCursor: true,
onCompleted: (pin) => debugPrint(pin),
),
const Spacer(),
],
),
),
);
}
}
final defaultPinTheme = PinTheme(
width: 56,
height: 56,
textStyle: const TextStyle(
fontSize: 16,
color: Color.fromRGBO(1, 28, 111, 1.0),
fontWeight: FontWeight.w600,),
decoration: BoxDecoration(
border: Border.all(color: const Color.fromRGBO(168, 113, 136, 1.0,),),
borderRadius: BorderRadius.circular(10),
),
);
final focusedPinTheme = defaultPinTheme.copyWith(
decoration: defaultPinTheme.decoration!.copyWith(
color: const Color.fromRGBO(194, 8, 99, 1.0),
borderRadius: BorderRadius.circular(15),
),
);
final submittedPinTheme = defaultPinTheme.copyWith(
decoration: defaultPinTheme.decoration!.copyWith(
color: const Color.fromRGBO(132, 46, 72, 1.0),
borderRadius: BorderRadius.circular(10),
),
);