Skip to content

Commit d9da900

Browse files
Merge pull request #59 from OctagonalStar/dev
fix: progress not currect
2 parents 818b1f1 + fe37319 commit d9da900

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

lib/sub_pages_builder/learning_pages/learning_pages_build.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class _InLearningPageState extends State<InLearningPage> {
9393
child: Scaffold(
9494
appBar: AppBar(
9595
automaticallyImplyLeading: false,
96-
title: (((controller.hasClients ? controller.page : 0) ?? 0)+1) >= testList.length ? Center(child: Text("学习完成"))
96+
title: (((controller.hasClients ? controller.page?.ceil() : 0) ?? 0)+1) >= testList.length ? Center(child: Text("学习完成"))
9797
: Row(
9898
children: [
9999
ElevatedButton(
@@ -135,7 +135,7 @@ class _InLearningPageState extends State<InLearningPage> {
135135
child: TweenAnimationBuilder<double>(
136136
tween: Tween<double>(
137137
begin: 0.00,
138-
end: ((controller.hasClients ? controller.page : 0) ?? 0) / (testList.length - 1),
138+
end: ((controller.hasClients ? controller.page?.ceil() : 0) ?? 0) / (testList.length - 1),
139139
),
140140
duration: const Duration(milliseconds: 500),
141141
curve: StaticsVar.curve,
@@ -154,7 +154,7 @@ class _InLearningPageState extends State<InLearningPage> {
154154
width: mediaQuery.size.width * 0.05,
155155
child: FittedBox(
156156
fit: BoxFit.scaleDown,
157-
child: Text("${testList.length - ((controller.hasClients ? controller.page?.round() : 0) ?? 0) - 1}"),
157+
child: Text("${testList.length - ((controller.hasClients ? controller.page?.ceil() : 0) ?? 0) - 1}"),
158158
),
159159
)
160160
],
@@ -189,9 +189,9 @@ class _InLearningPageState extends State<InLearningPage> {
189189
shape: RoundedRectangleBorder(borderRadius: StaticsVar.br)
190190
),
191191
onPressed: (){
192+
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
192193
setState(() {
193194
correctCount++;
194-
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
195195
});
196196

197197
},
@@ -221,11 +221,11 @@ class _InLearningPageState extends State<InLearningPage> {
221221
hint: testItem[1] == 1 ? "通过中文选择阿拉伯语" : "通过阿拉伯语选择中文",
222222
bottomWidget: BottomTip(
223223
isShowNext: clicked,
224-
isLast: controller.page?.round() == testList.length - 1,
224+
isLast: controller.page?.ceil() == testList.length - 1,
225225
onNextClicked: (){
226+
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
226227
setState(() {
227228
clicked = false;
228-
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
229229
});
230230
},
231231
onTipClicked: (){
@@ -252,11 +252,11 @@ class _InLearningPageState extends State<InLearningPage> {
252252
},
253253
bottomWidget: BottomTip(
254254
isShowNext: clicked,
255-
isLast: controller.page?.round() == testList.length - 1,
255+
isLast: controller.page?.ceil() == testList.length - 1,
256256
onNextClicked: (){
257+
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
257258
setState(() {
258259
clicked = false;
259-
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
260260
});
261261
},
262262
onTipClicked: (){
@@ -274,7 +274,6 @@ class _InLearningPageState extends State<InLearningPage> {
274274
setState(() {
275275
testList.removeWhere((List wtestItem) => (wtestItem[1] == 4 && index < testList.indexOf(wtestItem)));
276276
clicked = true;
277-
testList.length = testList.length;
278277
});
279278
return false;
280279
}
@@ -293,11 +292,11 @@ class _InLearningPageState extends State<InLearningPage> {
293292
hint: "听下面的音频,选择最合适的选项",
294293
bottom: BottomTip(
295294
isShowNext: clicked,
296-
isLast: controller.page?.round() == testList.length - 1,
295+
isLast: controller.page?.ceil() == testList.length - 1,
297296
onNextClicked: (){
297+
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
298298
setState(() {
299299
clicked = false;
300-
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
301300
});
302301
},
303302
onTipClicked: (){

0 commit comments

Comments
 (0)