Skip to content

Commit 5ce06c2

Browse files
committed
Do NOT pop When I AM DOING LISTING TEST
1 parent 04e2f71 commit 5ce06c2

File tree

1 file changed

+54
-50
lines changed

1 file changed

+54
-50
lines changed

lib/sub_pages_builder/test_pages/listening_test_page.dart

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -310,59 +310,63 @@ class _MainListeningPageState extends State<MainListeningPage> {
310310
)
311311
);
312312
}
313-
return Scaffold(
314-
appBar: AppBar(
315-
automaticallyImplyLeading: false,
316-
title: TweenAnimationBuilder<double>(
317-
tween: Tween(
318-
begin: 0.0,
319-
end: index/(widget.words.length * widget.playTimes),
313+
return PopScope(
314+
canPop: false,
315+
onPopInvokedWithResult: (didPop, result) {},
316+
child: Scaffold(
317+
appBar: AppBar(
318+
automaticallyImplyLeading: false,
319+
title: TweenAnimationBuilder<double>(
320+
tween: Tween(
321+
begin: 0.0,
322+
end: index/(widget.words.length * widget.playTimes),
323+
),
324+
duration: Duration(seconds: 1),
325+
builder: (context, value, child) {
326+
return LinearProgressIndicator(
327+
borderRadius: StaticsVar.br,
328+
minHeight: 25.0,
329+
value: value,
330+
);
331+
},
320332
),
321-
duration: Duration(seconds: 1),
322-
builder: (context, value, child) {
323-
return LinearProgressIndicator(
324-
borderRadius: StaticsVar.br,
325-
minHeight: 25.0,
326-
value: value,
327-
);
328-
},
329333
),
330-
),
331-
body: Center(
332-
child: Column(
333-
mainAxisAlignment: MainAxisAlignment.center,
334-
crossAxisAlignment: CrossAxisAlignment.center,
335-
children: [
336-
TextContainer(text: "当前播放数/总数: $index/${(widget.words.length * widget.playTimes)}",textAlign: TextAlign.center,),
337-
TextContainer(text: state, style: TextStyle(fontSize: 32.0), size: Size(mediaQuery.size.width * 0.8, mediaQuery.size.height * 0.4),textAlign: TextAlign.center,),
338-
TextContainer(text: counter, style: TextStyle(fontSize: 36.0, color: Colors.redAccent), size: Size(mediaQuery.size.width * 0.6, mediaQuery.size.height * 0.1),textAlign: TextAlign.center,),
339-
ElevatedButton.icon(
340-
icon: Icon(stage == 1 ? Icons.flag : Icons.play_arrow, size: 32.0,),
341-
label: Text(stage == 1 ? "标记当前单词" : (stage == 2 ? "查看答案" : "开始听写(20秒倒计时)")),
342-
style: ElevatedButton.styleFrom(
343-
padding: EdgeInsets.all(16.0),
344-
fixedSize: Size.fromHeight(mediaQuery.size.height * 0.15),
345-
shape: RoundedRectangleBorder(
346-
borderRadius: StaticsVar.br,
334+
body: Center(
335+
child: Column(
336+
mainAxisAlignment: MainAxisAlignment.center,
337+
crossAxisAlignment: CrossAxisAlignment.center,
338+
children: [
339+
TextContainer(text: "当前播放数/总数: $index/${(widget.words.length * widget.playTimes)}",textAlign: TextAlign.center,),
340+
TextContainer(text: state, style: TextStyle(fontSize: 32.0), size: Size(mediaQuery.size.width * 0.8, mediaQuery.size.height * 0.4),textAlign: TextAlign.center,),
341+
TextContainer(text: counter, style: TextStyle(fontSize: 36.0, color: Colors.redAccent), size: Size(mediaQuery.size.width * 0.6, mediaQuery.size.height * 0.1),textAlign: TextAlign.center,),
342+
ElevatedButton.icon(
343+
icon: Icon(stage == 1 ? Icons.flag : Icons.play_arrow, size: 32.0,),
344+
label: Text(stage == 1 ? "标记当前单词" : (stage == 2 ? "查看答案" : "开始听写(20秒倒计时)")),
345+
style: ElevatedButton.styleFrom(
346+
padding: EdgeInsets.all(16.0),
347+
fixedSize: Size.fromHeight(mediaQuery.size.height * 0.15),
348+
shape: RoundedRectangleBorder(
349+
borderRadius: StaticsVar.br,
350+
),
347351
),
348-
),
349-
onPressed: (){
350-
if(stage == 1) {
351-
marks.add((index / widget.playTimes).ceil());
352-
} else if(stage == 2) {
353-
setState(() {
354-
stage = 3;
355-
});
356-
} else {
357-
setState(() {
358-
stage++;
359-
});
360-
circlePlay(context);
361-
}
362-
})
363-
],
364-
),
365-
)
352+
onPressed: (){
353+
if(stage == 1) {
354+
marks.add((index / widget.playTimes).ceil());
355+
} else if(stage == 2) {
356+
setState(() {
357+
stage = 3;
358+
});
359+
} else {
360+
setState(() {
361+
stage++;
362+
});
363+
circlePlay(context);
364+
}
365+
})
366+
],
367+
),
368+
)
369+
),
366370
);
367371
}
368372

0 commit comments

Comments
 (0)