pk_cnic_input_field 1.0.0
pk_cnic_input_field: ^1.0.0 copied to clipboard
Takes input in the Pakistani CNIC format
import 'package:flutter/material.dart';
import 'package:pk_cnic_input_field/pk_cnic_input_field.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: 'PK CNIC Input Field Example',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const MyHomePage(title: 'PK CNIC Input Field Example'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({required this.title, Key? key}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String cnic = "";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
children: [
PKCNICInputField(
onChanged: (value) {
cnic = value;
setState(() {});
},
),
const SizedBox(
height: 10,
),
Text("Your CNIC is " + cnic),
],
),
),
);
}
}