Coder Social home page Coder Social logo

rkishan516 / flexible_text Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5 KB

Powerful and flexible solution to create dynamic, interactive and customizable text with widgets, allows to write a single text block to show anything you want

License: MIT License

Dart 100.00%

flexible_text's Introduction

FlexibleText

FlexibleText is a Flutter widget that allows you to seamlessly mix and match rich text segments and widgets within a single text block. Customize your text with different styles and gestures, and insert inline widgets using simple placeholders. This powerful and flexible solution makes it easy to create dynamic, interactive, and visually appealing text in your Flutter applications.


Features

  • Rich Text Segments: Use different styles and gestures for various parts of your text.
  • Inline Widgets: Easily insert widgets such as icons, images, or any other widget into your text.
  • Customizable Separators: Define your own separators for rich text and widget placeholders.
  • Text Alignment: Control how the text is aligned horizontally.
  • Overflow Handling: Specify how visual overflow should be managed.

Getting Started ๐Ÿš€

Installation ๐Ÿง‘โ€๐Ÿ’ป

dependencies:
  flexible_text: ^latest_version

Import the Package

import 'package:flexible_text/flexible_text.dart';

Usage ๐Ÿ“

FlexibleText(
  text: 'Hello :World:~1~',
  style: TextStyle(color: Colors.black),
  richStyles: [TextStyle(color: Colors.red)],
  textRecognizers: [TapGestureRecognizer()..onTap = () { print('World tapped'); }],
  widgets: [Icon(Icons.star)],
);

In this example:

  • :World: will be styled with TextStyle(color: Colors.red) and will have a tap gesture.
  • ~1~ will be replaced by an Icon(Icons.star).

Customization Options ๐ŸŽจ

  • text: The text to display, with placeholders for rich text and widgets.
  • style: The default text style.
  • richStyles: A list of styles for rich text segments.
  • textRecognizers: A list of gesture recognizers for rich text segments.
  • textAlign: The alignment of the text.
  • overflow: How to handle text overflow.
  • widgetAlignment: The alignment of inline widgets.
  • widgets: A list of widgets to be inserted into the text.
  • richTextSeparator: The character used to separate rich text segments.
  • widgetSeparator: The character used to separate widget placeholders.

Contributing ๐Ÿ‘จ

Contributions are welcome! Please feel free to submit a pull request or open an issue to improve the package.

flexible_text's People

Contributors

rkishan516 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.