InputBox Widget

A fully customizable Flutter InputBox widget designed for building dynamic and stylish input fields with ease.

Features

  • Customizable Design: Adjust field colors, borders, labels, and hint styles.
  • Icons Support: Add prefix and suffix icons with custom actions.
  • Validation: Includes built-in support for validation with custom logic.
  • Text Customization: Configure text behavior with TextEditingController, TextInputFormatter, and TextCapitalization.
  • Responsive Design: Built with flutter_screenutil for consistent scaling across devices.
  • Event Handling: Callbacks for onTap, onChanged, and onEditingComplete events.
  • New Feature: Added color property to allow custom colors for text, cursor, borders, and icons.

Installation

Add the following to your pubspec.yaml:

dependencies:  
  your_package_name: ^0.0.1  


#Usage
import 'package:flutter/material.dart';
import 'input_box.dart';

class MyForm extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('InputBox Example')),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: InputBox(
          hintText: "Enter your name",
          labelText: "Name",
          maxLength: 50,
          keyboardType: TextInputType.text,
          prefixIcon: Icons.person,
          suffixIcon: Icons.clear,
          color: Colors.blue,
          onSuffixIconPressed: () {
            print("Suffix icon pressed");
          },
          validator: (value) {
            if (value == null || value.isEmpty) {
              return "Please enter a name";
            }
            return null;
          },
        ),
      ),
    );
  }
}

Libraries

flutter_inputbox