autotextformatter 0.0.7 copy "autotextformatter: ^0.0.7" to clipboard
autotextformatter: ^0.0.7 copied to clipboard

Automatically hyphenate or increment numbers on the next line. Simplify and enhance text formatting with this versatile package.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Autotextformatter Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController descController = TextEditingController();
  late TextFormatter textFormatter = TextFormatter(targetController: descController);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: SingleChildScrollView(
            child: TextFormField(
              controller: descController,
              style: TextStyle(color: Colors.grey[800], fontSize: 18),
              decoration: InputDecoration(
                border: InputBorder.none,
                hintText: 'Type something...',
                hintStyle: TextStyle(color: Colors.blue),
              ),
              maxLines: null,
              textInputAction: TextInputAction.newline,
              onChanged: (value) {
                textFormatter.format();
              },
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
140
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

Automatically hyphenate or increment numbers on the next line. Simplify and enhance text formatting with this versatile package.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on autotextformatter