Skip to content

Commit b9972f6

Browse files
committed
add reply and commit
1 parent ec79274 commit b9972f6

2 files changed

Lines changed: 60 additions & 33 deletions

File tree

‎lib/page/IssueDetailPage.dart‎

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,69 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
7777
}
7878
}
7979

80+
_editIssue() {
81+
String title = issueHeaderViewModel.issueComment;
82+
String content = issueHeaderViewModel.issueDesHtml;
83+
issueInfoTitleControl = new TextEditingController(text: title);
84+
issueInfoValueControl = new TextEditingController(text: content);
85+
//编译Issue Info
86+
CommonUtils.showEditDialog(
87+
context,
88+
GSYStrings.issue_edit_issue,
89+
(titleValue) {
90+
title = titleValue;
91+
},
92+
(contentValue) {
93+
content = contentValue;
94+
},
95+
() {
96+
CommonUtils.showLoadingDialog(context);
97+
//提交修改
98+
IssueDao.editIssueDao(userName, reposName, issueNum, {"title": title, "body": content}).then((result) {
99+
_getHeaderInfo();
100+
Navigator.pop(context);
101+
Navigator.pop(context);
102+
});
103+
},
104+
titleController: issueInfoTitleControl,
105+
valueController: issueInfoValueControl,
106+
needTitle: true,
107+
);
108+
}
109+
110+
_replyIssue() {
111+
//回复 Info
112+
String content = "";
113+
CommonUtils.showEditDialog(context, GSYStrings.issue_reply_issue, null, (replyContent) {
114+
content = replyContent;
115+
}, () {
116+
CommonUtils.showLoadingDialog(context);
117+
//提交评论
118+
IssueDao.addIssueCommentDao(userName, reposName, issueNum, content).then((result) {
119+
showRefreshLoading();
120+
Navigator.pop(context);
121+
Navigator.pop(context);
122+
});
123+
}, needTitle: false);
124+
}
125+
80126
_getBottomWidget() {
81127
List<Widget> bottomWidget = (!headerStatus)
82128
? []
83129
: <Widget>[
84130
new FlatButton(
85-
onPressed: () {
86-
//回复 Info
87-
CommonUtils.showEditDialog(context, GSYStrings.issue_reply_issue, null, (replyContent) {}, () {}, needTitle: false);
88-
},
89-
child: new Text(GSYStrings.issue_reply, style: GSYConstant.smallText)),
131+
onPressed: () {
132+
_replyIssue();
133+
},
134+
child: new Text(GSYStrings.issue_reply, style: GSYConstant.smallText),
135+
),
90136
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
91137
new FlatButton(
92-
onPressed: () {
93-
String title = issueHeaderViewModel.issueComment;
94-
String content = issueHeaderViewModel.issueDesHtml;
95-
issueInfoTitleControl = new TextEditingController(text: title);
96-
issueInfoValueControl = new TextEditingController(text: content);
97-
//编译Issue Info
98-
CommonUtils.showEditDialog(
99-
context,
100-
GSYStrings.issue_edit_issue,
101-
(titleValue) {
102-
title = titleValue;
103-
},
104-
(contentValue) {
105-
content = contentValue;
106-
},
107-
() {
108-
//提交
109-
},
110-
titleController: issueInfoTitleControl,
111-
valueController: issueInfoValueControl,
112-
needTitle: true,
113-
);
114-
},
115-
child: new Text(GSYStrings.issue_edit, style: GSYConstant.smallText)),
138+
onPressed: () {
139+
_editIssue();
140+
},
141+
child: new Text(GSYStrings.issue_edit, style: GSYConstant.smallText),
142+
),
116143
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
117144
new FlatButton(
118145
onPressed: () {

‎lib/widget/IssueEditDIalog.dart‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class IssueEditDialog extends StatefulWidget {
2323

2424
final bool needTitle;
2525

26-
IssueEditDialog(this.dialogTitle, this.onContentChanged, this.onTitleChanged, this.onPressed,
26+
IssueEditDialog(this.dialogTitle, this.onTitleChanged, this.onContentChanged, this.onPressed,
2727
{this.titleController, this.valueController, this.needTitle = true});
2828

2929
@override
3030
_IssueEditDialogState createState() =>
31-
_IssueEditDialogState(this.dialogTitle, this.onContentChanged, this.onTitleChanged, this.onPressed, titleController, valueController, needTitle);
31+
_IssueEditDialogState(this.dialogTitle, this.onTitleChanged, this.onContentChanged, this.onPressed, titleController, valueController, needTitle);
3232
}
3333

3434
class _IssueEditDialogState extends State<IssueEditDialog> {
@@ -47,7 +47,7 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
4747
final bool needTitle;
4848

4949
_IssueEditDialogState(
50-
this.dialogTitle, this.onContentChanged, this.onTitleChanged, this.onPressed, this.titleController, this.valueController, this.needTitle);
50+
this.dialogTitle, this.onTitleChanged, this.onContentChanged, this.onPressed, this.titleController, this.valueController, this.needTitle);
5151

5252
@override
5353
Widget build(BuildContext context) {
@@ -107,7 +107,7 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
107107
Navigator.pop(context);
108108
})),
109109
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subTextColor)),
110-
new Expanded(child: new FlatButton(child: new Text(GSYStrings.app_cancel), onPressed: () {})),
110+
new Expanded(child: new FlatButton(child: new Text(GSYStrings.app_ok), onPressed: onPressed)),
111111
],
112112
)
113113
],

0 commit comments

Comments
 (0)