You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should jump to a particular item based on the index of the item builder
Actual results:
Jumps on the item considering item builder + separator builder index
More Information:
if I want to navigate on the specific item of the item builder I will have to pass index * 2 to reveal it. For example, if I want to jump to 2nd item of my data list, then I would need to pass 4 as index instead of 2 due to the addition/consideration of separators in between.
Code Sample:
import 'package:flutter/material.dart';
import 'package:super_sliver_list/super_sliver_list.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
static const dummyText =
"""Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc gravida eros eu massa porttitor maximus. Donec vestibulum iaculis justo, a convallis purus pharetra vel. Aliquam finibus ex vitae quam molestie, sit amet suscipit dui blandit. Vivamus mattis vitae lectus quis tristique. Suspendisse et consectetur tortor. Duis accumsan ut massa quis iaculis. Aliquam vestibulum, tellus in accumsan congue, sem lacus lobortis augue, sed venenatis risus enim et arcu. Sed non rhoncus felis.
Phasellus id pretium turpis. Donec et pellentesque urna, mattis facilisis turpis. Nullam sit amet suscipit tortor. Sed ut elit neque. Cras euismod euismod arcu lacinia commodo. In id enim non justo blandit consequat. Nullam quis mattis orci, vitae vulputate sem. Nam interdum lectus ac lorem rutrum, in tristique lectus pellentesque.
""";
final listController = ListController();
final scrollController = ScrollController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('Super Sliver List Demo'),
),
body: SuperListView.separated(
itemCount: 100,
controller: scrollController,
listController: listController,
itemBuilder: (_, index) => RichText(
text: TextSpan(
text: '$index \n',
children: const [
TextSpan(
text: dummyText,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.black,
),
),
],
style: const TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
separatorBuilder: (_, __) => const Divider(),
),
floatingActionButton: FloatingActionButton(
onPressed: () => listController.jumpToItem(
index: 50,
scrollController: scrollController,
alignment: 0.5,
),
child: const Icon(Icons.arrow_downward),
),
);
}
}
Steps to reproduce:
SuperListView.separated
jumpToItem
oranimateToItem
functionExpected results:
Actual results:
More Information:
Code Sample:
Screenshots or Video:
Simulator.Screen.Recording.-.iPhone.15.-.2024-11-14.at.15.21.50.mp4
The text was updated successfully, but these errors were encountered: