关于Flutter的TabBarView中的webviewScaffold

时间:2020-06-06 20:00:02

标签: android flutter flutter-dependencies mobile-application flutter-web

如何在我的Tabbarview中设置WebviewScaffold?

import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          elevation: 0,
          title: Text('Hi'),
          bottom: TabBar(
            tabs: [
              Tab(icon: Icon(Icons.directions_car)),
              Tab(icon: Icon(Icons.directions_transit)),
              Tab(icon: Icon(Icons.directions_bike)),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            Scaffold(
              body: Center(child: Text("second"),),
            ),

           Scaffold(
             body:  WebviewScaffold(
               appCacheEnabled: true,
               withJavascript: true,
               url: "https://pub.dev/packages/flutter_webview_plugin",
             ),
           ),

            Scaffold(
              body: Center(child: Text("third"),),
            )
          ],
        )
      ),
    );
  }
}

在上述代码中调用Webview Scaffold时,它占据了整个屏幕,但我不想占据整个屏幕。并且我已经使用了webview,但是滚动时很烂。

0 个答案:

没有答案