autotextformatter 0.0.7
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.
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
Run the following command to install the package:
flutter pub get
Usage #
Import the autotextformatter
package in your Dart file:
import 'package:autotextformatter/autotextformatter.dart';
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);
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();
},
);
Additional information #
- Maintainer (Amar khamkar)
- License (MIT)