ReadMoreLess constructor

const ReadMoreLess({
  1. required String text,
  2. String? readLessText,
  3. String? readMoreText,
  4. Duration animationDuration = const Duration(milliseconds: 200),
  5. double collapsedHeight = 70,
  6. int maxLines = 4,
  7. TextStyle? textStyle,
  8. TextAlign textAlign = TextAlign.center,
  9. Widget? iconCollapsed,
  10. Widget? iconExpanded,
  11. Widget customButtonBuilder(
    1. bool isCollapsed,
    2. VoidCallback onPressed
    )?,
  12. Color iconColor = Colors.black,
  13. TextStyle? buttonTextStyle,
  14. Key? key,
})

A widget that displays a text that can be expanded or collapsed.

Implementation

const ReadMoreLess({
  required this.text,
  this.readLessText,
  this.readMoreText,
  this.animationDuration = const Duration(milliseconds: 200),
  this.collapsedHeight = 70,
  this.maxLines = 4,
  this.textStyle,
  this.textAlign = TextAlign.center,
  this.iconCollapsed,
  this.iconExpanded,
  this.customButtonBuilder,
  this.iconColor = Colors.black,
  this.buttonTextStyle,
  super.key,
})  : assert(
        (iconCollapsed == null && iconExpanded == null) ||
            customButtonBuilder == null,
        'You cannot use custom icons while using a custom button builder',
      ),
      assert(
        buttonTextStyle == null || customButtonBuilder == null,
        'You cannot use a custom button style while using a custom '
        'button builder',
      ),
      assert(
        (readLessText == null && readMoreText == null) ||
            customButtonBuilder == null,
        'You cannot provide readLess or readMore text when using '
        'a custom button builder',
      );