flutter_pin_code_widget 0.1.2 flutter_pin_code_widget: ^0.1.2 copied to clipboard
PIN Code wiget for creating and checking local pin code with flexible settings.
import 'package:flutter/material.dart';
import 'package:flutter_pin_code_widget/flutter_pin_code_widget.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData.dark(),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: [
TextButton(
onPressed: () {},
child: const Text(
'Skip',
style: TextStyle(color: Colors.blueAccent),
))
],
),
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 40),
Text(
'Set up PIN',
style: Theme.of(context).textTheme.headline4,
),
const SizedBox(height: 20),
const Text('You can use this PIN to unlock the app..'),
const Text('Pin length is 4-25 digits'),
const SizedBox(height: 60),
Expanded(
child: PinCodeWidget(
minPinLength: 4,
maxPinLength: 25,
onChangedPin: (pin) {
// check the PIN length and check different PINs with 4,5.. length.
},
onEnter: (pin, _) {
// callback user pressed enter
},
centerBottomWidget: IconButton(
icon: const Icon(
Icons.fingerprint,
size: 40,
),
onPressed: () {},
),
),
),
],
),
),
);
}
}