Skip to content

Commit

Permalink
Merge pull request #63 from NKUST-ITC/develop
Browse files Browse the repository at this point in the history
Update to v3.1.11
  • Loading branch information
abc873693 authored Jul 18, 2019
2 parents 89b9e0b + 45ae38f commit a06da77
Show file tree
Hide file tree
Showing 37 changed files with 737 additions and 630 deletions.
Binary file added assets/images/dash_line_dark_theme.webp
Binary file not shown.
File renamed without changes.
3 changes: 3 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ target 'Runner' do
}
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
Expand Down
33 changes: 0 additions & 33 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,42 +248,9 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
"${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework",
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
"${BUILT_PRODUCTS_DIR}/add_2_calendar/add_2_calendar.framework",
"${BUILT_PRODUCTS_DIR}/app_review/app_review.framework",
"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
"${BUILT_PRODUCTS_DIR}/package_info/package_info.framework",
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/share/share.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/add_2_calendar.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/app_review.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
<dict/>
</plist>
1 change: 1 addition & 0 deletions lib/config/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Constants {
static const PREF_BUS_RESERVATIONS_DATA = "pref_bus_reservevations_data";

static const PREF_LANGUAGE_CODE = 'pref_language_code';
static const PREF_THEME_CODE = 'pref_theme_code';

static const PREF_AP_ENABLE = "pref_ap_enable";
static const PREF_BUS_ENABLE = "pref_bus_enable";
Expand Down
54 changes: 35 additions & 19 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:nkust_ap/config/constants.dart';
import 'package:nkust_ap/pages/home/bus/bus_rule_page.dart';
import 'package:nkust_ap/pages/page.dart';
import 'package:nkust_ap/res/resource.dart' as Resource;
import 'package:nkust_ap/res/app_theme.dart';
import 'package:nkust_ap/utils/app_localizations.dart';
import 'package:nkust_ap/utils/firebase_analytics_utils.dart';
import 'package:nkust_ap/utils/preferences.dart';
Expand All @@ -21,6 +21,13 @@ import 'package:nkust_ap/widgets/share_data_widget.dart';

void main() async {
bool isInDebugMode = Constants.isInDebugMode;
String themeCode = AppTheme.LIGHT;
if (Platform.isIOS || Platform.isAndroid) {
await Preferences.init();
themeCode =
Preferences.getString(Constants.PREF_THEME_CODE, AppTheme.LIGHT);
}
AppTheme.code = themeCode;
if (Platform.isIOS || Platform.isAndroid) {
FlutterError.onError = (FlutterErrorDetails details) {
if (isInDebugMode) {
Expand All @@ -36,7 +43,11 @@ void main() async {
await FlutterCrashlytics().initialize();

runZoned<Future<Null>>(() async {
runApp(MyApp());
runApp(
MyApp(
themeData: AppTheme.data,
),
);
}, onError: (error, stackTrace) async {
// Whenever an error occurs, call the `reportCrash` function. This will send
// Dart errors to our dev console or Crashlytics depending on the environment.
Expand All @@ -46,23 +57,38 @@ void main() async {
} else {
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
runApp(MyApp());
runApp(
MyApp(
themeData: AppTheme.data,
),
);
//TODO add other platform Crashlytics
}
}

class MyApp extends StatefulWidget {
final ThemeData themeData;

const MyApp({Key key, @required this.themeData}) : super(key: key);

@override
_MyAppState createState() => _MyAppState();
MyAppState createState() => MyAppState();
}

class _MyAppState extends State<MyApp> {
class MyAppState extends State<MyApp> {
FirebaseAnalytics analytics;
FirebaseMessaging _firebaseMessaging;
Brightness brightness = Brightness.light;
ThemeData themeData;

setThemeData(ThemeData themeData) {
setState(() {
this.themeData = themeData;
});
}

@override
void initState() {
themeData = widget.themeData;
if (Platform.isAndroid || Platform.isIOS) {
analytics = FirebaseAnalytics();
_firebaseMessaging = FirebaseMessaging();
Expand All @@ -76,6 +102,7 @@ class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return ShareDataWidget(
this,
child: MaterialApp(
localeResolutionCallback:
(Locale locale, Iterable<Locale> supportedLocales) {
Expand All @@ -102,18 +129,7 @@ class _MyAppState extends State<MyApp> {
NewsContentPage(null),
LeavePage.routerName: (BuildContext context) => LeavePage(),
},
theme: ThemeData(
brightness: brightness,
hintColor: Colors.white,
accentColor: Resource.Colors.blue,
unselectedWidgetColor: Resource.Colors.grey,
backgroundColor: Colors.black12,
inputDecorationTheme: InputDecorationTheme(
labelStyle: TextStyle(color: Colors.white),
border: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white)),
),
),
theme: themeData,
navigatorObservers: (Platform.isIOS || Platform.isAndroid)
? [
FirebaseAnalyticsObserver(analytics: analytics),
Expand All @@ -123,7 +139,7 @@ class _MyAppState extends State<MyApp> {
const AppLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
CupertinoEnDefaultLocalizationsDelegate(),
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
const Locale('en', 'US'), // English
Expand Down
4 changes: 2 additions & 2 deletions lib/models/bus_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ class BusTime {

Color getColorState() {
return isReserve == 1
? Resource.Colors.blue
: canReserve() ? Resource.Colors.grey : Colors.grey[400];
? Resource.Colors.blueAccent
: canReserve() ? Resource.Colors.grey : Resource.Colors.disabled;
}

String getReserveState(AppLocalizations local) {
Expand Down
11 changes: 6 additions & 5 deletions lib/pages/home/about/about_us_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:nkust_ap/res/assets.dart';
import 'package:nkust_ap/res/resource.dart' as Resource;
import 'package:nkust_ap/utils/global.dart';

Expand Down Expand Up @@ -62,7 +63,7 @@ class AboutUsPageState extends State<AboutUsPage>
backgroundColor: Resource.Colors.blue,
flexibleSpace: FlexibleSpaceBar(
background: Image.asset(
"assets/images/kuasap2.webp",
ImageAssets.kuasap2,
fit: BoxFit.cover,
),
),
Expand All @@ -84,7 +85,7 @@ class AboutUsPageState extends State<AboutUsPage>
child: Align(
alignment: Alignment.topRight,
child: Image.asset(
"assets/images/kuas_itc.webp",
ImageAssets.kuasITC,
width: 64.0,
fit: BoxFit.cover,
),
Expand Down Expand Up @@ -116,7 +117,7 @@ class AboutUsPageState extends State<AboutUsPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Image.asset("assets/images/ic_fb.webp"),
icon: Image.asset(ImageAssets.fb),
onPressed: () {
if (Platform.isAndroid)
Utils.launchUrl('fb://page/735951703168873')
Expand All @@ -136,7 +137,7 @@ class AboutUsPageState extends State<AboutUsPage>
iconSize: 48.0,
),
IconButton(
icon: Image.asset("assets/images/ic_github.webp"),
icon: Image.asset(ImageAssets.github),
onPressed: () {
if (Platform.isAndroid)
Utils.launchUrl(
Expand All @@ -154,7 +155,7 @@ class AboutUsPageState extends State<AboutUsPage>
iconSize: 48.0,
),
IconButton(
icon: Image.asset("assets/images/ic_email.webp"),
icon: Image.asset(ImageAssets.email),
onPressed: () {
Utils.launchUrl('mailto:[email protected]')
.catchError((onError) => Utils.showToast(
Expand Down
31 changes: 15 additions & 16 deletions lib/pages/home/bus/bus_reservations_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class BusReservationsPageState extends State<BusReservationsPage>
child: Icon(
Icons.directions_bus,
size: 20.0,
color: Resource.Colors.blue,
color: Resource.Colors.blueAccent,
),
),
Expanded(
Expand Down Expand Up @@ -172,21 +172,20 @@ class BusReservationsPageState extends State<BusReservationsPage>
context: context,
builder: (BuildContext context) =>
YesNoDialog(
title: app.busCancelReserve,
contentWidget: Text(
"${app.busCancelReserveConfirmContent1}${busReservation.getStart(app)}"
"${app.busCancelReserveConfirmContent2}${busReservation.getEnd(app)}\n"
"${busReservation.getTime()}${app.busCancelReserveConfirmContent3}",
textAlign: TextAlign.center,
),
leftActionText: app.back,
rightActionText: app.determine,
rightActionFunction: () {
_cancelBusReservation(
busReservation);
FA.logAction('cancel_bus', 'click');
},
),
title: app.busCancelReserve,
contentWidget: Text(
"${app.busCancelReserveConfirmContent1}${busReservation.getStart(app)}"
"${app.busCancelReserveConfirmContent2}${busReservation.getEnd(app)}\n"
"${busReservation.getTime()}${app.busCancelReserveConfirmContent3}",
textAlign: TextAlign.center,
),
leftActionText: app.back,
rightActionText: app.determine,
rightActionFunction: () {
_cancelBusReservation(busReservation);
FA.logAction('cancel_bus', 'click');
},
),
);
FA.logAction('cancel_bus', 'create');
},
Expand Down
Loading

0 comments on commit a06da77

Please sign in to comment.