Skip to content

Commit 92306ad

Browse files
committed
提出一些无用代码
1 parent ebc0d53 commit 92306ad

File tree

7 files changed

+34
-165
lines changed

7 files changed

+34
-165
lines changed

lib/common/config/config.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
class Config {
22
static const PAGE_SIZE = 20;
33
static const DEBUG = true;
4-
static const USE_NATIVE_WEBVIEW = true;
5-
64

75
/// //////////////////////////////////////常量////////////////////////////////////// ///
86
static const TOKEN_KEY = "token";

lib/common/dao/repos_dao.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,8 @@ class ReposDao {
671671
url,
672672
null,
673673
{
674-
"Accept": (needHtml
675-
? 'application/vnd.github.html,application/vnd.github.VERSION.raw'
676-
: "")
674+
"Accept":
675+
'application/vnd.github.html,application/vnd.github.VERSION.raw'
677676
},
678677
null);
679678
if (res != null && res.result && res.data.length > 0) {

lib/common/utils/navigator_utils.dart

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'dart:async';
33
import 'package:flutter/cupertino.dart';
44
import 'package:flutter/material.dart';
55
import 'package:gsy_github_app_flutter/common/router/anima_route.dart';
6-
import 'package:gsy_github_app_flutter/page/code_detail_page.dart';
76
import 'package:gsy_github_app_flutter/page/code_detail_page_web.dart';
87
import 'package:gsy_github_app_flutter/page/common_list_page.dart';
98
import 'package:gsy_github_app_flutter/page/gsy_webview.dart';
@@ -109,27 +108,6 @@ class NavigatorUtils {
109108
));
110109
}
111110

112-
///文件代码详情
113-
static gotoCodeDetailPage(BuildContext context,
114-
{String title,
115-
String userName,
116-
String reposName,
117-
String path,
118-
String data,
119-
String branch,
120-
String htmlUrl}) {
121-
NavigatorRouter(
122-
context,
123-
new CodeDetailPage(
124-
title: title,
125-
userName: userName,
126-
reposName: reposName,
127-
path: path,
128-
data: data,
129-
branch: branch,
130-
htmlUrl: htmlUrl,
131-
));
132-
}
133111

134112
///仓库详情通知
135113
static Future goNotifyPage(BuildContext context) {

lib/page/code_detail_page.dart

Lines changed: 0 additions & 92 deletions
This file was deleted.

lib/page/code_detail_page_web.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@ class _CodeDetailPageState extends State<CodeDetailPageWeb> {
101101
);
102102
}
103103

104-
if (Config.USE_NATIVE_WEBVIEW && Platform.isAndroid) {
105-
return Scaffold(
106-
appBar: AppBar(
107-
title: new Text(widget.title),
108-
),
109-
body: WebView(
110-
initialUrl: data,
111-
javascriptMode: JavascriptMode.unrestricted,
112-
),
113-
);
114-
}
115104
return Scaffold(
116105
appBar: AppBar(
117106
title: new Text(widget.title),

lib/page/gsy_webview.dart

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import 'dart:convert';
2-
31
import 'package:flutter/cupertino.dart';
42
import 'package:flutter/material.dart';
5-
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
63
import 'package:gsy_github_app_flutter/widget/gsy_common_option_widget.dart';
74
import 'package:webview_flutter/webview_flutter.dart';
85

@@ -24,15 +21,23 @@ class GSYWebView extends StatelessWidget {
2421
}
2522
optionControl.url = url;
2623
return new Row(children: [
27-
new Expanded(child: new Container()),
24+
new Expanded(
25+
child: new Container(
26+
child: new Text(
27+
title,
28+
maxLines: 1,
29+
overflow: TextOverflow.ellipsis,
30+
),
31+
)),
2832
GSYCommonOptionWidget(optionControl),
2933
]);
3034
}
3135

3236
final FocusNode focusNode = new FocusNode();
37+
3338
@override
3439
Widget build(BuildContext context) {
35-
/*return Scaffold(
40+
return Scaffold(
3641
appBar: new AppBar(
3742
title: _renderTitle(),
3843
),
@@ -42,7 +47,7 @@ class GSYWebView extends StatelessWidget {
4247
focusNode: focusNode,
4348
),
4449
WebView(
45-
initialUrl: new Uri.dataFromString(html, mimeType: 'text/html', encoding: Encoding.getByName("utf-8")).toString(),
50+
initialUrl: url,
4651
javascriptMode: JavascriptMode.unrestricted,
4752
javascriptChannels: Set.from([
4853
JavascriptChannel(
@@ -55,20 +60,10 @@ class GSYWebView extends StatelessWidget {
5560
]))
5661
],
5762
),
58-
);*/
59-
return new WebviewScaffold(
60-
withJavascript: true,
61-
url: url,
62-
scrollBar: true,
63-
withLocalUrl: true,
64-
appBar: new AppBar(
65-
title: _renderTitle(),
66-
),
6763
);
6864
}
6965
}
7066

