mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-09-27 01:10:13 +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({
|
const _AutoScrollingSampleQuestions({
|
||||||
super.key,
|
super.key,
|
||||||
required this.questions,
|
required this.questions,
|
||||||
@ -194,17 +194,29 @@ class _AutoScrollingSampleQuestions extends StatelessWidget {
|
|||||||
final double offset;
|
final double offset;
|
||||||
final bool reverse;
|
final bool reverse;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_AutoScrollingSampleQuestions> createState() =>
|
||||||
|
_AutoScrollingSampleQuestionsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AutoScrollingSampleQuestionsState
|
||||||
|
extends State<_AutoScrollingSampleQuestions> {
|
||||||
|
late final scrollController = ScrollController(
|
||||||
|
initialScrollOffset: widget.offset,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 36,
|
height: 36,
|
||||||
child: InfiniteScrollView(
|
child: InfiniteScrollView(
|
||||||
|
scrollController: scrollController,
|
||||||
centerKey: UniqueKey(),
|
centerKey: UniqueKey(),
|
||||||
itemCount: questions.length,
|
itemCount: widget.questions.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return WelcomeSampleQuestion(
|
return WelcomeSampleQuestion(
|
||||||
question: questions[index],
|
question: widget.questions[index],
|
||||||
onSelected: onSelected,
|
onSelected: widget.onSelected,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) => const HSpace(8),
|
separatorBuilder: (context, index) => const HSpace(8),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user