From 933b0c3e608adb8377878189d3254e81f309a281 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 21 Feb 2022 17:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/web/web_turntable_activity.dart | 40 ++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/web/web_turntable_activity.dart b/lib/web/web_turntable_activity.dart index 3da0be09..a0441bc7 100644 --- a/lib/web/web_turntable_activity.dart +++ b/lib/web/web_turntable_activity.dart @@ -1,8 +1,34 @@ +import 'dart:io'; +import 'dart:ui'; + import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:webview_flutter/webview_flutter.dart'; +import 'package:flutter/cupertino.dart'; + +class WebTurntableActivity extends StatefulWidget { + final Map arguments; + + ///转盘活动 + WebTurntableActivity({this.arguments}); + + @override + State createState() { + return _WebTurntableActivity(); + } +} + +class _WebTurntableActivity extends State with WidgetsBindingObserver { + final ScrollController scrollController = ScrollController(); -class WebTurntableActivity extends StatelessWidget { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addObserver(this); + if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); + + } @override Widget build(BuildContext context) { @@ -28,10 +54,12 @@ class WebTurntableActivity extends StatelessWidget { body: Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, - child: - WebView( - initialUrl: "http://192.168.10.90:5500/lottery.html", - )), + alignment: Alignment.center, + child: + WebView( + initialUrl: "http://192.168.10.90:5500/lottery.html", + javascriptMode: JavascriptMode.unrestricted, + )), ); } -} \ No newline at end of file +}