Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/web_view_redirect.dart
  • Loading branch information
Usama committed Nov 10, 2021
2 parents 88d541f + 2f35531 commit 289414f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 103 deletions.
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


android {
compileSdkVersion 31

Expand All @@ -56,6 +57,7 @@ android {
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
signingConfig signingConfigs.release
Expand Down
File renamed without changes
1 change: 1 addition & 0 deletions lib/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class _ErrorScreenState extends State<ErrorScreen> {
textAlign: TextAlign.center,
style: TextStyle(color: Color(0xFF5F6368,)),
),

],
),
GestureDetector(
Expand Down
117 changes: 15 additions & 102 deletions lib/web_view_redirect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,19 @@ class _WebViewPageState extends State<WebViewPage> {
}

void downloadFile({required String url}) async{
print('.........started');

final taskId = await FlutterDownloader.enqueue(
saveInPublicStorage: true,
fileName: 'prasoInvoice_${DateTime.now().toString().replaceAll(' ', '').replaceAll(':', '').replaceAll('-', '').replaceAll('.', '')}.pdf',
fileName: 'prasoInvoice_${DateTime.now().toString().replaceAll(' ', '').replaceAll(':', '').replaceAll('-', '').replaceAll('.', '')}',
url: url,
savedDir: '/storage/emulated/0/',
showNotification: true, // show download progress in status bar (for Android)
openFileFromNotification: true, // click on notification to open downloaded file (for Android)
);
final tasks = await FlutterDownloader.loadTasks();

print('competed....!$taskId......${tasks![0]}');
}

@override
Expand All @@ -102,6 +104,7 @@ class _WebViewPageState extends State<WebViewPage> {
String id = data[0];
DownloadTaskStatus status = data[1];
int progress = data[2];
print('id......$id...........progress....$progress.......status.....${status.value}');
setState((){

});
Expand Down Expand Up @@ -173,108 +176,18 @@ class _WebViewPageState extends State<WebViewPage> {
prasoNotifyProvider!.url = url;
},
navigationDelegate: (navigation) async {
String pdfCheck = navigation.url.substring((navigation.url.length-3), navigation.url.length);
if(navigation.url.contains('https://api.pagar.me') && pdfCheck.contains('pdf')) {
downloadFile(url: navigation.url);
return Future.value(NavigationDecision.prevent);
}

print(navigation.url);
return Future.value(NavigationDecision.navigate);
},
gestureNavigationEnabled: true,
),

//bottom navigation bar
Selector<PrasoNotifyProvider, String>(
selector: (context, prasoNotifyProvider) => prasoNotifyProvider.url,
builder: (context, value, child) => Visibility(
visible: prasoNotifyProvider!.url.contains('https://praso.com.br/'),
child: Positioned(
right: 0,
bottom: 0,
left: 0,
child: Card(
elevation: 20,
child: Container(
height: 90,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
//home icon
GestureDetector(
onTap: () async {
while (await _webViewController!.canGoBack()) {
_webViewController!.goBack();
prasoNotifyProvider!.homeIcon = Colors.blue;
prasoNotifyProvider!.categoryIcon =
Colors.black;
prasoNotifyProvider!.accountIcon =
Colors.black;
}
},
child: Selector<PrasoNotifyProvider, Color>(
selector: (context, prasoNotifyProvider) =>
prasoNotifyProvider.homeIcon,
builder: (context, value, child) =>
bottomNavigationBarItems(
imagePath: prasoNotifyProvider!.url.length == 'https://praso.com.br/'.length ? 'assets/images/home_select.png':'assets/images/home_icon.png',
iconText: 'início',
color: prasoNotifyProvider!.homeIcon))),

//category icon
GestureDetector(
onTap: () {
prasoNotifyProvider!.homeIcon = Colors.black;
prasoNotifyProvider!.categoryIcon = Colors.blue;
prasoNotifyProvider!.accountIcon = Colors.black;
_webViewController!.loadUrl('https://praso.com.br/collections/acucares');
},
child: Selector<PrasoNotifyProvider, Color>(
selector: (context, prasoNotifyProvider) =>
prasoNotifyProvider.categoryIcon,
builder: (context, value, child) =>
bottomNavigationBarItems(imagePath: prasoNotifyProvider!.url.length == 'https://praso.com.br/collections/acucares'.length ? 'assets/images/catagories_select.png': 'assets/images/categories_icon.png',
iconText: 'categorias',
color: prasoNotifyProvider!
.categoryIcon))),

//account icon
GestureDetector(
onTap: () {
prasoNotifyProvider!.homeIcon = Colors.black;
prasoNotifyProvider!.categoryIcon =
Colors.black;
prasoNotifyProvider!.accountIcon = Colors.blue;
_webViewController!.loadUrl('https://praso.com.br/account/login?return_url=%2Faccount');
},
child: Selector<PrasoNotifyProvider, Color>(
selector: (context, prasoNotifyProvider) =>
prasoNotifyProvider.accountIcon,
builder: (context, value, child) =>
bottomNavigationBarItems(
imagePath: prasoNotifyProvider!.url.length == 'https://praso.com.br/account/login?return_url=%2Faccount'.length ? 'assets/images/contact_select.png' :'assets/images/contact_icon.png',
iconText: 'conta',
color: prasoNotifyProvider!
.accountIcon))),
GestureDetector(
onTap: () {
openWhatsApp();
},
child: bottomNavigationBarItems(
imagePath: 'assets/images/whats_app_icon.png',
iconText: 'WhatsApp',
color: Colors.black)),
],
),),
),
),
),
)
]),
bottomNavigationBar: Selector<PrasoNotifyProvider, String>(
selector: (context, prasoNotifyProvider) => prasoNotifyProvider.url,
builder: (context, value, child) => Visibility(
visible: !(prasoNotifyProvider!.url.contains('https://praso.com.br/')),
Positioned(
right: 0,
bottom: 0,
left: 0,
child: Card(
elevation: 20,
child: Container(
Expand All @@ -299,7 +212,7 @@ class _WebViewPageState extends State<WebViewPage> {
},
child: Selector<PrasoNotifyProvider, Color>(
selector: (context, prasoNotifyProvider) =>
prasoNotifyProvider.homeIcon,
prasoNotifyProvider.homeIcon,
builder: (context, value, child) =>
bottomNavigationBarItems(
imagePath: prasoNotifyProvider!.url.length == 'https://praso.com.br/'.length ? 'assets/images/home_select.png':'assets/images/home_icon.png',
Expand All @@ -316,7 +229,7 @@ class _WebViewPageState extends State<WebViewPage> {
},
child: Selector<PrasoNotifyProvider, Color>(
selector: (context, prasoNotifyProvider) =>
prasoNotifyProvider.categoryIcon,
prasoNotifyProvider.categoryIcon,
builder: (context, value, child) =>
bottomNavigationBarItems(imagePath: prasoNotifyProvider!.url.length == 'https://praso.com.br/collections/acucares'.length ? 'assets/images/catagories_select.png': 'assets/images/categories_icon.png',
iconText: 'categorias',
Expand All @@ -334,7 +247,7 @@ class _WebViewPageState extends State<WebViewPage> {
},
child: Selector<PrasoNotifyProvider, Color>(
selector: (context, prasoNotifyProvider) =>
prasoNotifyProvider.accountIcon,
prasoNotifyProvider.accountIcon,
builder: (context, value, child) =>
bottomNavigationBarItems(
imagePath: prasoNotifyProvider!.url.length == 'https://praso.com.br/account/login?return_url=%2Faccount'.length ? 'assets/images/contact_select.png' :'assets/images/contact_icon.png',
Expand All @@ -353,8 +266,8 @@ class _WebViewPageState extends State<WebViewPage> {
),
)),
),
),
),
)
]),
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ flutter:
- assets/images/home_select.png
- assets/images/categories_icon.png
- assets/images/catagories_select.png
- assets/images/contact_icon.png
- assets/images/contact.png
- assets/images/contact_select.png

# - images/a_dot_ham.jpeg
Expand Down

0 comments on commit 289414f

Please sign in to comment.