71-
7267
///测试 html 代码,不管
7368
final testhtml = "<!DOCTYPE html>"
7469
"<html>"

lib/page/release_page.dart

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ class ReleasePage extends StatefulWidget {
3434
_ReleasePageState createState() => _ReleasePageState();
3535
}
3636

37-
38-
class _ReleasePageState extends State<ReleasePage> with AutomaticKeepAliveClientMixin<ReleasePage>, GSYListState<ReleasePage> {
39-
37+
class _ReleasePageState extends State<ReleasePage>
38+
with AutomaticKeepAliveClientMixin<ReleasePage>, GSYListState<ReleasePage> {
4039
///配置标题了右侧的更多显示
4140
final OptionControl titleOptionControl = new OptionControl();
4241

@@ -45,23 +44,21 @@ class _ReleasePageState extends State<ReleasePage> with AutomaticKeepAliveClient
4544

4645
///绘制item
4746
_renderEventItem(index) {
48-
ReleaseItemViewModel releaseItemViewModel = ReleaseItemViewModel.fromMap(pullLoadWidgetControl.dataList[index]);
47+
ReleaseItemViewModel releaseItemViewModel =
48+
ReleaseItemViewModel.fromMap(pullLoadWidgetControl.dataList[index]);
4949
return new ReleaseItem(
5050
releaseItemViewModel,
5151
onPressed: () {
52-
if (selectIndex == 0) {
53-
if (Platform.isIOS) {
54-
NavigatorUtils.gotoCodeDetailPage(
55-
context,
56-
title: releaseItemViewModel.actionTitle,
57-
userName: widget.userName,
58-
reposName: widget.reposName,
59-
data: HtmlUtils.generateHtml(releaseItemViewModel.actionTargetHtml, backgroundColor: GSYColors.webDraculaBackgroundColorString),
60-
);
61-
} else {
62-
String html = HtmlUtils.generateHtml(releaseItemViewModel.actionTargetHtml, backgroundColor: GSYColors.miWhiteString, userBR: false);
63-
CommonUtils.launchWebView(context, releaseItemViewModel.actionTitle, html);
64-
}
52+
///没有 release 提示就不要了
53+
if (selectIndex == 0 &&
54+
releaseItemViewModel.actionTargetHtml != null &&
55+
releaseItemViewModel.actionTargetHtml.length > 0) {
56+
String html = HtmlUtils.generateHtml(
57+
releaseItemViewModel.actionTargetHtml,
58+
backgroundColor: GSYColors.miWhiteString,
59+
userBR: false);
60+
CommonUtils.launchWebView(
61+
context, releaseItemViewModel.actionTitle, html);
6562
}
6663
},
6764
onLongPress: () {
@@ -76,7 +73,10 @@ class _ReleasePageState extends State<ReleasePage> with AutomaticKeepAliveClient
7673
if (await canLaunch(url)) {
7774
await launch(url);
7875
} else {
79-
Fluttertoast.showToast(msg: CommonUtils.getLocale(context).option_web_launcher_error + ": " + url);
76+
Fluttertoast.showToast(
77+
msg: CommonUtils.getLocale(context).option_web_launcher_error +
78+
": " +
79+
url);
8080
}
8181
}
8282

@@ -90,7 +90,9 @@ class _ReleasePageState extends State<ReleasePage> with AutomaticKeepAliveClient
9090
}
9191

9292
_getDataLogic() async {
93-
return await ReposDao.getRepositoryReleaseDao(widget.userName, widget.reposName, page, needHtml: Platform.isAndroid, release: selectIndex == 0);
93+
return await ReposDao.getRepositoryReleaseDao(
94+
widget.userName, widget.reposName, page,
95+
needHtml: true, release: selectIndex == 0);
9496
}
9597

9698
@override

0 commit comments

Comments
 (0)