Skip to content

Commit 38aaba2

Browse files
committed
flag for android view
1 parent ed4d12b commit 38aaba2

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

lib/common/config/Config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class Config {
22
static const PAGE_SIZE = 20;
33
static const DEBUG = true;
4+
static const USE_NATIVE_WEBVIEW = false;
45

56

67
/// //////////////////////////////////////常量////////////////////////////////////// ///

lib/page/CodeDetailPageWeb.dart

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import 'dart:convert';
33
import 'package:flutter/material.dart';
44
import 'package:flutter_spinkit/flutter_spinkit.dart';
55
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
6+
import 'package:gsy_github_app_flutter/common/config/Config.dart';
67
import 'package:gsy_github_app_flutter/common/dao/ReposDao.dart';
78
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
89
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
910
import 'package:gsy_github_app_flutter/common/utils/HtmlUtils.dart';
1011
import '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
}

lib/page/HomePage.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import 'package:gsy_github_app_flutter/page/TrendPage.dart';
1111
import 'package:gsy_github_app_flutter/widget/GSYTabBarWidget.dart';
1212
import 'package:gsy_github_app_flutter/widget/GSYTitleBar.dart';
1313
import 'package:gsy_github_app_flutter/widget/HomeDrawer.dart';
14-
import 'package:gsy_github_app_flutter/widget/webview/WebView.dart';
1514

1615
/**
1716
* 主页
@@ -54,7 +53,6 @@ class HomePage extends StatelessWidget {
5453
_renderTab(GSYICons.MAIN_DT, CommonUtils.getLocale(context).home_dynamic),
5554
_renderTab(GSYICons.MAIN_QS, CommonUtils.getLocale(context).home_trend),
5655
_renderTab(GSYICons.MAIN_MY, CommonUtils.getLocale(context).home_my),
57-
_renderTab(GSYICons.MAIN_MY, CommonUtils.getLocale(context).home_my),
5856
];
5957
return WillPopScope(
6058
onWillPop: () {
@@ -68,9 +66,6 @@ class HomePage extends StatelessWidget {
6866
new DynamicPage(),
6967
new TrendPage(),
7068
new MyPage(),
71-
new WebView(initialUrl: 'https://www.baidu.com',
72-
javaScriptMode: JavaScriptMode.unrestricted,
73-
),
7469
],
7570
backgroundColor: GSYColors.primarySwatch,
7671
indicatorColor: Color(GSYColors.white),

lib/page/RepositoryDetailPage.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ class ReposDetailModel extends Model {
266266

267267
void setCurrentIndex(int index) {
268268
_currentIndex = index;
269-
print("----");
270-
print(_currentIndex);
271269
notifyListeners();
272270
}
273271
}

0 commit comments

Comments
 (0)