Flutter - Estou fazendo um webview e preciso habilitar o download via Google Drive

Web

Flutter

19/05/2022

Sou iniciante, gostaria de saber onde estou errado e o que posso fazer pra resolver.
Preciso muito fazer download de arquivos no Google Drive.
Grato se alguém puder me ajudar!!!


import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
late WebViewController controller;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: WillPopScope(
onWillPop: () async {
String? url = await controller.currentUrl();
if (url == 'https://drive.google.com/file/d/1XvWFX9eg97Hqe-2y7U1RKNYmfu7yGqfE/view?usp=sharing') {
return true;
} else {
controller.goBack();
return false;
}
},
child: Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(65),
child: AppBar(
backgroundColor: const Color.fromRGBO(41, 41, 184, 0.8),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(50),
bottomLeft: Radius.circular(50),
)),
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'WwbView ',
),
Image.asset('assets/logo.png', width: 45),
],
),
),
),
body: SafeArea(
child: WebView(
initialUrl: 'https://drive.google.com/file/d/1XvWFX9eg97Hqe-2y7U1RKNYmfu7yGqfE/view?usp=sharing',
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController wc) {
controller = wc;
},
),
),
),
),
);
}
}
Agner Jr

Agner Jr

Curtidas 0
POSTAR