Open MOhsain opened 9 hours ago
Here is my code, you can try it at your end too.
class ProfileScreen extends StatefulWidget { const ProfileScreen({super.key});
@override
State
class _ProfileScreenState extends State
@override Widget build(BuildContext context) { // return Scaffold( // body: SafeArea( // child: Column( // children: [ // HeaderWidget( // title: "Profile", // onBackPress: (){ // Get.back(); // }, // ) // ], // )), // ); return Scaffold( body: SafeArea( child: Column( children: [ HeaderWidget( title: "Profile", onBackPress: () { Get.back(); }, ), Expanded( child: ListView.builder( itemCount: 200, itemBuilder: (BuildContext context, int index) { //return Text("df"); return Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Align( alignment: Alignment.topLeft, child: ReadMoreText( "$index / Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...Automatically load more items when the user scrolls to the bottom of the list. In order to achieve this, we need to use NotificationListener<ScrollNotification ...", textAlign: TextAlign.start, trimMode: TrimMode.Line, trimLines: 3, colorClickableText: AppColors.themeColor, trimCollapsedText: 'Read more', trimExpandedText: 'Read less', style: const TextStyle( overflow: TextOverflow.ellipsis, color: AppColors.primaryTextColor, fontWeight: FontWeight.w400, fontFamily: AppStrings.inter, fontSize: 14), moreStyle: moreLessStyle, lessStyle: moreLessStyle, ), ), Divider() ], ), ); }, ), ), ], )), ); } }
I have a readMore widget in the listview. I have a long text. When i click on it expanded. And scroll to bottom and read all the text. Now when i click on read less, The text is collapse. But now my current listview index is 7, 8. It should be on the place item where i click on read more or read less.