@@ -3,11 +3,13 @@ import 'dart:convert';
33import 'package:flutter/material.dart' ;
44import 'package:flutter_spinkit/flutter_spinkit.dart' ;
55import 'package:flutter_webview_plugin/flutter_webview_plugin.dart' ;
6+ import 'package:gsy_github_app_flutter/common/config/Config.dart' ;
67import 'package:gsy_github_app_flutter/common/dao/ReposDao.dart' ;
78import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
89import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart' ;
910import 'package:gsy_github_app_flutter/common/utils/HtmlUtils.dart' ;
1011import 'package:gsy_github_app_flutter/widget/GSYTitleBar.dart' ;
12+ import 'package:gsy_github_app_flutter/widget/webview/WebView.dart' ;
1113
1214/**
1315 * 文件代码详情
@@ -71,11 +73,11 @@ class _CodeDetailPageState extends State<CodeDetailPageWeb> {
7173
7274 @override
7375 Widget build (BuildContext context) {
74- if (data == null ) {
76+ if (data == null ) {
7577 return new Scaffold (
7678 appBar: new AppBar (
7779 title: GSYTitleBar (
78- title
80+ title
7981 ),
8082 ),
8183 body: new Center (
@@ -86,15 +88,32 @@ class _CodeDetailPageState extends State<CodeDetailPageWeb> {
8688 child: new Row (
8789 mainAxisAlignment: MainAxisAlignment .center,
8890 children: < Widget > [
89- new SpinKitDoubleBounce (color: Theme .of (context).primaryColor),
91+ new SpinKitDoubleBounce (color: Theme
92+ .of (context)
93+ .primaryColor),
9094 new Container (width: 10.0 ),
91- new Container (child: new Text (CommonUtils .getLocale (context).loading_text, style: GSYConstant .middleText)),
95+ new Container (child: new Text (CommonUtils
96+ .getLocale (context)
97+ .loading_text, style: GSYConstant .middleText)),
9298 ],
9399 ),
94100 ),
95101 ),
96102 );
97103 }
104+
105+ if (Config .USE_NATIVE_WEBVIEW ) {
106+ return Scaffold (
107+ appBar: AppBar (
108+ title: new Text (title),
109+ ),
110+ body: WebView (
111+ initialUrl: data,
112+ javaScriptMode: JavaScriptMode .unrestricted,
113+ ),
114+ );
115+ }
116+
98117 return new WebviewScaffold (
99118 withJavascript: true ,
100119 url: data,
@@ -104,5 +123,6 @@ class _CodeDetailPageState extends State<CodeDetailPageWeb> {
104123 title: new Text (title),
105124 ),
106125 );
126+
107127 }
108128}
0 commit comments