From 2578c0e751c45e56bb04cc718d64aa471ba83f91 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Thu, 12 Sep 2019 17:36:48 +0800 Subject: [PATCH 1/5] Add repeat login if token expire Remove v2 api function. Fix bus reservations empty error --- ios/Flutter/flutter_export_environment.sh | 9 +++-- lib/api/helper.dart | 39 +++++++++++++----- lib/pages/home/bus/bus_reservations_page.dart | 2 +- lib/pages/home/user_info_page.dart | 40 ------------------- 4 files changed, 35 insertions(+), 55 deletions(-) diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 1f1e5072..9e3f441b 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -2,9 +2,10 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/rainvisitor/development/flutter" export "FLUTTER_APPLICATION_PATH=/Users/rainvisitor/Documents/GitHub-NKUST-ITC/NKUST-AP-Flutter" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_TARGET=/Users/rainvisitor/Documents/GitHub-NKUST-ITC/NKUST-AP-Flutter/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/rainvisitor/development/flutter/bin/cache/artifacts/engine/ios-release" -export "FLUTTER_BUILD_NAME=3.2.4" -export "FLUTTER_BUILD_NUMBER=30204" +export "FLUTTER_FRAMEWORK_DIR=/Users/rainvisitor/development/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_BUILD_NAME=3.2.5" +export "FLUTTER_BUILD_NUMBER=30205" +export "TRACK_WIDGET_CREATION=true" diff --git a/lib/api/helper.dart b/lib/api/helper.dart index 814a16fa..46056fb7 100644 --- a/lib/api/helper.dart +++ b/lib/api/helper.dart @@ -33,6 +33,14 @@ class Helper { static JsonCodec jsonCodec; static CancelToken cancelToken; + static String username; + static String password; + static DateTime expireTime; + + bool isExpire() { + return DateTime.now().isAfter(expireTime.add(Duration(hours: 8))); + } + static Helper get instance { if (_instance == null) { _instance = Helper(); @@ -93,7 +101,6 @@ class Helper { } Future login(String username, String password) async { - dio.options.headers = _createBasicAuth(username, password); try { var response = await dio.post( '/oauth/token', @@ -105,6 +112,9 @@ class Helper { if (response == null) print('null'); var loginResponse = LoginResponse.fromJson(response.data); options.headers = _createBearerTokenAuth(loginResponse.token); + expireTime = loginResponse.expireTime; + Helper.username = username; + Helper.password = password; return loginResponse; } on DioError catch (dioError) { throw dioError; @@ -153,6 +163,7 @@ class Helper { } Future getUsersInfo() async { + if (isExpire()) await login(username, password); try { var response = await dio.get('/user/info'); return UserInfo.fromJson(response.data); @@ -161,16 +172,8 @@ class Helper { } } - Future getUsersPicture() async { - try { - var response = await dio.get("/$VERSION/ap/users/picture"); - return response.data; - } on DioError catch (dioError) { - throw dioError; - } - } - Future getSemester() async { + if (isExpire()) await login(username, password); try { var response = await dio.get("/user/semesters"); return SemesterData.fromJson(response.data); @@ -180,6 +183,7 @@ class Helper { } Future getScores(String year, String semester) async { + if (isExpire()) await login(username, password); try { var response = await dio.get( "/user/scores", @@ -199,6 +203,7 @@ class Helper { } Future getCourseTables(String year, String semester) async { + if (isExpire()) await login(username, password); try { var response = await dio.get( '/user/coursetable', @@ -219,6 +224,7 @@ class Helper { Future getRewardAndPenalty( String year, String semester) async { + if (isExpire()) await login(username, password); try { var response = await dio.get( "/user/reward-and-penalty", @@ -239,6 +245,7 @@ class Helper { Future getMidtermAlerts( String year, String semester) async { + if (isExpire()) await login(username, password); try { var response = await dio.get( "/user/midterm-alerts", @@ -298,6 +305,7 @@ class Helper { } Future getBusTimeTables(DateTime dateTime) async { + if (isExpire()) await login(username, password); var formatter = DateFormat('yyyy-MM-dd'); var date = formatter.format(dateTime); try { @@ -318,6 +326,7 @@ class Helper { } Future getBusReservations() async { + if (isExpire()) await login(username, password); try { var response = await dio.get("/bus/reservations"); if (response.statusCode == 204) @@ -330,6 +339,7 @@ class Helper { } Future bookingBusReservation(String busId) async { + if (isExpire()) await login(username, password); try { var response = await dio.put( "/bus/reservations", @@ -344,6 +354,7 @@ class Helper { } Future cancelBusReservation(String cancelKey) async { + if (isExpire()) await login(username, password); try { var response = await dio.delete( "/bus/reservations", @@ -358,6 +369,7 @@ class Helper { } Future getBusViolationRecords() async { + if (isExpire()) await login(username, password); try { var response = await dio.get('/bus/violation-records'); print(response.statusCode); @@ -372,6 +384,7 @@ class Helper { } Future getNotifications(int page) async { + if (isExpire()) await login(username, password); try { var response = await dio.get( "/news/school", @@ -384,6 +397,7 @@ class Helper { } Future getLeaves(String year, String semester) async { + if (isExpire()) await login(username, password); try { var response = await dio.get( '/leaves', @@ -400,6 +414,7 @@ class Helper { } Future getLeavesSubmitInfo() async { + if (isExpire()) await login(username, password); try { var response = await dio.get( '/leaves/submit/info', @@ -412,6 +427,7 @@ class Helper { } Future sendLeavesSubmit(LeavesSubmitData data) async { + if (isExpire()) await login(username, password); try { var response = await dio.post( '/leaves/submit', @@ -425,6 +441,7 @@ class Helper { } Future getLibraryInfo() async { + if (isExpire()) await login(username, password); try { var response = await dio.get( '/leaves/submit/info', @@ -439,6 +456,7 @@ class Helper { } } + @deprecated _createBasicAuth(String username, String password) { var text = username + ":" + password; var encoded = utf8.encode(text); @@ -448,6 +466,7 @@ class Helper { }; } + // v3 api Authorization _createBearerTokenAuth(String token) { return { 'Authorization': 'Bearer $token', diff --git a/lib/pages/home/bus/bus_reservations_page.dart b/lib/pages/home/bus/bus_reservations_page.dart index 0fcc6735..0f9bc6df 100644 --- a/lib/pages/home/bus/bus_reservations_page.dart +++ b/lib/pages/home/bus/bus_reservations_page.dart @@ -81,7 +81,7 @@ class BusReservationsPageState extends State case _State.error: return app.clickToRetry; case _State.empty: - return app.busEmpty; + return app.busReservationEmpty; case _State.campusNotSupport: return app.campusNotSupport; case _State.userNotSupport: diff --git a/lib/pages/home/user_info_page.dart b/lib/pages/home/user_info_page.dart index 8b40ee10..0b2c2de3 100644 --- a/lib/pages/home/user_info_page.dart +++ b/lib/pages/home/user_info_page.dart @@ -29,8 +29,6 @@ class UserInfoPageState extends State void initState() { super.initState(); FA.setCurrentScreen("UserInfoPage", "user_info_page.dart"); - print(pictureBytes == null); - if (pictureBytes == null) _getUserPicture(); } @override @@ -120,42 +118,4 @@ class UserInfoPageState extends State body: _homebody(), ); } - - _getUserPicture() async { - bool isOffline = - Preferences.getBool(Constants.PREF_IS_OFFLINE_LOGIN, false); - if (!isOffline) { - Helper.instance.getUsersPicture().then((url) async { - if (this.mounted) { - var response = await http.get(url); - if (!response.body.contains('html')) { - setState(() { - pictureBytes = response.bodyBytes; - }); - CacheUtils.savePictureData(response.bodyBytes); - } else { - var bytes = await CacheUtils.loadPictureData(); - setState(() { - pictureBytes = bytes; - }); - } - } - }).catchError((e) { - if (e is DioError) { - switch (e.type) { - case DioErrorType.RESPONSE: - Utils.handleResponseError(context, 'getUserPicture', mounted, e); - break; - default: - break; - } - } - }); - } else { - var bytes = await CacheUtils.loadPictureData(); - setState(() { - pictureBytes = bytes; - }); - } - } } From 5d07b53d83a1ef6df4142cf9eade74f74a03fd9a Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sat, 14 Sep 2019 11:34:44 +0800 Subject: [PATCH 2/5] Update some text to selectable text Add experiment api by official http --- lib/api/helper.dart | 1 - lib/pages/home/about/open_source_page.dart | 6 ++-- lib/pages/home/bus/bus_rule_page.dart | 5 ++-- lib/pages/home/info/notification_page.dart | 5 ++-- lib/pages/home/news_content_page.dart | 4 +-- lib/pages/home/study/score_page.dart | 5 ++-- lib/utils/nkust_helper.dart | 28 +++++++++++++++++++ macos/Flutter/GeneratedPluginRegistrant.swift | 3 +- 8 files changed, 42 insertions(+), 15 deletions(-) diff --git a/lib/api/helper.dart b/lib/api/helper.dart index 46056fb7..935b4269 100644 --- a/lib/api/helper.dart +++ b/lib/api/helper.dart @@ -384,7 +384,6 @@ class Helper { } Future getNotifications(int page) async { - if (isExpire()) await login(username, password); try { var response = await dio.get( "/news/school", diff --git a/lib/pages/home/about/open_source_page.dart b/lib/pages/home/about/open_source_page.dart index 327f5793..a51a37cb 100644 --- a/lib/pages/home/about/open_source_page.dart +++ b/lib/pages/home/about/open_source_page.dart @@ -348,15 +348,15 @@ class OpenSourcePageState extends State { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + SelectableText( items[index].text, style: TextStyle(fontSize: 18.0), ), SizedBox( height: 4.0, ), - RichText( - text: TextSpan( + SelectableText.rich( + TextSpan( style: TextStyle( fontSize: 14.0, color: Resource.Colors.grey), text: items[index].subText, diff --git a/lib/pages/home/bus/bus_rule_page.dart b/lib/pages/home/bus/bus_rule_page.dart index b7bf27b6..6f6022a1 100644 --- a/lib/pages/home/bus/bus_rule_page.dart +++ b/lib/pages/home/bus/bus_rule_page.dart @@ -37,9 +37,8 @@ class BusRulePageState extends State { ), body: SingleChildScrollView( padding: EdgeInsets.all(16.0), - child: RichText( - textAlign: TextAlign.left, - text: TextSpan( + child: SelectableText.rich( + TextSpan( style: TextStyle( color: Resource.Colors.grey, height: 1.3, fontSize: 16.0), children: [ diff --git a/lib/pages/home/info/notification_page.dart b/lib/pages/home/info/notification_page.dart index 1d66a1e6..92d22d9f 100644 --- a/lib/pages/home/info/notification_page.dart +++ b/lib/pages/home/info/notification_page.dart @@ -127,6 +127,7 @@ class NotificationPageState extends State //TODO improve return FlatButton( onPressed: () { + _getNotifications(); FA.logAction('rerty', 'click'); }, child: HintContent( @@ -182,8 +183,7 @@ class NotificationPageState extends State return; } Helper.instance.getNotifications(page).then((response) { - var notificationData = response; - for (var notification in notificationData.data.notifications) { + for (var notification in response.data.notifications) { notificationList.add(notification); } if (mounted) { @@ -192,7 +192,6 @@ class NotificationPageState extends State }); } }).catchError((e) { - throw e; if (e is DioError) { switch (e.type) { case DioErrorType.RESPONSE: diff --git a/lib/pages/home/news_content_page.dart b/lib/pages/home/news_content_page.dart index 4b8d27d1..5d85dcf8 100644 --- a/lib/pages/home/news_content_page.dart +++ b/lib/pages/home/news_content_page.dart @@ -89,7 +89,7 @@ class NewsContentPageState extends State { tag: Constants.TAG_NEWS_TITLE, child: Material( color: Colors.transparent, - child: Text( + child: SelectableText( widget.news.title, textAlign: TextAlign.center, style: TextStyle( @@ -107,7 +107,7 @@ class NewsContentPageState extends State { Padding( padding: EdgeInsets.symmetric( horizontal: orientation == Orientation.portrait ? 16.0 : 0.0), - child: Text( + child: SelectableText( widget.news.description, textAlign: TextAlign.center, style: TextStyle( diff --git a/lib/pages/home/study/score_page.dart b/lib/pages/home/study/score_page.dart index d7ed717d..d2834564 100644 --- a/lib/pages/home/study/score_page.dart +++ b/lib/pages/home/study/score_page.dart @@ -207,7 +207,8 @@ class ScorePageState extends State { : BorderSide(color: Resource.Colors.grey, width: 0.5), ), ), - child: Text( + alignment: Alignment.center, + child: SelectableText( text ?? '', textAlign: TextAlign.center, style: _textBlueStyle, @@ -228,7 +229,7 @@ class ScorePageState extends State { width: double.maxFinite, padding: EdgeInsets.symmetric(vertical: 2.0, horizontal: 4.0), alignment: Alignment.center, - child: Text( + child: SelectableText( text ?? '', textAlign: TextAlign.center, style: isTitle ? _textBlueStyle : _textStyle, diff --git a/lib/utils/nkust_helper.dart b/lib/utils/nkust_helper.dart index d30db8e5..58aaf8f0 100644 --- a/lib/utils/nkust_helper.dart +++ b/lib/utils/nkust_helper.dart @@ -1,7 +1,9 @@ import 'dart:async'; +import 'dart:convert'; import 'package:html/parser.dart'; import 'package:http/http.dart' as http; +import 'package:nkust_ap/models/notification_data.dart'; import 'package:nkust_ap/models/user_info.dart'; class NKUSTHelper { @@ -39,4 +41,30 @@ class NKUSTHelper { else return null; } + + //experiment for flutter web + Future getNotifications(int page) async { + try { + var response = await http.get( + Uri.encodeFull("https://nkust.taki.dog/news/school?page=$page"), + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36', + 'Cache-Control': 'no-cache', + 'Accept': + 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', + 'Connection': 'keep-alive', + 'Host': 'nkust.taki.dog', + 'Accept-Encoding': 'gzip, deflate', + 'Access-Control-Allow-Origin': '*', + 'Referer': '', + }, + ); + var text = utf8.decode(response.bodyBytes); + var map = jsonDecode(text); + return NotificationsData.fromJson(map); + } catch (e) { + throw e; + } + } } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 58425bba..cccf817a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -1,8 +1,9 @@ // // Generated file. Do not edit. // -import Foundation + import FlutterMacOS +import Foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { From 54e1306853553a6315618ccbeeeb3d6f5fe69908 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 15 Sep 2019 23:56:11 +0800 Subject: [PATCH 3/5] Add card list mode in course page --- ios/Flutter/flutter_export_environment.sh | 3 +- lib/models/course_data.dart | 111 +++++++++++++-- lib/pages/home/study/course_page.dart | 157 ++++++++++++++++++---- 3 files changed, 231 insertions(+), 40 deletions(-) diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 9e3f441b..9abd87d5 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -2,10 +2,9 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/rainvisitor/development/flutter" export "FLUTTER_APPLICATION_PATH=/Users/rainvisitor/Documents/GitHub-NKUST-ITC/NKUST-AP-Flutter" -export "FLUTTER_TARGET=/Users/rainvisitor/Documents/GitHub-NKUST-ITC/NKUST-AP-Flutter/lib/main.dart" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" export "FLUTTER_FRAMEWORK_DIR=/Users/rainvisitor/development/flutter/bin/cache/artifacts/engine/ios" export "FLUTTER_BUILD_NAME=3.2.5" export "FLUTTER_BUILD_NUMBER=30205" -export "TRACK_WIDGET_CREATION=true" diff --git a/lib/models/course_data.dart b/lib/models/course_data.dart index 41111708..6b0e8d4e 100644 --- a/lib/models/course_data.dart +++ b/lib/models/course_data.dart @@ -1,30 +1,115 @@ +import 'dart:convert'; + import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:intl/intl.dart'; class CourseData { - int status; - String messages; + List courses; CourseTables courseTables; - CourseData({this.status, this.messages, this.courseTables}); + CourseData({this.courses, this.courseTables}); - CourseData.fromJson(Map json) { - courseTables = json['coursetable'] != null - ? CourseTables.fromJson(json['coursetable']) - : null; - } + factory CourseData.fromRawJson(String str) => + CourseData.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory CourseData.fromJson(Map json) => CourseData( + courses: json["courses"] == null + ? null + : List.from( + json["courses"].map((x) => CourseDetail.fromJson(x))), + courseTables: json["coursetable"] == null + ? null + : CourseTables.fromJson(json["coursetable"]), + ); + + Map toJson() => { + "courses": courses == null + ? null + : List.from(courses.map((x) => x.toJson())), + "coursetable": courseTables == null ? null : courseTables.toJson(), + }; bool get hasHoliday { return ((courseTables.saturday?.isEmpty) ?? false) && ((courseTables.sunday?.isEmpty) ?? false); } +} - Map toJson() { - final Map data = Map(); - if (this.courseTables != null) { - data['coursetable'] = this.courseTables.toJson(); +class CourseDetail { + String code; + String title; + String className; + String group; + String units; + String hours; + String required; + String at; + String times; + Location location; + List instructors; + + CourseDetail({ + this.code, + this.title, + this.className, + this.group, + this.units, + this.hours, + this.required, + this.at, + this.times, + this.location, + this.instructors, + }); + + factory CourseDetail.fromRawJson(String str) => + CourseDetail.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory CourseDetail.fromJson(Map json) => CourseDetail( + code: json["code"] == null ? null : json["code"], + title: json["title"] == null ? null : json["title"], + className: json["className"] == null ? null : json["className"], + group: json["group"] == null ? null : json["group"], + units: json["units"] == null ? null : json["units"], + hours: json["hours"] == null ? null : json["hours"], + required: json["required"] == null ? null : json["required"], + at: json["at"] == null ? null : json["at"], + times: json["times"] == null ? null : json["times"], + location: json["location"] == null + ? null + : Location.fromJson(json["location"]), + instructors: json["instructors"] == null + ? null + : List.from(json["instructors"].map((x) => x)), + ); + + Map toJson() => { + "code": code == null ? null : code, + "title": title == null ? null : title, + "className": className == null ? null : className, + "group": group == null ? null : group, + "units": units == null ? null : units, + "hours": hours == null ? null : hours, + "required": required == null ? null : required, + "at": at == null ? null : at, + "times": times == null ? null : times, + "location": location == null ? null : location.toJson(), + "instructors": instructors == null + ? null + : List.from(instructors.map((x) => x)), + }; + + String getInstructors() { + String text = ""; + if (instructors.length > 0) { + text += instructors[0]; + for (var i = 1; i < instructors.length; i++) text += ",${instructors[i]}"; } - return data; + return text; } } diff --git a/lib/pages/home/study/course_page.dart b/lib/pages/home/study/course_page.dart index c89609a8..2e7017cb 100644 --- a/lib/pages/home/study/course_page.dart +++ b/lib/pages/home/study/course_page.dart @@ -11,6 +11,7 @@ import 'package:nkust_ap/widgets/hint_content.dart'; import 'package:nkust_ap/widgets/semester_picker.dart'; enum _State { loading, finish, error, empty, offlineEmpty } +enum _ContentStyle { card, table } class CoursePage extends StatefulWidget { static const String routerName = '/course'; @@ -26,6 +27,7 @@ class CoursePageState extends State { ScaffoldState scaffold; _State state = _State.loading; + _ContentStyle _contentStyle = _ContentStyle.table; Semester selectSemester; SemesterData semesterData; @@ -79,11 +81,16 @@ class CoursePageState extends State { _getCourseTables(); }, ), - Text( - '${isOffline ? app.offlineCourse + ' ' : ''}' - '${app.courseClickHint}', - style: TextStyle(color: Resource.Colors.grey), - ), + if (isOffline) + Text( + app.offlineCourse, + style: TextStyle(color: Resource.Colors.grey), + ), + if (_contentStyle == _ContentStyle.table) + Text( + app.courseClickHint, + style: TextStyle(color: Resource.Colors.grey), + ), SizedBox(height: 4.0), Expanded( child: RefreshIndicator( @@ -100,6 +107,45 @@ class CoursePageState extends State { ); }, ), + floatingActionButtonLocation: FloatingActionButtonLocation.endDocked, + floatingActionButton: FloatingActionButton( + child: Icon(Icons.search), + onPressed: () { + key.currentState.pickSemester(); + }, + ), + bottomNavigationBar: BottomAppBar( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + iconSize: _contentStyle == _ContentStyle.table ? 24 : 20, + color: _contentStyle == _ContentStyle.table + ? Resource.Colors.yellow + : Resource.Colors.grey, + icon: Icon(Icons.grid_on), + onPressed: () { + setState(() { + _contentStyle = _ContentStyle.table; + }); + }, + ), + IconButton( + iconSize: _contentStyle == _ContentStyle.card ? 24 : 20, + color: _contentStyle == _ContentStyle.card + ? Resource.Colors.yellow + : Resource.Colors.grey, + icon: Icon(Icons.format_list_bulleted), + onPressed: () { + setState(() { + _contentStyle = _ContentStyle.card; + }); + }, + ), + Container(height: 0), + ], + ), + ), ); } @@ -129,31 +175,92 @@ class CoursePageState extends State { content: app.noOfflineData, ); default: - return SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular( - 10.0, + if (_contentStyle == _ContentStyle.card) { + return ListView.builder( + itemBuilder: (_, index) { + var course = courseData.courses[index]; + return Card( + elevation: 4.0, + margin: EdgeInsets.all(8.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), ), + child: ListTile( + contentPadding: EdgeInsets.all(16.0), + title: Text( + courseData.courses[index].title, + style: TextStyle( + height: 1.3, + fontSize: 20.0, + ), + ), + trailing: Text( + '${course.required}', + style: TextStyle( + color: Resource.Colors.blueAccent, + fontSize: 16.0, + ), + ), + subtitle: SelectableText.rich( + TextSpan( + style: TextStyle( + color: Resource.Colors.grey, + fontSize: 16.0, + ), + children: [ + TextSpan( + text: '\n${app.studentClass}:', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan(text: '${course.className}\n'), + TextSpan( + text: '${app.courseDialogProfessor}:', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan(text: '${course.getInstructors()}\n'), + TextSpan( + text: '${app.courseDialogLocation}:', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan( + text: + '${course.location.building}${course.location.room}\n'), + TextSpan( + text: '${app.courseDialogTime}:', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan(text: '${course.times}'), + ], + ), + ), + ), + ); + }, + itemCount: courseData.courses.length, + ); + } else { + return SingleChildScrollView( + physics: AlwaysScrollableScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular( + 10.0, + ), + ), + border: Border.all(color: Colors.grey, width: 1.0), ), - border: Border.all(color: Colors.grey, width: 1.0), - ), - child: Table( - defaultColumnWidth: FractionColumnWidth(1.0 / base), - defaultVerticalAlignment: TableCellVerticalAlignment.middle, - border: TableBorder.symmetric( - inside: BorderSide( - color: Colors.grey, - width: 0, + child: Table( + defaultColumnWidth: FractionColumnWidth(1.0 / base), + defaultVerticalAlignment: TableCellVerticalAlignment.middle, + border: TableBorder.symmetric( + inside: BorderSide( + color: Colors.grey, + width: 0, + ), ), + children: renderCourseList(), ), - children: renderCourseList(), ), - ), - ); + ); + } } } From 1ddd16b778926f7a4b65995258622c4db92de889 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Mon, 16 Sep 2019 00:01:48 +0800 Subject: [PATCH 4/5] Fix bus reservation campus text error --- lib/models/bus_data.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/models/bus_data.dart b/lib/models/bus_data.dart index 8f2d381b..c8b8f691 100644 --- a/lib/models/bus_data.dart +++ b/lib/models/bus_data.dart @@ -168,9 +168,9 @@ class BusTime { String getStart(AppLocalizations local) { switch (startStation) { case "建工": - return local.yanchao; - case "燕巢": return local.jiangong; + case "燕巢": + return local.yanchao; default: return local.unknown; } @@ -179,9 +179,9 @@ class BusTime { String getEnd(AppLocalizations local) { switch (startStation) { case "建工": - return local.jiangong; - case "燕巢": return local.yanchao; + case "燕巢": + return local.jiangong; default: return local.unknown; } From 5d8118f7c67b64ea9fbeccfc0a2003f6fc1eb8ab Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Mon, 16 Sep 2019 00:18:44 +0800 Subject: [PATCH 5/5] Update to v3.2.6 update about us content --- ios/Flutter/flutter_export_environment.sh | 6 +++--- lib/pages/home/about/about_us_page.dart | 6 ++++++ lib/utils/app_localizations.dart | 8 ++++---- pubspec.yaml | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 9abd87d5..a4804aef 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -5,6 +5,6 @@ export "FLUTTER_APPLICATION_PATH=/Users/rainvisitor/Documents/GitHub-NKUST-ITC/N export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/rainvisitor/development/flutter/bin/cache/artifacts/engine/ios" -export "FLUTTER_BUILD_NAME=3.2.5" -export "FLUTTER_BUILD_NUMBER=30205" +export "FLUTTER_FRAMEWORK_DIR=/Users/rainvisitor/development/flutter/bin/cache/artifacts/engine/ios-release" +export "FLUTTER_BUILD_NAME=3.2.6" +export "FLUTTER_BUILD_NUMBER=30206" diff --git a/lib/pages/home/about/about_us_page.dart b/lib/pages/home/about/about_us_page.dart index f2935520..2fdfbd08 100644 --- a/lib/pages/home/about/about_us_page.dart +++ b/lib/pages/home/about/about_us_page.dart @@ -107,6 +107,9 @@ class AboutUsPageState extends State { Card( margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), elevation: 4.0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), child: Container( padding: EdgeInsets.only( top: 24.0, left: 16.0, bottom: 16.0, right: 16.0), @@ -192,6 +195,9 @@ class AboutUsPageState extends State { _item(String text, String subText) => Card( margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), elevation: 4.0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), child: Container( padding: EdgeInsets.only(top: 24.0, left: 16.0, bottom: 16.0, right: 16.0), diff --git a/lib/utils/app_localizations.dart b/lib/utils/app_localizations.dart index 4344d4d7..e19be20e 100644 --- a/lib/utils/app_localizations.dart +++ b/lib/utils/app_localizations.dart @@ -65,7 +65,7 @@ class AppLocalizations { 'app_name': 'NKUST AP', 'update_note_title': 'Update Notes', 'update_note_content': - '1.Release new API version(will clear old preference data).\n2.Add midterm warning page.\n3.Add reward and penalty page.', + '1.Release new API version(will clear old preference data).\n2.Add midterm warning page.\n3.Add reward and penalty page.\n4.Impove course page.\n5.Fix some bug', 'splash_content': '我們全都包了\n只剩下學校不包我們', 'share': 'Share', 'teacher_confirm_title': 'Are you a teacher?', @@ -234,7 +234,7 @@ class AppLocalizations { 'The best KUAS Campus App\nKUAS AP\n\nAre you afreshman?\nDon\'t know about school info, telephone numbers, or up coming events?\nBeenhere a few years?\nHave checking class schedule, report card and reserving bus seatsdrove you crazy?\n\nNo more, no more worries, anymore!\n\nKUAS AP lets no matter old or newfellow\nhave control over your life in KUAS!\n\nFrom checking class schedule, report card toyour absence records!\nPlus reserving/canceling bus seats with newest school feeds!\n\n\n\nMuch Simple, Many Convenient, Very instinct, wow!\n\n☆FABULOUS☆', 'about_author_title': 'Made by', 'about_author_content': - '呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), 陳冠蓁, 徐羽柔\n房志剛(Rainvisitor),林義翔(takidog)', + 'v1 & v2\n呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), 陳冠蓁, 徐羽柔\nv3\n房志剛(Rainvisitor),林義翔(takidog)', 'about_us': '“Ask not why nobody is doing this. You are \'nobody\'.”\n\nWe did this cause no one did it.\nWe created KUAS Wifi Login, KUASAP and KUAS Gourmet, Course Selection Sim, etc…\nTo bring convenience to everyone\'s on campus!', 'about_recruit_title': 'We Need You !', @@ -377,7 +377,7 @@ class AppLocalizations { 'app_name': '高科校務通', 'update_note_title': '更新日誌', 'update_note_content': - '1.全新推出新的API(此更新會清除先前資料)\n2.新增期中預警\n3.新增獎懲紀錄\n4.修正部分錯誤', + '1.全新推出新的API(此更新會清除先前資料)\n2.新增期中預警\n3.新增獎懲紀錄\n4.改善課表顯示\n5.修正部分錯誤', 'splash_content': '我們全都包了\n只剩下學校不包我們', 'share': '分享', 'teacher_confirm_title': '您是老師嗎?', @@ -527,7 +527,7 @@ class AppLocalizations { 'app_version': 'App 版本', 'about_author_title': '作者群', 'about_author_content': - '呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), 陳冠蓁, 徐羽柔 \n房志剛(Rainvisitor),林義翔(takidog)', + 'v1 & v2\n呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), 陳冠蓁, 徐羽柔 \nv3\n房志剛(Rainvisitor),林義翔(takidog)', 'about_us': '「不要問為何沒有人做這個,\n先承認你就是『沒有人』」。\n因為,「沒有人」是萬能的。\n\n因為沒有人做這些,所以我們跳下來做。\n先後完成了高應無線通、高應校務通,到後來的高應美食通、模擬選課等等.......\n無非是希望帶給大家更便利的校園生活!', 'about_recruit_title': 'We Need You !', diff --git a/pubspec.yaml b/pubspec.yaml index ff13d995..2cfc0b98 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: nkust_ap description: A new Flutter application. -version: 3.2.5+30205 +version: 3.2.6+30206 environment: sdk: ">=2.2.2 <3.0.0"