Skip to content

A package which allows to enter text which can be collapsed and expanded. Moreover, it will automatically parse the URLs present in the text into hyperlinks.

License

Notifications You must be signed in to change notification settings

praja/parsed_readmore

 
 

Repository files navigation

Parsed Readmore

A package which allows to enter text which can be collapsed and expanded. Moreover, it will automatically parse the urls present in the text into hyperlinks.

Demo Gif

Features

  • Expandable and Collapsable text.
  • Trimming can either be done on basis of length or number of lines.
  • Option to include a customised delimiter.
  • Automatically parses the urls present in the text into hyperlinks which launches the browser on click event.
  • All the text components including the parsed urls, delimiter, clickable texts, etc can be given seperate custom styles.

Installation

Run this command in your terminal

flutter pub add parsed_readmore

Or add it manually in your project's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  parsed_readmore: 

Usage Example

For detailed implementation refer to the example

Import parsed_readmore.dart

import 'package:parsed_readmore/parsed_readmore.dart';

The code below will implement all features of the widget with the default values which are :

  • trimMode = TrimMode.length
  • delimiter = ' ...'
  • trimLength = 240
  • trimExpandedText = 'show less',
  • trimCollapsedText = 'read more',
ParsedReadMore(inputString)

If you need to use some customized values for different elements of the widget just add values to the relevant parameters.

ParsedReadMore(
    inputString,
    urlTextStyle: TextStyle(color: Colors.green, fontSize: 20, decoration: TextDecoration.underline),
    trimMode: TrimMode.line,
    trimLines: 4,
    delimiter: '  ***',
    delimiterStyle: TextStyle(color: Colors.black, fontSize: 20),
    style: TextStyle(color: Colors.orange, fontSize: 20),
    trimCollapsedText: 'expand',
    trimExpandedText: 'compress',
    moreStyle: TextStyle(color: Colors.red, fontSize: 20),
    lessStyle: TextStyle(color: Colors.blue, fontSize: 20),
)

Issues

Please file any issues, bugs or feature request as an issue on the GitHub page. If you have some idea for feature upgrade, feel free to contact me through email [email protected].

About

A package which allows to enter text which can be collapsed and expanded. Moreover, it will automatically parse the URLs present in the text into hyperlinks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 35.2%
  • CMake 30.0%
  • Dart 27.0%
  • HTML 3.0%
  • C 2.4%
  • Swift 2.1%
  • Other 0.3%