flutter_show_more 1.0.1
flutter_show_more: ^1.0.1 copied to clipboard
Flutter widget for limiting the amount of text to show.
flutter_show_more #
A modern Flutter widget for limiting the amount of text to show, with "show more" and "show less" functionality. Fully compatible with Dart 3, Flutter 3, and strict null safety.
Features #
- Limits text visibility up to a specific character length, using grapheme-aware (
charactersAPI) truncation so emojis aren't split. - Optionally handles "show less" logic.
- Fully customizable styles for text and toggles.
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_show_more: ^1.0.0
Usage #
First, import flutter_show_more:
import 'package:flutter_show_more/flutter_show_more.dart';
Then, use ShowMoreText:
ShowMoreText(
'A very long text string that you want to truncate and allow the user to expand or collapse.',
maxLength: 100,
style: const TextStyle(fontSize: 14, color: Colors.black87),
showMoreText: 'show more',
showMoreStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
),
shouldShowLessText: true,
showLessText: 'show less',
)
Screenshots #