@@ -16,133 +16,127 @@ class HomePage extends StatelessWidget {
1616 context.read <Global >().uiLogger.fine ("构建 HomePage" );
1717 final themeColor = Theme .of (context).colorScheme;
1818 final mediaQuery = MediaQuery .of (context);
19- final FSRS fsrs = FSRS ();
20-
21- return FutureBuilder (
22- future: fsrs.init (context: context),
23- builder: (context, asyncSnapshot) {
24- return Column (
19+ final FSRS fsrs = FSRS ()..init (outerPrefs: context.read <Global >().prefs);
20+ return Column (
21+ children: [
22+ DailyWord (),
23+ SizedBox (height: mediaQuery.size.height * 0.01 ),
24+ Row (
25+ mainAxisAlignment: MainAxisAlignment .spaceEvenly,
2526 children: [
26- DailyWord (),
27- SizedBox (height: mediaQuery.size.height * 0.01 ),
28- Row (
29- mainAxisAlignment: MainAxisAlignment .spaceEvenly,
30- children: [
31- Container (
32- width: mediaQuery.size.width * 0.30 ,
33- height: mediaQuery.size.height * 0.18 ,
34- margin: EdgeInsets .all (4.0 ),
35- padding: EdgeInsets .all (16.0 ),
36- decoration: BoxDecoration (
37- color: themeColor.secondaryContainer.withAlpha (150 ),
38- boxShadow: [
39- BoxShadow (
40- color: themeColor.surfaceBright.withAlpha (150 ),
41- offset: Offset (2 , 4 ),
42- blurRadius: 8.0 ,
43- ),
44- ],
45- borderRadius: StaticsVar .br,
46- ),
47- child: Column (
48- children: [
49- Row (
50- crossAxisAlignment: CrossAxisAlignment .center,
51- mainAxisAlignment: MainAxisAlignment .center,
52- children: [
53- Text ('连胜天数' , style: TextStyle (fontSize: 12.0 )),
54- context.read <Global >().settingData["learning" ]["lastDate" ] == DateTime .now ().difference (DateTime (2025 , 11 , 1 )).inDays
55- ? Icon (Icons .done, size: 15.0 , color: Colors .tealAccent)
56- : Icon (Icons .error_outline, size: 15.0 , color: Colors .amber, semanticLabel: "今天还没学习~" ),
57- ],
58- ),
59- SizedBox (height: mediaQuery.size.height * 0.03 ),
60- Text (getStrokeDays (context.read <Global >().settingData).toString (), style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold)),
61- ],
62- ),
63- ),
64- Container (
65- width: mediaQuery.size.width * 0.50 ,
66- height: mediaQuery.size.height * 0.18 ,
67- margin: EdgeInsets .all (4.0 ),
68- padding: EdgeInsets .all (16.0 ),
69- decoration: BoxDecoration (
70- color: themeColor.secondaryContainer.withAlpha (150 ),
71- boxShadow: [
72- BoxShadow (
73- color: themeColor.surfaceBright.withAlpha (150 ),
74- offset: Offset (2 , 4 ),
75- blurRadius: 8.0 ,
76- ),
77- ],
78- borderRadius: BorderRadius .circular (25.0 ),
27+ Container (
28+ width: mediaQuery.size.width * 0.30 ,
29+ height: mediaQuery.size.height * 0.18 ,
30+ margin: EdgeInsets .all (4.0 ),
31+ padding: EdgeInsets .all (16.0 ),
32+ decoration: BoxDecoration (
33+ color: themeColor.secondaryContainer.withAlpha (150 ),
34+ boxShadow: [
35+ BoxShadow (
36+ color: themeColor.surfaceBright.withAlpha (150 ),
37+ offset: Offset (2 , 4 ),
38+ blurRadius: 8.0 ,
7939 ),
80- child: Column (
40+ ],
41+ borderRadius: StaticsVar .br,
42+ ),
43+ child: Column (
44+ children: [
45+ Row (
46+ crossAxisAlignment: CrossAxisAlignment .center,
47+ mainAxisAlignment: MainAxisAlignment .center,
8148 children: [
82- Text ('已学词汇' , style: TextStyle (fontSize: 12.0 )),
83- SizedBox (height: mediaQuery.size.height * 0.03 ),
84- Text (context.read <Global >().settingData["learning" ]["KnownWords" ].length.toString (), style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold)),
49+ Text ('连胜天数' , style: TextStyle (fontSize: 12.0 )),
50+ context.read <Global >().settingData["learning" ]["lastDate" ] == DateTime .now ().difference (DateTime (2025 , 11 , 1 )).inDays
51+ ? Icon (Icons .done, size: 15.0 , color: Colors .tealAccent)
52+ : Icon (Icons .error_outline, size: 15.0 , color: Colors .amber, semanticLabel: "今天还没学习~" ),
8553 ],
8654 ),
87- ),
88- ],
55+ SizedBox (height: mediaQuery.size.height * 0.03 ),
56+ Text (getStrokeDays (context.read <Global >().settingData).toString (), style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold)),
57+ ],
58+ ),
8959 ),
90- Row (
91- mainAxisAlignment: MainAxisAlignment .spaceEvenly,
92- children: [
93- Container (
94- width: mediaQuery.size.width * 0.50 ,
95- height: mediaQuery.size.height * 0.18 ,
96- margin: EdgeInsets .all (4.0 ),
97- padding: EdgeInsets .all (16.0 ),
98- decoration: BoxDecoration (
99- color: themeColor.secondaryContainer.withAlpha (150 ),
100- boxShadow: [
101- BoxShadow (
102- color: themeColor.surfaceBright.withAlpha (150 ),
103- offset: Offset (2 , 4 ),
104- blurRadius: 8.0 ,
105- ),
106- ],
107- borderRadius: BorderRadius .circular (25.0 ),
108- ),
109- child: Column (
110- children: [
111- Text ('规律性学习' , style: TextStyle (fontSize: 12.0 )),
112- SizedBox (height: mediaQuery.size.height * 0.03 ),
113- asyncSnapshot.hasData ? Text (asyncSnapshot.data?? false ? "${fsrs .getWillDueCount ().toString ()}个待复习" : "未启用" , style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold)) : CircularProgressIndicator (),
114- ],
60+ Container (
61+ width: mediaQuery.size.width * 0.50 ,
62+ height: mediaQuery.size.height * 0.18 ,
63+ margin: EdgeInsets .all (4.0 ),
64+ padding: EdgeInsets .all (16.0 ),
65+ decoration: BoxDecoration (
66+ color: themeColor.secondaryContainer.withAlpha (150 ),
67+ boxShadow: [
68+ BoxShadow (
69+ color: themeColor.surfaceBright.withAlpha (150 ),
70+ offset: Offset (2 , 4 ),
71+ blurRadius: 8.0 ,
11572 ),
116- ),
117- Container (
118- width: mediaQuery.size.width * 0.30 ,
119- height: mediaQuery.size.height * 0.18 ,
120- margin: EdgeInsets .all (4.0 ),
121- padding: EdgeInsets .all (16.0 ),
122- decoration: BoxDecoration (
123- color: themeColor.secondaryContainer.withAlpha (150 ),
124- boxShadow: [
125- BoxShadow (
126- color: themeColor.surfaceBright.withAlpha (150 ),
127- offset: Offset (2 , 4 ),
128- blurRadius: 8.0 ,
129- ),
130- ],
131- borderRadius: StaticsVar .br,
73+ ],
74+ borderRadius: BorderRadius .circular (25.0 ),
75+ ),
76+ child: Column (
77+ children: [
78+ Text ('已学词汇' , style: TextStyle (fontSize: 12.0 )),
79+ SizedBox (height: mediaQuery.size.height * 0.03 ),
80+ Text (context.read <Global >().settingData["learning" ]["KnownWords" ].length.toString (), style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold)),
81+ ],
82+ ),
83+ ),
84+ ],
85+ ),
86+ Row (
87+ mainAxisAlignment: MainAxisAlignment .spaceEvenly,
88+ children: [
89+ Container (
90+ width: mediaQuery.size.width * 0.50 ,
91+ height: mediaQuery.size.height * 0.18 ,
92+ margin: EdgeInsets .all (4.0 ),
93+ padding: EdgeInsets .all (16.0 ),
94+ decoration: BoxDecoration (
95+ color: themeColor.secondaryContainer.withAlpha (150 ),
96+ boxShadow: [
97+ BoxShadow (
98+ color: themeColor.surfaceBright.withAlpha (150 ),
99+ offset: Offset (2 , 4 ),
100+ blurRadius: 8.0 ,
132101 ),
133- child: Column (
134- children: [
135- Text ('单词总数' , style: TextStyle (fontSize: 12.0 )),
136- SizedBox (height: mediaQuery.size.height * 0.03 ),
137- Text (context.read <Global >().wordCount.toString (), style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold))
138- ],
102+ ],
103+ borderRadius: BorderRadius .circular (25.0 ),
104+ ),
105+ child: Column (
106+ children: [
107+ Text ('规律性学习' , style: TextStyle (fontSize: 12.0 )),
108+ SizedBox (height: mediaQuery.size.height * 0.03 ),
109+ Text (fsrs.isEnabled () ? "${fsrs .getWillDueCount ().toString ()}个待复习" : "未启用" , style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold)),
110+ ],
111+ ),
112+ ),
113+ Container (
114+ width: mediaQuery.size.width * 0.30 ,
115+ height: mediaQuery.size.height * 0.18 ,
116+ margin: EdgeInsets .all (4.0 ),
117+ padding: EdgeInsets .all (16.0 ),
118+ decoration: BoxDecoration (
119+ color: themeColor.secondaryContainer.withAlpha (150 ),
120+ boxShadow: [
121+ BoxShadow (
122+ color: themeColor.surfaceBright.withAlpha (150 ),
123+ offset: Offset (2 , 4 ),
124+ blurRadius: 8.0 ,
139125 ),
140- ),
141- ]
142- )
143- ],
144- );
145- }
126+ ],
127+ borderRadius: StaticsVar .br,
128+ ),
129+ child: Column (
130+ children: [
131+ Text ('单词总数' , style: TextStyle (fontSize: 12.0 )),
132+ SizedBox (height: mediaQuery.size.height * 0.03 ),
133+ Text (context.read <Global >().wordCount.toString (), style: TextStyle (fontSize: 24.0 , fontWeight: FontWeight .bold))
134+ ],
135+ ),
136+ ),
137+ ]
138+ )
139+ ],
146140 );
147141 }
148142}
0 commit comments