jonataslaw / readmore

A Flutter plugin than allow expand and collapse text dynamically
MIT License
257 stars 79 forks source link

Default text style for colorClickableText #35

Closed takinok closed 6 months ago

takinok commented 2 years ago

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);