read_more_text_plus 1.0.0
read_more_text_plus: ^1.0.0 copied to clipboard
A Flutter package for displaying expandable text with "Read more" and "Read less" toggles.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:readmoretext/read_more_text_plus.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Read More Text ',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
),
home: Demo(),
);
}
}
class Demo extends StatefulWidget {
const Demo({super.key});
@override
State<Demo> createState() => _DemoState();
}
class _DemoState extends State<Demo> {
var showReadMore = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Read More Example')),
body: Padding(
padding: const EdgeInsets.all(18.0),
child: Center(
child: ReadMoreTextWidget(
message:
'Flutter is Google’s UI toolkit for building beautiful, '
'natively compiled applications for mobile, web, and desktop from a single codebase. '
'It is fast, productive, and flexible, allowing developers to create '
'high-performance apps with expressive and flexible designs. '
'With Flutter, you can build apps for iOS, Android, Windows, Mac, Linux, '
'and the web using the same codebase. It features a rich set of pre-designed widgets, '
'hot reload for quick development cycles, and a strong community that contributes '
'to a growing ecosystem of packages and plugins.',
onChange: () {
setState(() {
showReadMore = !showReadMore;
});
},
charCount: 50,
isReadMore: showReadMore,
),
),
),
);
}
}