Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@
### Added

- 添加了联机功能
- 添加了停用FSRS(复习)的选项 [#67](https://github.com/OctagonalStar/arabic_learning/pull/67)

### Improvement

- 优化了单词卡片的排版
- 添加了联机功能对Web的支持
- 优化了单词导入时的去重逻辑 [#67](https://github.com/OctagonalStar/arabic_learning/pull/67)
- 优化复习页面逻辑
- 优化动画流畅性

### Fix

- 修复了自我评级开启时复习页面可能溢出的问题
- 修复了无数据时,从每日单词进入设置发生错误的问题
- 修复了规律学习重复推送同一个单词的问题 [#67](https://github.com/OctagonalStar/arabic_learning/pull/67)
- 修复了新安装无复习任务时 FSRS 设置菜单丢失的问题 [#67](https://github.com/OctagonalStar/arabic_learning/pull/67)
- 修复了单词卡片可能溢出的问题

## v0.1.13 - 2026-2-6 - (000113)

Expand Down
12 changes: 6 additions & 6 deletions lib/funcs/local_pk_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:archive/archive.dart';
import 'package:arabic_learning/funcs/utili.dart';
import 'package:arabic_learning/vars/config_structure.dart';
import 'package:arabic_learning/vars/global.dart';
import 'package:flutter/material.dart' show BuildContext, PageController;
import 'package:flutter/material.dart' show BuildContext, PageController, Durations;
import 'package:logging/logging.dart';
import 'package:arabic_learning/vars/statics_var.dart';
import 'package:flutter/foundation.dart' show ChangeNotifier;
Expand Down Expand Up @@ -222,7 +222,7 @@ class PKServer with ChangeNotifier{

void _questStartTime(){
startTime = DateTime.now().add(Duration(seconds: 5));
Future.delayed(Duration(seconds: 5), () => pageController!.nextPage(duration: Duration(milliseconds: 5), curve: StaticsVar.curve));
Future.delayed(Duration(seconds: 5), () => pageController!.nextPage(duration: Durations.medium2, curve: StaticsVar.curve));
_channel!.send(RTCDataChannelMessage(json.encode({
"step": 4,
"startTime": startTime?.add(delay!).toIso8601String()
Expand Down Expand Up @@ -302,7 +302,7 @@ class PKServer with ChangeNotifier{
if(sumList.contains(source.getHash(global.wordData.words))) selectableSource.add(source);
logger.fine("[$packageid] 计算得到${source.sourceJsonFileName}在哈希中有匹配");
}
pageController!.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
pageController!.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
} else {
logger.warning("[$packageid] 双端没有任意词库匹配");
exitMessage = "双端没有任意词库匹配";
Expand All @@ -328,7 +328,7 @@ class PKServer with ChangeNotifier{
"dictSum": List.generate(selectableSource.length, (int index) => selectableSource[index].getHash(global.wordData.words)),
"time": DateTime.now().toIso8601String()
})));
pageController!.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
pageController!.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
} else {
_channel!.send(RTCDataChannelMessage(json.encode({
"step": 1,
Expand All @@ -352,7 +352,7 @@ class PKServer with ChangeNotifier{
}
}
classSelection = ClassSelection(selectedClass: selectedClass, countInReview: false);
pageController!.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
pageController!.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
break;
}
/// 接受对方完成准备 from both
Expand All @@ -366,7 +366,7 @@ class PKServer with ChangeNotifier{
case 4: {
startTime = DateTime.parse(data["startTime"]);
Future.delayed(-DateTime.now().difference(startTime!),
()=>pageController!.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve));
()=>pageController!.nextPage(duration: Durations.medium2, curve: StaticsVar.curve));
notifyListeners();
break;
}
Expand Down
18 changes: 9 additions & 9 deletions lib/funcs/ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ List<Widget> classesSelectionList(BuildContext context, Function (ClassItem) onC
/// alart(context, "你点击了按钮",onConfirmed: (){i++}, delayConfirm: Duration(seconds: 1));
/// }
/// ```
void alart(BuildContext context, String e, {Function? onConfirmed, Duration delayConfirm = const Duration(milliseconds: 0)}) {
void alart(BuildContext context, String e, {Function? onConfirmed, Duration delayConfirm = const Duration()}) {
context.read<Global>().uiLogger.info("构建弹出窗口: 携带信息: $e ;确认参数: ${onConfirmed != null}; 延迟: ${delayConfirm.inMilliseconds}");
showDialog(
context: context,
Expand Down Expand Up @@ -291,7 +291,7 @@ class TextContainer extends StatelessWidget {
child: (animated)
? TweenAnimationBuilder<double>(
tween: Tween(begin: 0.0, end: text.length.toDouble()),
duration: Duration(milliseconds: 700),
duration: Durations.long4,
curve: StaticsVar.curve,
builder: (context, value, child) {
if(value == text.length.toDouble()) return child!;
Expand Down Expand Up @@ -430,7 +430,7 @@ class _ChooseButtonBoxState extends State<ChooseButtonBox> {
color ??= widget.cl ?? Theme.of(context).colorScheme.primaryContainer.withAlpha(150);
return AnimatedContainer(
margin: EdgeInsets.all(8.0),
duration: Duration(milliseconds: widget.isAnimated ? 500 : 0),
duration: widget.isAnimated ? Durations.medium4 : Duration(),
curve: StaticsVar.curve,
decoration: BoxDecoration(
color: color,
Expand All @@ -442,7 +442,7 @@ class _ChooseButtonBoxState extends State<ChooseButtonBox> {
bool? ans = widget.chose(widget.index);
if(ans != null) {
color = Colors.amber;
Future.delayed(Duration(milliseconds: widget.isAnimated ? 500 : 0), (){
Future.delayed(widget.isAnimated ? Durations.medium4 : Duration(), (){
setState(() {
if(ans) {
color = Colors.greenAccent;
Expand Down Expand Up @@ -560,7 +560,7 @@ class WordCard extends StatelessWidget {
),
child: FittedBox(fit: BoxFit.scaleDown, child: Text("归属课程", style: TextStyle(fontSize: 16))),
),
Expanded(child: Text(word.className, style: TextStyle(fontSize: 18), textAlign: TextAlign.center))
Expanded(child: FittedBox(fit: BoxFit.scaleDown, child: Text(word.className, style: TextStyle(fontSize: 18), textAlign: TextAlign.center)))
],
)
],
Expand All @@ -573,13 +573,13 @@ class WordCard extends StatelessWidget {
begin: 1.0,
end: hide ? 1.0 : 0.0
),
duration: Duration(milliseconds: 500),
duration: Durations.extralong2,
curve: StaticsVar.curve,
builder: (context, value, child) {
return ClipRRect(
borderRadius: BorderRadiusGeometry.vertical(bottom: Radius.circular(25.0)),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10.0 * value,sigmaY: 10.0 * value),
filter: ImageFilter.blur(sigmaX: 15.0 * value,sigmaY: 15.0 * value),
enabled: true,
child: value == 0.0 ? null : ElevatedButton(
style: ElevatedButton.styleFrom(
Expand Down Expand Up @@ -862,7 +862,7 @@ class _ChoiceQuestions extends State<ChoiceQuestions> {
),
SizedBox(height: mediaQuery.size.height *0.01),
if(widget.bottomWidget != null) widget.bottomWidget!,
SizedBox(height: mediaQuery.size.height *0.05),
SizedBox(height: mediaQuery.size.height *0.03),
],
),
),
Expand Down Expand Up @@ -949,7 +949,7 @@ class _SpellQuestion extends State<SpellQuestion> {
begin: Theme.of(context).colorScheme.onPrimaryFixed,
end: isChecked ? cl.withAlpha(180) : Theme.of(context).colorScheme.onPrimaryFixed
),
duration: Duration(milliseconds: 500),
duration: Durations.medium2,
curve: StaticsVar.curve,
builder: (context, value, child) {
return TextField(
Expand Down
5 changes: 2 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
late List<Widget> _pageList;
final PageController _pageController = PageController(initialPage: 0);
static const Duration _duration = Duration(milliseconds: 500);
bool disPlayedFirst = false;

// 判断是否为桌面端的阈值(可根据需要调整)
Expand Down Expand Up @@ -201,7 +200,7 @@ class _MyHomePageState extends State<MyHomePage> {
_onNavigationTapped(index);
},
height: MediaQuery.of(context).size.height * 0.1,
animationDuration: Duration(milliseconds: 500),
animationDuration: Durations.medium2,
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
backgroundColor: Theme.of(context).colorScheme.onPrimary.withAlpha(150),
destinations: const [
Expand Down Expand Up @@ -235,7 +234,7 @@ class _MyHomePageState extends State<MyHomePage> {
void _onNavigationTapped(int index) {
_pageController.animateToPage(
index,
duration: _duration,
duration: Durations.medium2,
curve: StaticsVar.curve,
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class _DailyWord extends State<DailyWord> {
playing = false;
} else {
context.read<Global>().uiLogger.info("跳转: DailyWord => SettingPage");
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SettingPage()));
Navigator.of(context).push(MaterialPageRoute(builder: (context) => Scaffold(appBar: AppBar(title: Text("设置")) , body: SettingPage())));
}
},
style: ElevatedButton.styleFrom(
Expand Down
26 changes: 13 additions & 13 deletions lib/sub_pages_builder/learning_pages/fsrs_pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ class MainFSRSPage extends StatelessWidget {
scrollDirection: Axis.vertical,
controller: controller,
itemBuilder: (context, index) {
final wordID = fsrs.getLeastDueCard();
if(wordID == -1) {
return Center(
child: TextContainer(text: "当前无需要复习的内容\n点击右上角可修改配置"),
);
}
if(index == 0) {
return Center(
child: Column(
Expand All @@ -322,12 +328,6 @@ class MainFSRSPage extends StatelessWidget {
),
);
}
final wordID = fsrs.getLeastDueCard();
if(wordID == -1) {
return Center(
child: TextContainer(text: "今日复习任务已完成\n(或当前无复习内容)\n点击右上角齿轮可修改配置"),
);
}
return FSRSReviewCardPage(wordID: wordID, fsrs: fsrs, rnd: sharedRnd, controller: controller,);
}
)
Expand Down Expand Up @@ -405,7 +405,7 @@ class _FSRSReviewCardPage extends State<FSRSReviewCardPage> {
begin: 0.0,
end: choosed ? 1.0 : 0.0
),
duration: Duration(milliseconds: 500),
duration: Durations.medium2,
curve: StaticsVar.curve,
builder: (context, value, child) {
return Row(
Expand All @@ -432,7 +432,7 @@ class _FSRSReviewCardPage extends State<FSRSReviewCardPage> {
shape: RoundedRectangleBorder(borderRadius: StaticsVar.br)
),
onPressed: () {
widget.controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
widget.controller.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
},
icon: Icon(Icons.arrow_downward),
label: FittedBox(fit: BoxFit.contain, child: Text("下一题")),
Expand Down Expand Up @@ -510,9 +510,9 @@ class _FSRSLearningPageState extends State<FSRSLearningPage> {
label: Text(index == widget.words.length-1 ? "开始答题" : "下一个"),
onPressed: (){
if(index == widget.words.length-1) {
controllerHor.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controllerHor.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
} else {
controllerLearning.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controllerLearning.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
}
},
),
Expand Down Expand Up @@ -557,7 +557,7 @@ class _FSRSLearningPageState extends State<FSRSLearningPage> {
begin: 0.0,
end: corrected ? 1.0 : 0.0
),
duration: Duration(milliseconds: 500),
duration: Durations.medium2,
curve: StaticsVar.curve,
builder: (context, value, child) {
return Row(
Expand All @@ -582,9 +582,9 @@ class _FSRSLearningPageState extends State<FSRSLearningPage> {
),
onPressed: () {
if(index == widget.words.length-1) {
controllerHor.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controllerHor.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
}
controllerQuestions.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controllerQuestions.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
},
icon: Icon(index == widget.words.length-1 ? Icons.done_all : Icons.arrow_downward),
label: FittedBox(child: Text(index == widget.words.length-1 ? "完成学习" : "下一题")),
Expand Down
22 changes: 11 additions & 11 deletions lib/sub_pages_builder/learning_pages/learning_pages_build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class _InLearningPageState extends State<InLearningPage> {
begin: 0.00,
end: ((controller.hasClients ? controller.page?.ceil() : 0) ?? 0) / (testList.length - 1),
),
duration: const Duration(milliseconds: 500),
duration: Durations.extralong4,
curve: StaticsVar.curve,
builder: (context, value, child) {
return LinearProgressIndicator(
Expand Down Expand Up @@ -198,7 +198,7 @@ class _InLearningPageState extends State<InLearningPage> {
shape: RoundedRectangleBorder(borderRadius: StaticsVar.br)
),
onPressed: (){
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controller.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
correctCount++;
setState(() {});
},
Expand Down Expand Up @@ -229,7 +229,7 @@ class _InLearningPageState extends State<InLearningPage> {
isShowNext: clicked,
isLast: controller.page?.ceil() == testList.length - 1,
onNextClicked: (){
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controller.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
setState(() {
clicked = false;
});
Expand Down Expand Up @@ -261,7 +261,7 @@ class _InLearningPageState extends State<InLearningPage> {
isShowNext: clicked,
isLast: controller.page?.ceil() == testList.length - 1,
onNextClicked: (){
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controller.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
setState(() {
clicked = false;
});
Expand Down Expand Up @@ -300,7 +300,7 @@ class _InLearningPageState extends State<InLearningPage> {
isShowNext: clicked,
isLast: controller.page?.ceil() == testList.length - 1,
onNextClicked: (){
controller.nextPage(duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controller.nextPage(duration: Durations.medium2, curve: StaticsVar.curve);
setState(() {
clicked = false;
});
Expand Down Expand Up @@ -337,7 +337,7 @@ class BottomTip extends StatelessWidget {
begin: 0.0,
end: isShowNext ? 1.0 : 0.0,
),
duration: const Duration(milliseconds: 500),
duration: Durations.medium2,
curve: StaticsVar.curve,
builder: (context, value, child) {
return Row(
Expand Down Expand Up @@ -636,7 +636,7 @@ class _WordCardOverViewPage extends State<WordCardOverViewPage> {
preferredSize: Size(mediaQuery.size.width, 75),
child: TweenAnimationBuilder<double>(
tween: Tween(begin: 0.0, end: inSearch ? 1.0 : 0.0),
duration: Duration(milliseconds: 300),
duration: Durations.short4,
curve: StaticsVar.curve,
builder: (context, value, child){
return Center(
Expand Down Expand Up @@ -809,7 +809,7 @@ class _WordCardOverViewLayout extends State<WordCardOverViewLayout> {
});
jsonController.animateTo(
(66 * jsonIndex).toDouble(),
duration: Duration(milliseconds: 200),
duration: Durations.medium1,
curve: StaticsVar.curve
);
},
Expand All @@ -835,18 +835,18 @@ class _WordCardOverViewLayout extends State<WordCardOverViewLayout> {
if(value) {
classController.animateTo(
(64 * classIndex).toDouble(),
duration: Duration(milliseconds: 200),
duration: Durations.medium1,
curve: StaticsVar.curve
);
jsonController.animateTo(
(66 * (jsonIndex + 1)).toDouble(),
duration: Duration(milliseconds: 200),
duration: Durations.medium1,
curve: StaticsVar.curve
);
} else {
jsonController.animateTo(
(66 * jsonIndex).toDouble(),
duration: Duration(milliseconds: 200),
duration: Durations.medium1,
curve: StaticsVar.curve
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/sub_pages_builder/setting_pages/debug_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _DebugPage extends State<DebugPage> {
floatingActionButton: FloatingActionButton(
child: Icon(Icons.arrow_upward),
onPressed: (){
controller.animateTo(0, duration: Duration(milliseconds: 500), curve: StaticsVar.curve);
controller.animateTo(0, duration: Durations.medium2, curve: StaticsVar.curve);
}
),
body: ListView(
Expand Down
Loading