free_form_text

Last updated:

0 purchases

free_form_text Image
free_form_text Images
Add to Cart

Description:

free form text

free_form_text #
An API for painting styled text to
a Canvas.
Text is styled with the TextStyle class and can be painted at any arbitrary angle as well as along a defined path. The API should be useful for applications that require angled and free form text such as games or GIS mapping.
Features #

Style the text with TextStyle.
Paint text at arbitrary angles.
Paint text along a specified path defined as a List of Offset.

Getting started #
To use this plugin, add free_form_text as a dependency in your pubspec.yaml file. For example:
dependencies:
free_form_text: '^0.4.4'
copied to clipboard
Usage #
To apply the API, import package:free_form_text/free_form_text.dart, create a Future<FreeFormText> and use it in a FutureBuilder that includes
a CustomPaint
widget as illustrated below. The actual painting is done in a
CustomPainter.
Create a FreeFormText object:
FreeFormText text = FreeFormText(
label: 'Lorem ipsum dolor sit amet.',
context: context,
style: const TextStyle(
fontSize: 16,
color: Colors.black,
wordSpacing: 2.0,
letterSpacing: 0.5,
fontWeight: FontWeight.bold));
Future<FreeFormText> textFuture = text.layout();
copied to clipboard
Then paint it in a CustomPainter:
class ExampleTextPainter extends CustomPainter {
FreeFormText text;
ExampleTextPainter(this.text);
@override
void paint(Canvas canvas, Size size) {
var painter = FreeFormTextPainter(canvas);
painter.paintText(
text: text, offset: const Offset(50.0, 200.0), angle: 30.0);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return false;
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.