Antduo / expandable_text

Flutter plugin with an expandable text widget

Home Page:https://pub.dev/packages/expandable_text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expandable_text

pub package

在源代码上修改省略号style为文字style.

This Flutter package includes the widget ExpandableText which you can use to initially only show a defined number of lines of a probably long text. The widget appends a configurable text link which let's the user expand the full text, or collapse it again.

Example with maxLines=1

Getting Started

Add this to your package's pubspec.yaml file:

dependencies:
    expandable_text:
      git:
        url: https://github.com/Antduo/expandable_text.git

Next, import the package into your dart code:

import 'package:expandable_text/expandable_text.dart';

Usage

Example which shows an expandable text if longText exceeds one line:

Widget build(BuildContext context) {
    return ExpandableText(
        longText,
        expandText: 'show more',
        collapseText: 'show less',
        maxLines: 1,
        linkColor: Colors.blue,
    );
}

About

Flutter plugin with an expandable text widget

https://pub.dev/packages/expandable_text

License:MIT License


Languages

Language:Dart 93.5%Language:Swift 4.7%Language:Kotlin 1.4%Language:Objective-C 0.4%