Skip to content

Commit

Permalink
✨ Patch Version 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
H2Sxxa committed Jan 13, 2025
1 parent e1aadb6 commit 487f494
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 51 deletions.
51 changes: 51 additions & 0 deletions lib/animation/rainbow.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';

Widget rainbow(Widget child, [Duration? duration]) {
return child
.animate(
onPlay: (controller) => controller.repeat(reverse: true),
)
.shimmer(
duration: duration ?? 1200.ms,
colors: [
Colors.blue.shade300,
Colors.yellow,
Colors.pink.shade200,
Colors.red,
],
curve: Curves.linear);
}

extension RainBow on Widget {
Widget rainbow([Duration? duration]) {
return animate(
onPlay: (controller) => controller.repeat(reverse: true),
).shimmer(
duration: duration ?? 1200.ms,
colors: [
Colors.blue.shade300,
Colors.yellow,
Colors.pink.shade200,
Colors.red,
],
curve: Curves.linear);
}

Widget rainbowWhen(bool condition, [Duration? duration]) {
if (!condition) {
return this;
}
return animate(
onPlay: (controller) => controller.repeat(reverse: true),
).shimmer(
duration: duration ?? 1200.ms,
colors: [
Colors.blue.shade300,
Colors.yellow,
Colors.pink.shade200,
Colors.red,
],
curve: Curves.linear);
}
}
1 change: 1 addition & 0 deletions lib/controllers/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ApplicationConfigs extends AppConfigsBase {
ConfigEntry<bool> get notificationsDay => generator("notifications_day");
ConfigEntry<bool> get firstUse => generator("first_use");
ConfigEntry<bool> get weakAnimation => generator("weak_animation");
ConfigEntry<bool> get funDream => generator("fun_dream");

ConfigEntry<bool> get calendarIntervalLine =>
generator("calendar_intervalline");
Expand Down
2 changes: 1 addition & 1 deletion lib/models/fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ final GlobalKey<NavigationViewState> navKey = GlobalKey();
final GlobalKey<SettingsPageState> settingKey = GlobalKey();
final GlobalKey<ScaffoldMessengerState> messagerKey = GlobalKey();

const Version appVersion = (1, 4, 1);
const Version appVersion = (1, 4, 2);
36 changes: 15 additions & 21 deletions lib/views/pages/calendar_settings.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:app_settings/app_settings.dart';
import 'package:arche/arche.dart';
import 'package:arche/extensions/dialogs.dart';
import 'package:arche/extensions/io.dart';
Expand Down Expand Up @@ -334,31 +335,16 @@ class _CalendarSettingsState extends State<CalendarSettings> {
if (mounted) {
showSnackBar(
context: this.context,
content: const Text("尚未生成课表"),
content: const Text("暂无通知权限"),
);
}

return;
}
var platdir =
await platCalendarDataDirectory.getValue();
platdir
.subFile("calendar_curriculum.ics")
.exists()
.then((value) {
if (value) {
Scheduler.scheduleAll();
setState(() {
configs.notificationsEnable.write(true);
});
} else {
if (mounted) {
showSnackBar(
context: this.context,
content: const Text("尚未生成课表"),
);
}
}

Scheduler.scheduleAll();
setState(() {
configs.notificationsEnable.write(true);
});
});

Expand Down Expand Up @@ -508,7 +494,15 @@ class _CalendarSettingsState extends State<CalendarSettings> {
onTap: () {
Scheduler.scheduleTest();
},
)
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text("系统设置"),
subtitle: const Text("如果应用无法正常通知,请检查耗电管理并允许后台行为"),
onTap: () {
AppSettings.openAppSettings();
},
),
],
),
],
Expand Down
32 changes: 18 additions & 14 deletions lib/views/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:arche/arche.dart';
import 'package:arche/extensions/io.dart';
import 'package:cczu_helper/animation/rainbow.dart';
import 'package:cczu_helper/controllers/config.dart';
import 'package:cczu_helper/controllers/navigator.dart';
import 'package:cczu_helper/controllers/snackbar.dart';
Expand Down Expand Up @@ -30,6 +31,7 @@ class SettingsPage extends StatefulWidget {
State<StatefulWidget> createState() => SettingsPageState();
}


class SettingsPageState extends State<SettingsPage>
with RefreshMountedStateMixin {
@override
Expand Down Expand Up @@ -103,6 +105,7 @@ class SettingsPageState extends State<SettingsPage>
),
],
),

