perfect_text_field 2.3.0+1 copy "perfect_text_field: ^2.3.0+1" to clipboard
perfect_text_field: ^2.3.0+1 copied to clipboard

A versatile and customizable text field for Flutter with support for token decoration, autocomplete, smart number input formatting, and full text editing control.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:perfect_text_field/input_formatters/decimal_number_formatter.dart';
import 'package:perfect_text_field/perfect_text_field.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final decimalFormatterTextController = PerfectTextController();
  final chipTextController = PerfectTextController(
    decorations: [
      DecorationStyle(
        type: DecorationType.hashtag,
        backgroundColor: Colors.blue.withOpacity(0.2),
        textStyle: TextStyle(color: Colors.blue),
        onTap: (t) => print('Hashtag tapped: $t'),
      ),
      DecorationStyle(
        type: DecorationType.mention,
        backgroundColor: Colors.green.withOpacity(0.2),
        textStyle: TextStyle(color: Colors.green),
        onTap: (t) => print('Mention tapped: $t'),
      ),
      DecorationStyle(
        type: DecorationType.email,
        backgroundColor: Colors.orange.withOpacity(0.2),
        textStyle: TextStyle(color: Colors.orange),
        onTap: (t) => print('Email tapped: $t'),
      ),
      DecorationStyle(
        type: DecorationType.phone,
        backgroundColor: Colors.red.withOpacity(0.2),
        textStyle: TextStyle(color: Colors.red),
        onTap: (t) => print('Phone tapped: $t'),
      ),
    ],
  );

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Perfect Text Field'),
        ),
        body: ListView(
          padding: const EdgeInsets.all(16),
          children: [
            ListTile(
              title: const Text('Decimal Number Formatter'),
              subtitle: PerfectTextField(
                controller: decimalFormatterTextController,
                dismissKeyboardOnTapOutside: true,
                inputFormatters: const [
                  DecimalNumberFormatter(
                    min: 0,
                    max: 100.0,
                    decimalLength: 2,
                  )
                ],
                keyboardType: const TextInputType.numberWithOptions(
                  decimal: true,
                ),
              ),
            ),
            ListTile(
              title: const Text('Chip Text Field'),
              subtitle: PerfectTextField(
                controller: chipTextController,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
0
points
0
downloads

Publisher

verified publisherwaybeetech.com

Weekly Downloads

A versatile and customizable text field for Flutter with support for token decoration, autocomplete, smart number input formatting, and full text editing control.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dlibphonenumber, flutter

More

Packages that depend on perfect_text_field