Skip to content

Commit ef42178

Browse files
committed
完成issue的编辑处理
1 parent 4eb9a47 commit ef42178

3 files changed

Lines changed: 36 additions & 5 deletions

File tree

‎lib/common/dao/IssueDao.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class IssueDao {
181181
*/
182182
static deleteCommentDao(userName, repository, number, commentId) async {
183183
String url = Address.editComment(userName, repository, commentId);
184-
var res = await HttpManager.netFetch(url, null, null, new Options(method: 'DELETE', contentType: ContentType.TEXT), noTip: true);
184+
var res = await HttpManager.netFetch(url, null, null, new Options(method: 'DELETE'), noTip: true);
185185
if (res != null && res.result) {
186186
return new DataResult(res.data, true);
187187
} else {

‎lib/page/IssueDetailPage.dart‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
7676
new GSYFlexButton(
7777
color: Colors.white,
7878
text: GSYStrings.issue_edit_issue_edit_commit,
79-
onPress: () {},
79+
onPress: () {
80+
_editCommit(issueItemViewModel.id, issueItemViewModel.issueComment);
81+
},
8082
),
8183
new GSYFlexButton(
8284
color: Colors.white,
@@ -111,13 +113,43 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
111113
}
112114
}
113115

116+
_editCommit(id, content) {
117+
Navigator.pop(context);
118+
String contentData = content;
119+
issueInfoValueControl = new TextEditingController(text: contentData);
120+
//编译Issue Info
121+
CommonUtils.showEditDialog(
122+
context,
123+
GSYStrings.issue_edit_issue,
124+
null,
125+
(contentValue) {
126+
contentData = contentValue;
127+
},
128+
() {
129+
if (contentData == null || contentData.trim().length == 0) {
130+
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
131+
return;
132+
}
133+
CommonUtils.showLoadingDialog(context);
134+
//提交修改
135+
IssueDao.editCommentDao(userName, reposName, issueNum, id, {"body": contentData}).then((result) {
136+
showRefreshLoading();
137+
Navigator.pop(context);
138+
Navigator.pop(context);
139+
});
140+
},
141+
valueController: issueInfoValueControl,
142+
needTitle: false,
143+
);
144+
}
145+
114146
_deleteCommit(id) {
115147
Navigator.pop(context);
116148
CommonUtils.showLoadingDialog(context);
117149
//提交修改
118-
IssueDao.deleteCommentDao(userName, reposName, issueNum, id).then()((result) {
119-
showRefreshLoading();
150+
IssueDao.deleteCommentDao(userName, reposName, issueNum, id).then((result) {
120151
Navigator.pop(context);
152+
showRefreshLoading();
121153
});
122154
}
123155

‎lib/widget/GSYPullLoadWidget.dart‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class _GSYPullLoadWidgetState extends State<GSYPullLoadWidget> {
8888

8989
Widget _buildProgressIndicator() {
9090
Widget bottomWidget = (control.needLoadMore) ? new CircularProgressIndicator() : new Text(GSYStrings.load_more_not);
91-
print(bottomWidget);
9291
return new Padding(
9392
padding: const EdgeInsets.all(20.0),
9493
child: new Center(

0 commit comments

Comments
 (0)