Skip to content

Commit d342cbe

Browse files
committed
feat(learning_pages_build): add WordCard overview page
完成了单词总览界面的基本实现 Signed-off-by: OctagonalStar <[email protected]>
1 parent 81a7eeb commit d342cbe

File tree

3 files changed

+86
-29
lines changed

3 files changed

+86
-29
lines changed

lib/funcs/ui.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ class WordCard extends StatelessWidget {
464464
style: ElevatedButton.styleFrom(
465465
fixedSize: Size(width ?? (mediaQuery.size.width * 0.9), height == null ? (mediaQuery.size.height * 0.3) : height! * 0.6),
466466
backgroundColor: Colors.transparent,
467+
shadowColor: Colors.transparent,
467468
shape: RoundedRectangleBorder(borderRadius: BorderRadiusGeometry.vertical(bottom: Radius.circular(25.0)))
468469
),
469470
onPressed: (){

lib/pages/learning_page.dart

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,62 @@ class LearningPage extends StatelessWidget {
1717
child: Column(
1818
mainAxisAlignment: MainAxisAlignment.start,
1919
children: [
20-
ElevatedButton(
21-
style: ElevatedButton.styleFrom(
22-
backgroundColor: Theme.of(context).colorScheme.onPrimary.withAlpha(150),
23-
shadowColor: Colors.transparent,
24-
fixedSize: Size(mediaQuery.size.width * 0.9, mediaQuery.size.height * 0.2),
25-
shape: RoundedRectangleBorder(
26-
borderRadius: BorderRadiusGeometry.vertical(bottom: Radius.circular(25.0)),
27-
),
28-
),
29-
onPressed: () {
30-
shiftToStudy(context, 0);
31-
},
32-
child: Container(
33-
width: mediaQuery.size.width * 0.9,
34-
height: mediaQuery.size.height * 0.2,
35-
alignment: Alignment.center,
36-
child: Column(
37-
mainAxisAlignment: MainAxisAlignment.center,
38-
children: [
39-
Icon(Icons.sync_alt, size: 24.0),
40-
Text(
41-
'中阿混合学习',
42-
style: TextStyle(fontSize: 40.0, fontWeight: FontWeight.bold),
20+
Row(
21+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
22+
children: [
23+
ElevatedButton(
24+
style: ElevatedButton.styleFrom(
25+
backgroundColor: Theme.of(context).colorScheme.onPrimary.withAlpha(150),
26+
shadowColor: Colors.transparent,
27+
fixedSize: Size(mediaQuery.size.width * 0.5, mediaQuery.size.height * 0.2),
28+
shape: RoundedRectangleBorder(
29+
borderRadius: BorderRadiusGeometry.vertical(bottom: Radius.circular(25.0)),
4330
),
44-
SizedBox(height: mediaQuery.size.height * 0.01),
45-
Text(
46-
'还有${(context.read<Global>().wordCount - context.read<Global>().settingData["learning"]["KnownWords"].length).toString()}个单词待学习~',
47-
style: TextStyle(fontSize: 12.0),
31+
),
32+
onPressed: () {
33+
shiftToStudy(context, 0);
34+
},
35+
child: FittedBox(
36+
child: Column(
37+
mainAxisAlignment: MainAxisAlignment.center,
38+
children: [
39+
Icon(Icons.sync_alt, size: 24.0),
40+
Text(
41+
'中阿混合学习',
42+
style: TextStyle(fontSize: 40.0, fontWeight: FontWeight.bold),
43+
),
44+
],
4845
),
49-
],
46+
),
5047
),
51-
),
48+
ElevatedButton(
49+
style: ElevatedButton.styleFrom(
50+
backgroundColor: Theme.of(context).colorScheme.onPrimary.withAlpha(150),
51+
shadowColor: Colors.transparent,
52+
fixedSize: Size(mediaQuery.size.width * 0.4, mediaQuery.size.height * 0.2),
53+
shape: RoundedRectangleBorder(
54+
borderRadius: BorderRadiusGeometry.vertical(bottom: Radius.circular(25.0)),
55+
),
56+
),
57+
onPressed: (){
58+
Navigator.push(
59+
context,
60+
MaterialPageRoute(
61+
builder: (context) => WordCardOverViewPage()
62+
)
63+
);
64+
},
65+
child: FittedBox(
66+
child: Column(
67+
mainAxisAlignment: MainAxisAlignment.center,
68+
children: [
69+
Icon(Icons.abc, size: 24),
70+
Text("词汇总览", style: TextStyle(fontSize: 40.0, fontWeight: FontWeight.bold)),
71+
],
72+
),
73+
),
74+
)
75+
],
5276
),
5377
SizedBox(height: mediaQuery.size.height * 0.01),
5478
Row(

lib/sub_pages_builder/learning_pages/learning_pages_build.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,4 +559,36 @@ class _ConcludePageState extends State<ConcludePage> {
559559
),
560560
);
561561
}
562+
}
563+
564+
class WordCardOverViewPage extends StatefulWidget {
565+
const WordCardOverViewPage({super.key});
566+
567+
@override
568+
State<StatefulWidget> createState() => _WordCardOverViewPage();
569+
}
570+
571+
class _WordCardOverViewPage extends State<WordCardOverViewPage> {
572+
573+
@override
574+
Widget build(BuildContext context) {
575+
MediaQueryData mediaQuery = MediaQuery.of(context);
576+
return Scaffold(
577+
appBar: AppBar(
578+
title: Text("单词总览"),
579+
),
580+
body: GridView.builder(
581+
itemCount: context.read<Global>().wordData["Words"].length,
582+
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
583+
itemBuilder: (context, index) {
584+
return WordCard(
585+
word: context.read<Global>().wordData["Words"][index],
586+
useMask: false,
587+
height: mediaQuery.size.height * 0.4,
588+
);
589+
}
590+
),
591+
);
592+
593+
}
562594
}

0 commit comments

Comments
 (0)