Skip to content

Commit

Permalink
Merge pull request #248 from mlgzackfly/master
Browse files Browse the repository at this point in the history
feat: add report page
  • Loading branch information
abc873693 authored Jun 25, 2024
2 parents 266f12e + 338a6bf commit e743a8c
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/l10n/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ class MessageLookup extends MessageLookupByLibrary {
"punch": MessageLookupByLibrary.simpleMessage("Punch"),
"punchSuccess": MessageLookupByLibrary.simpleMessage("Punch Success"),
"qijin": MessageLookupByLibrary.simpleMessage("Qijin"),
"reportNetProblem":
MessageLookupByLibrary.simpleMessage("Report Net Problem"),
"reportNetProblemSubTitle": MessageLookupByLibrary.simpleMessage(
"Report encountered network problems"),
"reportProblem": MessageLookupByLibrary.simpleMessage("Report Problem"),
"reserve": MessageLookupByLibrary.simpleMessage("Reserve"),
"reserveDeadline":
MessageLookupByLibrary.simpleMessage("Reserve Deadline"),
Expand Down
4 changes: 4 additions & 0 deletions lib/l10n/intl/messages_zh_TW.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class MessageLookup extends MessageLookupByLibrary {
"punch": MessageLookupByLibrary.simpleMessage("拍照打卡"),
"punchSuccess": MessageLookupByLibrary.simpleMessage("打卡成功"),
"qijin": MessageLookupByLibrary.simpleMessage("旗津"),
"reportNetProblem": MessageLookupByLibrary.simpleMessage("網路問題通報"),
"reportNetProblemSubTitle":
MessageLookupByLibrary.simpleMessage("通報遇到的網路問題"),
"reportProblem": MessageLookupByLibrary.simpleMessage("問題通報"),
"reserve": MessageLookupByLibrary.simpleMessage("預約"),
"reserveDeadline": MessageLookupByLibrary.simpleMessage("預約截止時間"),
"reserved": MessageLookupByLibrary.simpleMessage("已預約"),
Expand Down
5 changes: 4 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,8 @@
"clickShowDescription": "Description",
"mobileNkustLoginHint": "Wait for the webpage to finish loading, the student ID and password will be filled in automatically.\nAfter completing the Google reCaptcha and clicking login, it will automatically redirected.",
"mobileNkustLoginDescription": "Because the school has closed the original crawler function, this version needs to be logged in through the new version of the mobile school system. After successful login, it will be redirected automatically. Unless the certificate expires, repeated verification is rarely required. It is strongly recommended to \"記住我\" to check it.。",
"leaveApplyRecord": "Apply Records"
"leaveApplyRecord": "Apply Records",
"reportNetProblem": "Report Net Problem",
"reportNetProblemSubTitle": "Report encountered network problems",
"reportProblem":"Report Problem"
}
5 changes: 4 additions & 1 deletion lib/l10n/intl_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@
"clickShowDescription": "點擊看說明",
"mobileNkustLoginHint": "等待網頁完成載入\n將自動填寫學號密碼\n完成機器人驗證後點擊登入\n將自動跳轉",
"mobileNkustLoginDescription": "因應校方關閉原有爬蟲功能,此版本需透過新版手機版校務系統登入。成功登入後會自動跳轉,除非憑證過期,否則極少需要重複驗證,強烈建議將記住我勾選。",
"leaveApplyRecord": "請假查詢"
"leaveApplyRecord": "請假查詢",
"reportNetProblem": "網路問題通報",
"reportNetProblemSubTitle": "通報遇到的網路問題",
"reportProblem":"問題通報"
}
30 changes: 30 additions & 0 deletions lib/l10n/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ class HomePageState extends State<HomePage> {
}
}

IconData get report {
switch (ApIcon.code) {
case ApIcon.filled:
return Icons.flag_circle;
case ApIcon.outlined:
default:
return Icons.flag_circle_outlined;
}
}

bool get canUseBus => busEnable && MobileNkustHelper.isSupport;

static Widget aboutPage(BuildContext context, {String? assetImage}) {
Expand Down Expand Up @@ -405,6 +415,11 @@ class HomePageState extends State<HomePage> {
),
),
),
DrawerItem(
icon: report,
title: app.reportProblem,
onTap: () => _openPage(ReportPage()),
),
DrawerItem(
icon: ApIcon.settings,
title: ap.settings,
Expand Down
1 change: 1 addition & 0 deletions lib/pages/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export 'home_page.dart';
export 'info/shcool_info_page.dart';
export 'leave/leave_page.dart';
export 'login_page.dart';
export 'report_page.dart';
export 'setting_page.dart';
export 'study/calculate_units_page.dart';
export 'study/course_page.dart';
Expand Down
45 changes: 45 additions & 0 deletions lib/pages/report_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:ap_common/l10n/l10n.dart';
import 'package:ap_common/resources/ap_theme.dart';
import 'package:ap_common/utils/analytics_utils.dart';
import 'package:ap_common/utils/ap_utils.dart';
import 'package:flutter/material.dart';
import 'package:nkust_ap/l10n/l10n.dart';

class ReportPage extends StatefulWidget {
static const String routerName = '/report';

@override
_ReportPageState createState() => _ReportPageState();
}

class _ReportPageState extends State<ReportPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
AppLocalizations? app;

@override
Widget build(BuildContext context) {
app = AppLocalizations.of(context);
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text(app!.reportProblem),
backgroundColor: ApTheme.of(context).blue,
),
body: ListView.builder(
itemCount: 1,
itemBuilder: (BuildContext context, int index) {
return ListTile(
title: Text(app!.reportNetProblem),
subtitle: Text(app!.reportNetProblemSubTitle),
onTap: () async {
const String url =
'https://docs.google.com/forms/d/e/1FAIpQLSfAOZaF-aM4XwuJRXaSp1uzZ1nZqhl7M6-oc4xWrCbM4tqcuw/viewform';
await ApUtils.launchUrl(url);
AnalyticsUtils.instance?.logEvent('net_problem_click');
},
);
},
),
);
}
}

0 comments on commit e743a8c

Please sign in to comment.