dynamic_pin_keyboard 0.0.1
dynamic_pin_keyboard: ^0.0.1 copied to clipboard
This is a flutter package that gives you a custom and reusable keyboard experience for one time password widgets, transaction pin widgets and simple login widgets.
example/lib/main.dart
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Flutter Demo',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({
super.key,
});
// how it looks.
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final _pinCodeController = TextEditingController();
final int pinLength = 6;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
// Container(
// decoration: const BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(8),
// topRight: Radius.circular(8),
// ),
// ),
// width: double.infinity,
// child: Padding(
// padding: const EdgeInsets.symmetric(
// horizontal: 40,
// ),
// child: DynamicPinKeyboard(
// biometric: false,
// numberOne: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberTwo: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberThree: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberFour: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberFive: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberSix: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberSeven: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberEight: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberNine: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// numberZero: (p0) {
// if (_pinCodeController.text.length < pinLength) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text + p0;
// });
// }
// },
// removePin: () {
// if (_pinCodeController.text.isNotEmpty) {
// setState(() {
// _pinCodeController.text = _pinCodeController.text.substring(
// 0,
// _pinCodeController.text.length - 1,
// );
// });
// }
// },
// ),
// ),
// ),
],
));
}
}