|
|
|
import 'dart:io';
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
import 'package:webview_flutter/src/webview_cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
class WebTurntableActivity extends StatefulWidget {
|
|
|
|
final Map<String, dynamic> arguments;
|
|
|
|
|
|
|
|
///转盘活动
|
|
|
|
WebTurntableActivity({this.arguments});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _WebTurntableActivity();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _WebTurntableActivity extends State<WebTurntableActivity> with WidgetsBindingObserver {
|
|
|
|
final ScrollController scrollController = ScrollController();
|
|
|
|
String token;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
WidgetsBinding.instance.addObserver(this);
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) => {
|
|
|
|
token = value.getString('token'),
|
|
|
|
});
|
|
|
|
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
|
|
|
|
if (Platform.isIOS) WebView.platform = CupertinoWebView();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: MyAppBar(
|
|
|
|
action: Container(
|
|
|
|
margin: EdgeInsets.only(right: 10),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
// share();
|
|
|
|
},
|
|
|
|
child: Icon(
|
|
|
|
Icons.share,
|
|
|
|
size: 24,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: "",
|
|
|
|
background: Color(0xFFFFFFFFF),
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
height: MediaQuery.of(context).size.height,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child:
|
|
|
|
WebView(
|
|
|
|
initialUrl: "http://192.168.10.90:5500/lottery.html?token=${token}",
|
|
|
|
javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|