mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-09-25 16:30:03 +00:00
fix(mobile): lost initial scroll position on empty ai chat page (#6895)
This commit is contained in:
parent
81960a7f05
commit
0cba3f9e3f
@ -180,7 +180,7 @@ class WelcomeSampleQuestion extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _AutoScrollingSampleQuestions extends StatelessWidget {
|
||||
class _AutoScrollingSampleQuestions extends StatefulWidget {
|
||||
const _AutoScrollingSampleQuestions({
|
||||
super.key,
|
||||
required this.questions,
|
||||
@ -194,17 +194,29 @@ class _AutoScrollingSampleQuestions extends StatelessWidget {
|
||||
final double offset;
|
||||
final bool reverse;
|
||||
|
||||
@override
|
||||
State<_AutoScrollingSampleQuestions> createState() =>
|
||||
_AutoScrollingSampleQuestionsState();
|
||||
}
|
||||
|
||||
class _AutoScrollingSampleQuestionsState
|
||||
extends State<_AutoScrollingSampleQuestions> {
|
||||
late final scrollController = ScrollController(
|
||||
initialScrollOffset: widget.offset,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 36,
|
||||
child: InfiniteScrollView(
|
||||
scrollController: scrollController,
|
||||
centerKey: UniqueKey(),
|
||||
itemCount: questions.length,
|
||||
itemCount: widget.questions.length,
|
||||
itemBuilder: (context, index) {
|
||||
return WelcomeSampleQuestion(
|
||||
question: questions[index],
|
||||
onSelected: onSelected,
|
||||
question: widget.questions[index],
|
||||
onSelected: widget.onSelected,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => const HSpace(8),
|
||||
|
Loading…
x
Reference in New Issue
Block a user