ReadMoreLess constructor
const
ReadMoreLess({
- required String text,
- String? readLessText,
- String? readMoreText,
- Duration animationDuration = const Duration(milliseconds: 200),
- double collapsedHeight = 70,
- int maxLines = 4,
- TextStyle? textStyle,
- TextAlign textAlign = TextAlign.center,
- Widget? iconCollapsed,
- Widget? iconExpanded,
- Widget customButtonBuilder(
- bool isCollapsed,
- VoidCallback onPressed
- Color iconColor = Colors.black,
- TextStyle? buttonTextStyle,
- 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',
);