custom_form_w 0.0.1
custom_form_w: ^0.0.1 copied to clipboard
Custom Form Widget With Validation Button
CustomFormW #
A flexible and customizable form widget for Flutter that allows for dynamic form creation with validation, custom labels, styling, and more.
Usage #
import 'package:custom_form_w/custom_form_w.dart'; import 'package:flutter/material.dart';
void main() { runApp(const MyApp()); }
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Custom Form Widget', home: const MyHomePage(), ); } }
class MyHomePage extends StatelessWidget { const MyHomePage({super.key});
@override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.grey[100], body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Center( child: CustomFormW( numberOfFields: 5, requiredFieldIndices: [1, 2, 4], labelText: ['Name', 'Email', 'Phone', 'Address', 'City'], )), ], ), ); } }
Features #
- Create dynamic forms with a specified number of fields.
- Highlight required fields with asterisks (*).
- Customize field labels, hints, and styles.
- Supports multiple input types (e.g., text, email).
- Easy-to-use validation for required fields.
- Configurable submit button with custom text, color, and action.
- Customizable border styles and form layout.
- Optional submit button visibility.
Parameters #
numberOfFields: Required - Number of fields in the form. requiredFieldIndices: Required - List of indices (1-based) of required fields. labelText: Required - List of labels for each field. controllers: Required - List of TextEditingController for managing text input. formKey: Optional - A GlobalKey
Screenshots #
Installation #
Add this to your pubspec.yaml
file:
dependencies:
custom_form_w: ^0.0.1
then run flutter pub get