Skip to content

Commit

Permalink
Merge branch '112-connectivity' of https://github.com/mousehunter1121…
Browse files Browse the repository at this point in the history
…/selft_tracking_app into mousehunter1121-112-connectivity
  • Loading branch information
dewmal committed Mar 27, 2020
2 parents cfa342f + fd000e8 commit b8fd71d
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 14 deletions.
35 changes: 25 additions & 10 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
PODS:
- connectivity (0.0.1):
- Flutter
- Reachability
- connectivity_macos (0.0.1):
- Flutter
- Firebase/Core (6.10.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.1.3)
Expand Down Expand Up @@ -123,7 +128,8 @@ PODS:
- Flutter
- path_provider_macos (0.0.1):
- Flutter
- Protobuf (3.11.4)
- Protobuf (3.10.0)
- Reachability (3.2)
- share (0.5.2):
- Flutter
- shared_preferences (0.0.1):
Expand All @@ -143,6 +149,8 @@ PODS:
- Flutter

DEPENDENCIES:
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`)
- Flutter (from `Flutter`)
Expand All @@ -164,28 +172,32 @@ DEPENDENCIES:
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
trunk:
- Firebase
- FirebaseABTesting
- FirebaseAnalytics
- FirebaseAnalyticsInterop
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCoreDiagnosticsInterop
- FirebaseInstanceID
- FirebaseMessaging
- FirebaseRemoteConfig
- FMDB
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleDataTransportCCTSupport
- GoogleMaps
- GoogleUtilities
- nanopb
trunk:
- FirebaseABTesting
- FirebaseAnalyticsInterop
- FirebaseCore
- FirebaseInstanceID
- FirebaseRemoteConfig
- Protobuf
- Reachability

EXTERNAL SOURCES:
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
connectivity_macos:
:path: ".symlinks/plugins/connectivity_macos/ios"
firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios"
firebase_remote_config:
Expand Down Expand Up @@ -226,6 +238,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_web/ios"

SPEC CHECKSUMS:
connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75
connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191
Firebase: 5e6b7b12bf9adb90986688edc06b156c37e109cd
firebase_messaging: cffb57ce40958c6204f03fb0c81713e4cd1e240c
firebase_remote_config: f3581c5addecc691a968f2a7f2bcdf0878509bfd
Expand Down Expand Up @@ -254,7 +268,8 @@ SPEC CHECKSUMS:
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7
Protobuf: a4dc852ad69c027ca2166ed287b856697814375b
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
share: bae0a282aab4483288913fc4dc0b935d4b491f2e
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
Expand All @@ -266,4 +281,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83

COCOAPODS: 1.8.4
COCOAPODS: 1.9.0
43 changes: 39 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'dart:async';

import 'dart:async';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get_it/get_it.dart';
Expand All @@ -9,8 +12,10 @@ import 'package:selftrackingapp/networking/db.dart';
import 'package:selftrackingapp/page/screen/root_screen.dart';
import 'package:selftrackingapp/page/screen/welcome_screen.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'package:connectivity/connectivity.dart';
import 'package:flutter/services.dart';
import 'utils/tracker_colors.dart';
import 'package:dropdown_banner/dropdown_banner.dart';

void main() {
GetIt.instance
Expand All @@ -19,9 +24,16 @@ void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
final navigatorKey = GlobalKey<NavigatorState>();

return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'COVID-19 Tracker',
Expand All @@ -42,7 +54,10 @@ class MyApp extends StatelessWidget {
// Built-in localization for text direction LTR/RTL
GlobalWidgetsLocalizations.delegate,
],
home: HomeScreen(),
home: DropdownBanner(
child: HomeScreen(),
navigatorKey: navigatorKey,
),
);
}
}
Expand Down Expand Up @@ -104,12 +119,32 @@ class _HomeScreenState extends State<HomeScreen> {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/welcome_screen_bg.png"), fit: BoxFit.fill)),
image: AssetImage("assets/images/welcome_screen_bg.png"),
fit: BoxFit.fill)),
); // or some other widget
}

void reachabilityFailedFail() {
DropdownBanner.showBanner(
text: 'Please check your WiFi or mobile data connection',
color: Colors.redAccent,
textStyle: TextStyle(color: Colors.white),
duration: Duration(seconds: 3));
}

void checkReachability() async {
var connectivityResult = await (Connectivity().checkConnectivity());
if (connectivityResult == ConnectivityResult.mobile) {
} else if (connectivityResult == ConnectivityResult.wifi) {
// I am connected to a wifi network.
} else {
reachabilityFailedFail();
}
}

@override
Widget build(BuildContext context) {
checkReachability();
return _createSplashScreen();
}
}
35 changes: 35 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
connectivity:
dependency: "direct main"
description:
name: connectivity
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8+2"
connectivity_macos:
dependency: transitive
description:
name: connectivity_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0+2"
connectivity_platform_interface:
dependency: transitive
description:
name: connectivity_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
convert:
dependency: transitive
description:
Expand All @@ -71,13 +92,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
dart_notification_center:
dependency: transitive
description:
name: dart_notification_center
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0+1"
date_format:
dependency: "direct main"
description:
name: date_format
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
dropdown_banner:
dependency: "direct main"
description:
name: dropdown_banner
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
equatable:
dependency: "direct main"
description:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ dependencies:
geolocator: ^5.1.4+2
async: ^2.4.0
package_info: ^0.4.0+16
connectivity: ^0.4.8+2
dropdown_banner: ^1.4.0
recursive_regex: ^0.1.3+2
webview_flutter: ^0:3:19+9

Expand Down

0 comments on commit b8fd71d

Please sign in to comment.