A Flutter plugin than allow expand and collapse text dynamically

Related tags

Templates readmore
Overview

readmore

A Flutter plugin than allow expand and collapse text.

usage:

add to your pubspec

readmore: ^1.0.2

and import:

import 'package:readmore/readmore.dart';
ReadMoreText(
  'Flutter is Google’s mobile UI open source framework to build high-quality native (super fast) interfaces for iOS and Android apps with the unified codebase.',
  trimLines: 2,
  colorClickableText: Colors.pink,
  trimMode: TrimMode.Line,
  trimCollapsedText: 'Show more',
  trimExpandedText: 'Show less',
  moreStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
);
Comments
  • Support Flutter v2.0

    Support Flutter v2.0

    Hello I'm trying to use readmore with the new stable flutter version but I have the next error:

    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/readmore-1.0.1/lib/readmore.dart:82:58: Error: No named parameter with the name 'nullOk'. widget.locale ?? Localizations.localeOf(context, nullOk: true); ^^^^^^

    opened by juanagu 5
  • RTL bug

    RTL bug

    I figured out that we have bug in RTL mode

    It tried to fix it, but failed , I think the bug is here https://github.com/jonataslaw/readmore/blob/master/lib/readmore.dart#L148-L152

    I changed it to, it works better but not fixed

              if (textDirection == TextDirection.rtl) {
                final pos = textPainter.getPositionForOffset(Offset(
                  linkSize.width,
                  textSize.height,
                ));
                endIndex = textPainter.getOffsetBefore(pos.offset);
                // endIndex = textPainter.getOffsetAfter(pos.offset); I tried getOffsetAfter too
              } else {
                final pos = textPainter.getPositionForOffset(Offset(
                  textSize.width - linkSize.width,
                  textSize.height,
                ));
                endIndex = textPainter.getOffsetBefore(pos.offset);
              }
    

    @jonataslaw can you take a look?

    opened by sm2017 2
  • Add support for text callback

    Add support for text callback

    This fixes #1 to an extent. I don't have any use cases in mind where you'd want a callback for each state so I added support for a single state callback.

    My use case for this is having the functionality to have 2 lines of text with an inline read more but when pressed the read more takes you to another screen with the full text rather than expanding the text.

    opened by andreaselia 2
  • ListView bug

    ListView bug

    If we put ReadMoreText in a ListView it not worked as expected

        final child = ReadMoreText(
          'Flutter is Google’s mobile UI open source framework to build high-quality native (super fast) interfaces for iOS and Android apps with the unified codebase.',
          trimLines: 2,
          colorClickableText: Colors.pink,
          trimMode: TrimMode.Line,
          trimCollapsedText: '...Show more',
          trimExpandedText: ' show less',
        );
        return Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            child,
            SizedBox(height: 15),
            ListView(
              shrinkWrap: true,
              physics: NeverScrollableScrollPhysics(),
              children: [
                child
              ],
            ),
          ],
        );
    

    image

    I/flutter (13835): linkSize Size(90.0, 19.0) textSize Size(347.0, 38.0)
    I/flutter (13835): linkSize Size(347.0, 19.0) textSize Size(347.0, 38.0)
    

    You can see linkSize in a ListView is wrong

    opened by sm2017 2
  • Added ability to add pretext/posttext with a data

    Added ability to add pretext/posttext with a data

    This pull request focuses on adding the pre and post text with their own styles to so we can achieve the comment UI having the username carriy their own style

    Like shown in the image AMANDA is the username image

    opened by Siqlain-Hanif 1
  • Not working on Flutter beta chanel

    Not working on Flutter beta chanel

    Error:

    Launching lib/main.dart on Chrome in debug mode...
    Waiting for connection from debug service on Chrome...
    ../../../../.pub-cache/hosted/pub.dartlang.org/readmore-1.0.1/lib/readmore.dart:82:58: Error: No named parameter with the name 'nullOk'.
            widget.locale ?? Localizations.localeOf(context, nullOk: true);
                                                             ^^^^^^
    ../../../sdk/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
      static Locale localeOf(BuildContext context) {
                    ^^^^^^^^
    Failed to compile application.
    

    Flutter localization API update commit

    Now, should use maybeLocaleOf method, not localeOf, if u want to get locale safety.

    opened by karabanovbs 1
  • Add delimiter span && style for trimExpandedText & trimCollapsedText …

    Add delimiter span && style for trimExpandedText & trimCollapsedText …

    Additional parameters. That allow styled 'show less' and 'show more' text. Additional split ... from link to parameter delimiter with default value '... ' and style for them.

    opened by unger1984 1
  • [Feature Request] Add url detection and launch support

    [Feature Request] Add url detection and launch support

    Love this package, and it works great! But would be awesome to have url detection and launch url support within the package.

    Edit: It appears launch url was added to the last merge, but it is not working on the main package.

    opened by DennisAshford 0
  • Error when collapsing on an emoji

    Error when collapsing on an emoji

    When the last character of the line that is collapsed is an emoji, an error is thrown :

    ════════ Exception caught by painting library ══════════════════════════════════
    The following ArgumentError was thrown while building a TextSpan:
    Invalid argument(s): string is not well-formed UTF-16
    
    opened by LeGoffMael 3
  • Default text style for colorClickableText

    Default text style for colorClickableText

    The "style" and "moreStyle/lessStyle" arguments can be null. In that case, there is a problem that "colorClickableText" is not effective. As you can see below, if the "style" is null, "effectiveTextStyle" will be null, and also "_defaultMoreStyle" will be null. This means "colorClickableText" is not effective.

    This PR might be related with #20 .

    Widget build(BuildContext context) {
        final DefaultTextStyle defaultTextStyle = DefaultTextStyle.of(context);
        TextStyle? effectiveTextStyle = widget.style;
        if (widget.style?.inherit ?? false) {
          effectiveTextStyle = defaultTextStyle.style.merge(widget.style);
        } 
       ...
        final _defaultMoreStyle = widget.moreStyle ??
            effectiveTextStyle?.copyWith(color: colorClickableText);
    
    
    opened by takinok 0
Owner
Jonny Borges
VP of Engineering from Iris Finance. Developer and Lawyer. Passionate about dart and productivity hacks.
Jonny Borges
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

flutter-ui-nice ❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Twitter Medium QQ Group Flutter Open NieBin Flutter O

Flutter开源社区 3.4k Jan 3, 2023
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

flutter-ui-nice ❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Twitter Medium QQ Group Flutter Open NieBin Flutter O

Flutter开源社区 3.4k Jan 5, 2023
An easy-to-use flutter http network requests handler with more functionality than http but more simpler than dio.

network_requests An easy-to-use flutter http network requests handler with more functionality than http but more simpler than dio. Platform Supported

Coder_Manuel 3 Dec 15, 2022
A Flutter widget to dynamically add links to your text.

linkable A Flutter widget to add links to your text. By default, the Text or RichText widgets render the URLs in them as simple text which are not cli

Anup Kumar Panwar 18 Dec 15, 2021
Dynamically translate text

auto_localization A new Flutter plugin. Flutter package to dynamically translate your app. This plugin will AUTOMATICALLY detect the app Localization

Matteo Sipione 5 Jan 27, 2022
Masked text field - A flutter package for masked text field for formet your text and good UI

Masked Text Field Masked Text Field Features A package for masked text field for

Alok Dubey 7 Sep 4, 2022
Text analyzer that extracts tokens from text for use in full-text search queries and indexes.

Tokenize text, compute document readbility and compare terms in Natural Language Processing. THIS PACKAGE IS PRE-RELEASE, and SUBJECT TO DAILY BREAKIN

GM Consult Pty Ltd 5 Dec 12, 2022
Plugin that allow Flutter to communicate with a native WebView.

interactive_webview Plugin that allow Flutter to communicate with a native WebView. Warning: This is not a display WebView. This plugin is designed to

Duy Duong 46 Dec 15, 2022
Sink - Verify that you're spending more than you can afford

Sink Sink is an app that allows you to track your income and expenses. Current Status Usable Visually bearable Unusable Local App Setup While working

Simonas Viliūnas 85 Jan 3, 2023
Polymaker is an application that can create polygon locations dynamically in mobile apps and save the data into SQFlite to be permanent.

Polymaker Polymaker is an application that can create polygon locations dynamically in mobile apps and save the data into SQFlite to be permanent. Ins

Yusril Rapsanjani 15 Apr 17, 2022
Dynamically themed Music Player built with flutter

?? Flutter Music Player Contact me email: [email protected] Gitter: https://gitter.im/Moda20TuneIn/community Thank you in advance ?? Getting Started

null 135 Dec 31, 2022
A Flutter package used to update widget tree dynamically

简体中文|English Fair is a lightweight package for Flutter, which can be used to update widget tree and state dynamically. This package is still at an ear

Wuba 1.8k Dec 30, 2022
Flutter dynamically load translation in your app.

Flutter dynamically load translation in your app.

null 1 Apr 4, 2022
Tool made in Dart that allows you to dynamically generate JSON files from data models written in Dart.

Dart JSON Generator Versión v1.1.1 Dart JSON Generator es una herramienta que permite generar archivos JSON a partir de mapas como modelos de datos en

Joinner Medina 7 Nov 23, 2022
Now UI Flutter is a fully coded app template built for Flutter which will allow you to create powerful and beautiful e-commerce mobile applications

Now UI Flutter is a fully coded app template built for Flutter which will allow you to create powerful and beautiful e-commerce mobile applications. We have redesigned all the usual components to make it look like our Now UI Design, minimalistic and easy to use.

null 12 Oct 9, 2022
Leverages libphonenumber to allow for asynchronous and synchronous formatting of phone numbers in Flutter apps

Leverages libphonenumber to allow for asynchronous and synchronous formatting of phone numbers in Flutter apps. Includes a TextInputFormatter to allow real-time AsYouType formatting.

Bottlepay 43 Nov 2, 2022
Flutter application for latest news by top newspapers . And allow for share articles with friends. Now available in night mode. Also landscape mode is available

Breaking News Latest news for almost 55 country. Feature of saving article and search ariticles. Used API https://newsapi.org/ Note: if data is not ge

null 7 Oct 24, 2022
Flutter package for Android and iOS allow you to show a wide range of hyperlinks either in the input field or in an article view

Tagtly package help you to detect a lot of hyperlink text such as.. email, url, social media tags, hashtag and more either when user type in text field or when appear a text read only.

Mohamed Nasr 4 Jul 25, 2022
A Flutter package that extends IndexedStack to allow for lazy loading.

lazy_load_indexed_stack A package that extends IndexedStack to allow for lazy loading. Motivation If you use the IndexedStack with bottom navigation,

Ryotaro Oka 18 Dec 16, 2022