code_input_fields 0.0.5 code_input_fields: ^0.0.5 copied to clipboard
A package that offers a pre-built field for users with obscuring capabilities
example/lib/main.dart
import 'package:code_input_fields/code_input_fields.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 MaterialApp(
title: 'code_input_fields example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Example for code_input_fields'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 200),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(
height: 70,
),
const Text(
'Create your mobile unlock passcode.',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
),
const SizedBox(
height: 35,
),
PasscodeField(
defaultColor: Colors.pink.shade100,
fieldLength: 4,
),
],
)),
),
);
}
}