indonesian_form_kit 0.1.0 copy "indonesian_form_kit: ^0.1.0" to clipboard
indonesian_form_kit: ^0.1.0 copied to clipboard

A Flutter form toolkit for Indonesian apps with validators, input formatters, parsers, and ready-to-use form fields.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:indonesian_form_kit/indonesian_form_kit.dart';

void main() {
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Indonesian Form Kit',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
        useMaterial3: true,
      ),
      home: const ExampleFormPage(),
    );
  }
}

class ExampleFormPage extends StatefulWidget {
  const ExampleFormPage({super.key});

  @override
  State<ExampleFormPage> createState() => _ExampleFormPageState();
}

class _ExampleFormPageState extends State<ExampleFormPage> {
  final _formKey = GlobalKey<FormState>();
  int? _amount;
  String? _phone;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Indonesian Form Kit')),
      body: SafeArea(
        child: Form(
          key: _formKey,
          child: ListView(
            padding: const EdgeInsets.all(16),
            children: [
              IndonesianRupiahField(
                label: 'Harga',
                required: true,
                onChangedValue: (value) => setState(() => _amount = value),
              ),
              const SizedBox(height: 12),
              IndonesianPhoneField(
                label: 'Nomor HP',
                required: true,
                onChangedNormalized: (value) => setState(() => _phone = value),
              ),
              const SizedBox(height: 12),
              const IndonesianNikField(
                label: 'NIK',
                required: true,
                validateDateOfBirth: true,
              ),
              const SizedBox(height: 12),
              const IndonesianNpwpField(label: 'NPWP'),
              const SizedBox(height: 12),
              const IndonesianPostalCodeField(label: 'Kode Pos'),
              const SizedBox(height: 12),
              const IndonesianPlateNumberField(label: 'Plat Nomor'),
              const SizedBox(height: 20),
              FilledButton(
                onPressed: () {
                  _formKey.currentState?.validate();
                },
                child: const Text('Validate'),
              ),
              const SizedBox(height: 16),
              Text('Parsed Rupiah: ${_amount ?? '-'}'),
              Text('Normalized Phone: ${_phone ?? '-'}'),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
160
points
5
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter form toolkit for Indonesian apps with validators, input formatters, parsers, and ready-to-use form fields.

Repository (GitHub)
View/report issues

Topics

#flutter #form #indonesia #validation #formatter

License

MIT (license)

Dependencies

flutter

More

Packages that depend on indonesian_form_kit