SettingGroup(
name: "外观",
children: [
Expand Down Expand Up @@ -255,6 +258,19 @@ class SettingsPageState extends State<SettingsPage>
)
],
),
SettingGroup(name: "娱乐", children: [
SwitchListTile(
value: configs.funDream.getOr(false),
secondary: const Icon(Icons.bed),
title: const Text("一键幻想"),
subtitle: rainbow(const Text("你的所有查询到的成绩都会变成满分"), 900.ms),
onChanged: (value) {
setState(() {
configs.funDream.write(value);
});
},
),
]),
SettingGroup(
name: "关于",
children: [
Expand Down Expand Up @@ -283,24 +299,12 @@ class SettingsPageState extends State<SettingsPage>
ListTile(
leading: const Icon(Icons.home),
title: const Text("官方网站"),
subtitle: const Text(
subtitle: rainbow(const Text(
"源神.常州大学.com",
style: TextStyle(
color: Colors.white,
),
)
.animate(
onPlay: (controller) => controller.repeat(reverse: true),
)
.shimmer(
duration: 1200.ms,
colors: [
Colors.blue.shade300,
Colors.yellow,
Colors.pink.shade200,
Colors.red,
],
curve: Curves.linear),
)),
onTap: () => launchUrlString(
"https://cczu-ossa.github.io/home",
mode: LaunchMode.externalApplication,
Expand Down
23 changes: 15 additions & 8 deletions lib/views/services/edu/wechat/grades.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import 'dart:collection';

import 'package:arche/arche.dart';
import 'package:arche/extensions/iter.dart';
import 'package:cczu_helper/animation/rainbow.dart';
import 'package:cczu_helper/controllers/accounts.dart';
import 'package:cczu_helper/controllers/config.dart';
import 'package:cczu_helper/messages/all.dart';
import 'package:cczu_helper/views/widgets/scrollable.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -34,6 +36,8 @@ class WeChatGradeQueryServicePageState

@override
Widget build(BuildContext context) {
ApplicationConfigs configs = ArcheBus().of();
bool dream = configs.funDream.getOr(false);
return StreamBuilder(
stream: WeChatGradesOutput.rustSignalStream,
builder: (context, snapshot) {
Expand Down Expand Up @@ -114,32 +118,35 @@ class WeChatGradeQueryServicePageState
visible: course.usualGrade != 0,
child: ListTile(
title: const Text("平时成绩"),
trailing: Text(course.usualGrade.toStringAsFixed(1)),
),
trailing: Text(dream
? "100.0"
: course.usualGrade.toStringAsFixed(1)),
).rainbowWhen(dream),
),
Visibility(
visible: course.midGrade != 0,
child: ListTile(
title: const Text("期中成绩"),
trailing: Text(course.midGrade.toStringAsFixed(1)),
),
trailing: Text(
dream ? "100.0" : course.midGrade.toStringAsFixed(1)),
).rainbowWhen(dream),
),
Visibility(
visible: course.endGrade != 0,
child: ListTile(
title: const Text("期末成绩"),
trailing: Text(
course.endGrade.toStringAsFixed(1),
dream ? "100.0" : course.endGrade.toStringAsFixed(1),
),
),
).rainbowWhen(dream),
),
ListTile(
title: const Text("总评"),
trailing: Text(
course.examGrade,
dream ? "100.0" : course.examGrade,
style: TextStyle(color: examColor),
),
),
).rainbowWhen(dream),
],
),
),
Expand Down
17 changes: 11 additions & 6 deletions lib/views/services/edu/wechat/ranks.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:arche/arche.dart';
import 'package:cczu_helper/animation/rainbow.dart';
import 'package:cczu_helper/controllers/accounts.dart';
import 'package:cczu_helper/controllers/config.dart';
import 'package:cczu_helper/messages/all.dart';
import 'package:flutter/material.dart';

Expand All @@ -21,6 +23,8 @@ class WeChatRankServicePageState extends State<WeChatRankServicePage> {

@override
Widget build(BuildContext context) {
ApplicationConfigs configs = ArcheBus().of();
bool dream = configs.funDream.getOr(false);
return StreamBuilder(
stream: WeChatRankDataOutput.rustSignalStream,
builder: (context, snapshot) {
Expand All @@ -44,26 +48,27 @@ class WeChatRankServicePageState extends State<WeChatRankServicePage> {
);
}
var data = message.data;

return Scaffold(
appBar: AppBar(),
body: ListView(
children: [
ListTile(
title: Text("绩点"),
trailing: Text(data.gpa),
),
trailing: dream ? Text("5.00") : Text(data.gpa),
).rainbowWhen(dream),
ListTile(
title: Text("总学分"),
trailing: Text(data.totalCredits),
),
ListTile(
title: Text("排名"),
trailing: Text(data.rank),
),
trailing: dream ? Text("1") : Text(data.rank),
).rainbowWhen(dream),
ListTile(
title: Text("专业排名"),
trailing: Text(data.majorRank),
),
trailing: dream ? Text("1") : Text(data.majorRank),
).rainbowWhen(dream),
],
),
);
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
app_settings:
dependency: "direct main"
description:
name: app_settings
sha256: "09bc7fe0313a507087bec1a3baf555f0576e816a760cbb31813a88890a09d9e5"
url: "https://pub.dev"
source: hosted
version: "5.1.1"
arche:
dependency: "direct main"
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.4.1
version: 1.4.2

environment:
sdk: ">=3.2.2 <4.0.0"
Expand Down Expand Up @@ -56,6 +56,7 @@ dependencies:
path: ^1.9.0
flutter_animate: ^4.5.2
dynamic_system_colors: ^1.8.0
app_settings: ^5.1.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 487f494

Please sign in to comment.