//这是我的 webview 的 flutter 代码
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child : WebviewScaffold(
url: "https://www.facebook.com/",
// appBar: new AppBar(
// // title: new Text('Hairtips'),
// ),
withZoom: true,
withLocalStorage: true,
)
),
);
}
我正在我的 flutter 应用程序中实现 webview。我的片段中有三个 textview。当我点击 textview 时,我想在对话框中打开 webview。我知道如何在 android 中实现它。请建议我一些解决方案来修复这个问题
最佳答案
check this output 您可以通过将其包装在容器中来向 WebViewScaffold 添加填充。
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class WebViewDialogDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding:EdgeInsets.Symmetric(
horizontal:20,
vertical:40
),
child: WebviewScaffold(
url: "https://instagram.com/mahi7781",
withZoom: true,
withLocalStorage: true,
initialChild: Container(
color: Colors.redAccent,
child: const Center(
child: Text("Loading...."),
),
),
));
}
}
关于Flutter 在对话框中打开 webview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54663587/