Skip to content

Commit b06327a

Browse files
committed
feat(wordcardOverview): improve scorll logic
Signed-off-by: OctagonalStar <[email protected]>
1 parent b85c1de commit b06327a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

lib/sub_pages_builder/learning_pages/learning_pages_build.dart

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ class _WordCardOverViewPage extends State<WordCardOverViewPage> {
616616
if(classIndex == context.read<Global>().wordData["Classes"][jsonName].length) {
617617
return SizedBox(height: mediaQuery.size.height); // 避免0.9空间估计不足
618618
}
619-
620619
final String className = context.read<Global>().wordData["Classes"][jsonName].keys.elementAt(classIndex);
621620
return ExpansionTile(
622621
title: Text(className.trim()),
@@ -625,11 +624,24 @@ class _WordCardOverViewPage extends State<WordCardOverViewPage> {
625624
setState(() {
626625
allowClassScorll = !value;
627626
});
628-
classController.animateTo(
629-
(64 * classIndex).toDouble(),
630-
duration: Duration(milliseconds: 200),
631-
curve: StaticsVar.curve
632-
);
627+
if(value) {
628+
classController.animateTo(
629+
(64 * classIndex).toDouble(),
630+
duration: Duration(milliseconds: 200),
631+
curve: StaticsVar.curve
632+
);
633+
jsonController.animateTo(
634+
(66 * (jsonIndex + 1)).toDouble(),
635+
duration: Duration(milliseconds: 200),
636+
curve: StaticsVar.curve
637+
);
638+
} else {
639+
jsonController.animateTo(
640+
(66 * jsonIndex).toDouble(),
641+
duration: Duration(milliseconds: 200),
642+
curve: StaticsVar.curve
643+
);
644+
}
633645
},
634646
children: [
635647
SizedBox(

0 commit comments

Comments
 (0)