Blame view

lib/common/pages/wow_web_page.dart 1.95 KB
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
1
  import 'package:flutter/material.dart';
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
2
  import 'package:flutter_easyloading/flutter_easyloading.dart';
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  import 'package:webview_flutter/webview_flutter.dart';
  import 'package:wow_english/common/widgets/we_app_bar.dart';
  
  class WowWebViewPage extends StatefulWidget {
    const WowWebViewPage({super.key, required this.urlStr, required this.webViewTitle});
  
    final String urlStr;
    final String webViewTitle;
  
    @override
    State<StatefulWidget> createState() {
      return _WowWebViewPageState();
    }
  }
  
  class _WowWebViewPageState extends State<WowWebViewPage> {
  
5c307a65   liangchengyou   feat:隐藏测试账号部分功能
20
    late  WebViewController _controller;
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
21
22
23
24
  
    @override
    void initState() {
      super.initState();
c95453ce   Key   feat: User界面完善
25
      /*if (Platform.isIOS) {
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
26
27
28
        LimitingDirectionCsx.setScreenDirection(DeviceDirectionMask.PortraitUpsideDown);
      } else {
        SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
c95453ce   Key   feat: User界面完善
29
      }*/
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
30
  
5c307a65   liangchengyou   feat:隐藏测试账号部分功能
31
      _controller =WebViewController()
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        ..setJavaScriptMode(JavaScriptMode.unrestricted)
        ..setBackgroundColor(const Color(0x00000000))
        ..setNavigationDelegate(
          NavigationDelegate(
            onProgress: (int progress) {
              // Update loading bar.
            },
            onPageStarted: (String url) {
              EasyLoading.show();
            },
            onPageFinished: (String url) {
              EasyLoading.dismiss();
            },
            onWebResourceError: (WebResourceError error) {
              EasyLoading.showError(error.description);
            },
            onNavigationRequest: (NavigationRequest request) {
              return NavigationDecision.navigate;
            },
          ),
        )
        ..loadRequest(Uri.parse(widget.urlStr));
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
54
55
56
57
58
59
60
61
62
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        backgroundColor: Colors.white,
        appBar: WEAppBar(
          titleText: widget.webViewTitle,
        ),
1e7094e3   liangchengyou   feat:适配ipad
63
64
65
66
67
68
        body: Container(
          color: Colors.white,
          child: SafeArea(
            child: WebViewWidget(controller: _controller,),
          )
        ),
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
69
70
      );
    }
c95453ce   Key   feat: User界面完善
71
  }