11import 'package:flutter/material.dart' ;
2+ import 'package:fluttertoast/fluttertoast.dart' ;
23import 'package:gsy_github_app_flutter/common/dao/IssueDao.dart' ;
34import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
45import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart' ;
6+ import 'package:gsy_github_app_flutter/widget/GSYFlexButton.dart' ;
57import 'package:gsy_github_app_flutter/widget/GSYListState.dart' ;
68import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart' ;
79import 'package:gsy_github_app_flutter/widget/IssueHeaderItem.dart' ;
@@ -56,7 +58,39 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
5658 issueItemViewModel,
5759 hideBottom: true ,
5860 limitComment: false ,
59- onPressed: () {},
61+ onPressed: () {
62+ showDialog (
63+ context: context,
64+ builder: (BuildContext context) {
65+ return new Center (
66+ child: new Container (
67+ decoration: new BoxDecoration (
68+ borderRadius: BorderRadius .all (Radius .circular (4.0 )),
69+ color: Colors .white,
70+ border: new Border .all (color: Color (GSYColors .subTextColor), width: 0.3 )),
71+ margin: EdgeInsets .all (10.0 ),
72+ child: Column (
73+ mainAxisSize: MainAxisSize .min,
74+ mainAxisAlignment: MainAxisAlignment .center,
75+ children: < Widget > [
76+ new GSYFlexButton (
77+ color: Colors .white,
78+ text: GSYStrings .issue_edit_issue_edit_commit,
79+ onPress: () {},
80+ ),
81+ new GSYFlexButton (
82+ color: Colors .white,
83+ text: GSYStrings .issue_edit_issue_delete_commit,
84+ onPress: () {
85+ _deleteCommit (issueItemViewModel.id);
86+ },
87+ ),
88+ ],
89+ ),
90+ ),
91+ );
92+ });
93+ },
6094 );
6195 }
6296
@@ -77,6 +111,16 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
77111 }
78112 }
79113
114+ _deleteCommit (id) {
115+ Navigator .pop (context);
116+ CommonUtils .showLoadingDialog (context);
117+ //提交修改
118+ IssueDao .deleteCommentDao (userName, reposName, issueNum, id).then ()((result) {
119+ showRefreshLoading ();
120+ Navigator .pop (context);
121+ });
122+ }
123+
80124 _editIssue () {
81125 String title = issueHeaderViewModel.issueComment;
82126 String content = issueHeaderViewModel.issueDesHtml;
@@ -93,6 +137,14 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
93137 content = contentValue;
94138 },
95139 () {
140+ if (title == null || title.trim ().length == 0 ) {
141+ Fluttertoast .showToast (msg: GSYStrings .issue_edit_issue_title_not_be_null);
142+ return ;
143+ }
144+ if (content == null || content.trim ().length == 0 ) {
145+ Fluttertoast .showToast (msg: GSYStrings .issue_edit_issue_content_not_be_null);
146+ return ;
147+ }
96148 CommonUtils .showLoadingDialog (context);
97149 //提交修改
98150 IssueDao .editIssueDao (userName, reposName, issueNum, {"title" : title, "body" : content}).then ((result) {
@@ -113,6 +165,10 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
113165 CommonUtils .showEditDialog (context, GSYStrings .issue_reply_issue, null , (replyContent) {
114166 content = replyContent;
115167 }, () {
168+ if (content == null || content.trim ().length == 0 ) {
169+ Fluttertoast .showToast (msg: GSYStrings .issue_edit_issue_content_not_be_null);
170+ return ;
171+ }
116172 CommonUtils .showLoadingDialog (context);
117173 //提交评论
118174 IssueDao .addIssueCommentDao (userName, reposName, issueNum, content).then ((result) {
0 commit comments