0 purchases
autotextformatter
AutoTextFormatter #
A Flutter package that automatically adds hyphen or increments numbers to the next line if the current line has one.
Features #
Add this to your flutter app to:
Enhance the text editor experience, similar to Google Keep or Google Docs.
Automatically enable your text controller to add hyphens or numbering at the start of the line, improving the overall appearance of the text editor.
Getting Started #
To use the autotextformatter Flutter package, include it in your pubspec.yaml file:
dependencies:
autotextformatter: ^0.0.7
copied to clipboard
Run the following command to install the package:
flutter pub get
copied to clipboard
Usage #
Import the autotextformatter package in your Dart file:
import 'package:autotextformatter/autotextformatter.dart';
copied to clipboard
Following points are necessary to use this package :
Very first you need to have TextEditingController instance that has to be pass to TextFormatter constructor.
Then you can create instance of TextFormatter class to which you need to pass controller.
Here, you may need to use late keyword before initialization to avoid error The instance member 'contoller' can't be accessed in an initializer .
TextEditingController descController = TextEditingController();
late TextFormatter textAdjuster = TextFormatter(targetController: descController);
copied to clipboard
Use instance inside onChanged event of TextField, as text needs to be check everytime.
TextFormField(
controller: descController,
maxLines: null,
textInputAction: TextInputAction.newline,
onChanged: (value) {
textAdjuster.format();
},
);
copied to clipboard
Additional information #
Maintainer (Amar khamkar)
License (MIT)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.