-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b2d3fe
commit fe9d23f
Showing
15 changed files
with
259 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This is a generated file; do not edit or check into version control. | ||
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter | ||
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo | ||
FLUTTER_TARGET=lib/main.dart | ||
FLUTTER_BUILD_DIR=build | ||
SYMROOT=${SOURCE_ROOT}/../build/ios | ||
OTHER_LDFLAGS=$(inherited) -framework Flutter | ||
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios | ||
FLUTTER_BUILD_NAME=1.0.0 | ||
FLUTTER_BUILD_NUMBER=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This is a generated file; do not edit or check into version control. | ||
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter | ||
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo | ||
FLUTTER_TARGET=lib/main.dart | ||
FLUTTER_BUILD_DIR=build | ||
SYMROOT=${SOURCE_ROOT}/../build/ios | ||
OTHER_LDFLAGS=$(inherited) -framework Flutter | ||
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios | ||
FLUTTER_BUILD_NAME=1.0.0 | ||
FLUTTER_BUILD_NUMBER=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
# This is a generated file; do not edit or check into version control. | ||
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter" | ||
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo" | ||
export "FLUTTER_TARGET=lib/main.dart" | ||
export "FLUTTER_BUILD_DIR=build" | ||
export "SYMROOT=${SOURCE_ROOT}/../build/ios" | ||
export "OTHER_LDFLAGS=$(inherited) -framework Flutter" | ||
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios" | ||
export "FLUTTER_BUILD_NAME=1.0.0" | ||
export "FLUTTER_BUILD_NUMBER=1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
# This is a generated file; do not edit or check into version control. | ||
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter" | ||
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo" | ||
export "FLUTTER_TARGET=lib/main.dart" | ||
export "FLUTTER_BUILD_DIR=build" | ||
export "SYMROOT=${SOURCE_ROOT}/../build/ios" | ||
export "OTHER_LDFLAGS=$(inherited) -framework Flutter" | ||
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios" | ||
export "FLUTTER_BUILD_NAME=1.0.0" | ||
export "FLUTTER_BUILD_NUMBER=1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class CustomRaisedButton extends StatelessWidget { | ||
String label; | ||
bool inProgress; | ||
VoidCallback onPressed; | ||
double height, minWidth; | ||
CustomRaisedButton( | ||
{this.label, | ||
this.inProgress = false, | ||
this.height, | ||
this.minWidth, | ||
this.onPressed}); | ||
@override | ||
Widget build(BuildContext context) { | ||
return ButtonTheme( | ||
height: height, | ||
minWidth: minWidth, | ||
child: RaisedButton( | ||
shape: RoundedRectangleBorder( | ||
borderRadius: new BorderRadius.circular(20.0), | ||
), | ||
color: Theme.of(context).primaryColor, | ||
child: inProgress | ||
? CircularProgressIndicator( | ||
valueColor: | ||
new AlwaysStoppedAnimation<Color>(Color(0xfff5f5f5)), | ||
) | ||
: Text( | ||
'$label', | ||
style: TextStyle(color: Colors.white), | ||
), | ||
onPressed: onPressed, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
import '../start.dart'; | ||
import 'package:data_connection_checker/data_connection_checker.dart'; | ||
import 'package:flushbar/flushbar.dart'; | ||
import '../services/GetItLocator.dart'; | ||
import '../services/RemoteConfigService.dart'; | ||
import '../services/FirebaseService.dart'; | ||
import '../commons/CustomRaisedButton.dart'; | ||
import '../Provider/AppProvider.dart'; | ||
|
||
class NoInternetScreen extends StatefulWidget { | ||
@override | ||
_NoInternetScreenState createState() => _NoInternetScreenState(); | ||
} | ||
|
||
class _NoInternetScreenState extends State<NoInternetScreen> { | ||
FirebaseService firebaseService = locator<FirebaseService>(); | ||
final RemoteConfigService _remoteConfigService = | ||
locator<RemoteConfigService>(); | ||
bool inProgress = false; | ||
@override | ||
Widget build(BuildContext context) { | ||
final appProvider = Provider.of<AppProvider>(context); | ||
return Scaffold( | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: <Widget>[ | ||
Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Container( | ||
width: MediaQuery.of(context).size.width * 0.6, | ||
child: Image.asset('assets/images/nointernet.png'), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(top:8.0, bottom: 4.0), | ||
child: Text( | ||
"No internet available", | ||
style: TextStyle( | ||
fontSize: 24, | ||
color: Colors.black, | ||
fontWeight: FontWeight.w500), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 8.0, left: 14.0, right: 14.0), | ||
child: Text( | ||
"You are offline. Please turn on your mobile data to get updates.", | ||
textAlign: TextAlign.center, | ||
style: TextStyle( | ||
fontSize: 18, | ||
color: Theme.of(context).primaryColorDark, | ||
fontWeight: FontWeight.w300), | ||
), | ||
), | ||
CustomRaisedButton( | ||
label: 'Refresh', | ||
minWidth: 100, | ||
height: 40, | ||
inProgress: inProgress, | ||
onPressed: () async{ | ||
setState(() { | ||
inProgress = true; | ||
}); | ||
bool result = await DataConnectionChecker().hasConnection; | ||
|
||
if(result == true) { | ||
await _remoteConfigService.initialise(); | ||
final currentUser = await firebaseService.getCurrentUser(); | ||
appProvider.currentUser = currentUser; | ||
setState(() { | ||
inProgress = false; | ||
}); | ||
Navigator.of(context).pushReplacement(new MaterialPageRoute( | ||
builder: (context) => Start())); | ||
} | ||
else { | ||
setState(() { | ||
inProgress = false; | ||
}); | ||
Flushbar( | ||
icon: Icon( | ||
Icons.error, | ||
size: 35, | ||
color: Colors.white, | ||
), | ||
title: "Error", | ||
message: 'You are offline', | ||
flushbarPosition: FlushbarPosition.TOP, | ||
backgroundColor: Colors.red, | ||
duration: Duration(seconds: 3), | ||
flushbarStyle: FlushbarStyle.FLOATING, | ||
showProgressIndicator: true, | ||
progressIndicatorBackgroundColor: Colors.white, | ||
).show(context); | ||
} | ||
}, | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.