@@ -49,9 +49,9 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
4949 _IssueEditDialogState (
5050 this .dialogTitle, this .onTitleChanged, this .onContentChanged, this .onPressed, this .titleController, this .valueController, this .needTitle);
5151
52- @override
53- Widget build ( BuildContext context ) {
54- Widget title = (needTitle)
52+ ///标题输入框
53+ renderTitleInput ( ) {
54+ return (needTitle)
5555 ? new Padding (
5656 padding: new EdgeInsets .all (5.0 ),
5757 child: new GSYInputWidget (
@@ -61,11 +61,51 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
6161 obscureText: false ,
6262 ))
6363 : new Container ();
64+ }
6465
66+ ///快速输入框
67+ _renderFastInputContainer () {
68+ ///因为是Column下包含了ListView,所以需要设置高度
69+ return new Container (
70+ height: 30.0 ,
71+ child: ListView .builder (
72+ scrollDirection: Axis .horizontal,
73+ itemBuilder: (context, index) {
74+ return new RawMaterialButton (
75+ materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
76+ padding: EdgeInsets .only (left: 8.0 , right: 8.0 , top: 5.0 , bottom: 5.0 ),
77+ constraints: const BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
78+ child: Icon (FAST_INPUT_LIST [index].iconData, size: 16.0 ),
79+ onPressed: () {
80+ String text = FAST_INPUT_LIST [index].content;
81+ String newText = "" ;
82+ if (valueController.value != null ) {
83+ newText = valueController.value.text;
84+ }
85+ newText = newText + text;
86+ print ("fffff" );
87+ print (newText);
88+ setState (() {
89+ valueController.value = new TextEditingValue (text: newText);
90+ });
91+ if (onContentChanged != null ) {
92+ onContentChanged (newText);
93+ }
94+ });
95+ },
96+ itemCount: FAST_INPUT_LIST .length,
97+ ),
98+ );
99+ }
100+
101+ @override
102+ Widget build (BuildContext context) {
65103 return new Container (
66104 height: MediaQuery .of (context).size.height,
67105 width: MediaQuery .of (context).size.width,
68106 color: Colors .black12,
107+
108+ ///触摸收起键盘
69109 child: new GestureDetector (
70110 behavior: HitTestBehavior .translucent,
71111 onTap: () {
@@ -80,12 +120,17 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
80120 child: new Column (
81121 mainAxisSize: MainAxisSize .min,
82122 children: < Widget > [
123+ ///dialog标题
83124 new Padding (
84125 padding: new EdgeInsets .only (top: 5.0 , bottom: 15.0 ),
85126 child: new Center (
86127 child: new Text (dialogTitle, style: GSYConstant .normalTextBold),
87128 )),
88- title,
129+
130+ ///标题输入框
131+ renderTitleInput (),
132+
133+ ///内容输入框
89134 new Container (
90135 height: MediaQuery .of (context).size.width * 3 / 4 ,
91136 decoration: new BoxDecoration (
@@ -94,22 +139,32 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
94139 border: new Border .all (color: Color (GSYColors .subTextColor), width: .3 ),
95140 ),
96141 padding: new EdgeInsets .only (left: 20.0 , top: 12.0 , right: 20.0 , bottom: 12.0 ),
97- child: new TextField (
98- autofocus: false ,
99- maxLines: 999 ,
100- onChanged: onContentChanged,
101- controller: valueController,
102- decoration: new InputDecoration .collapsed (
103- hintText: GSYStrings .issue_edit_issue_title_tip,
104- hintStyle: GSYConstant .middleSubText,
105- ),
106- style: GSYConstant .middleText,
142+ child: new Column (
143+ children: < Widget > [
144+ new Expanded (
145+ child: new TextField (
146+ autofocus: false ,
147+ maxLines: 999 ,
148+ onChanged: onContentChanged,
149+ controller: valueController,
150+ decoration: new InputDecoration .collapsed (
151+ hintText: GSYStrings .issue_edit_issue_title_tip,
152+ hintStyle: GSYConstant .middleSubText,
153+ ),
154+ style: GSYConstant .middleText,
155+ ),
156+ ),
157+
158+ ///快速输入框
159+ _renderFastInputContainer (),
160+ ],
107161 ),
108162 ),
109163 new Container (height: 10.0 ),
110164 new Row (
111165 crossAxisAlignment: CrossAxisAlignment .center,
112166 children: < Widget > [
167+ ///取消
113168 new Expanded (
114169 child: new RawMaterialButton (
115170 materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
@@ -120,6 +175,8 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
120175 Navigator .pop (context);
121176 })),
122177 new Container (width: 0.3 , height: 25.0 , color: Color (GSYColors .subTextColor)),
178+
179+ ///确定
123180 new Expanded (
124181 child: new RawMaterialButton (
125182 materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
@@ -138,3 +195,21 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
138195 );
139196 }
140197}
198+
199+ var FAST_INPUT_LIST = [
200+ FastInputIconModel (GSYICons .ISSUE_EDIT_H1 , "\n # " ),
201+ FastInputIconModel (GSYICons .ISSUE_EDIT_H2 , "\n ## " ),
202+ FastInputIconModel (GSYICons .ISSUE_EDIT_H3 , "\n ### " ),
203+ FastInputIconModel (GSYICons .ISSUE_EDIT_BOLD , "****" ),
204+ FastInputIconModel (GSYICons .ISSUE_EDIT_ITALIC , "__" ),
205+ FastInputIconModel (GSYICons .ISSUE_EDIT_QUOTE , "` `" ),
206+ FastInputIconModel (GSYICons .ISSUE_EDIT_CODE , " \n ``` \n\n ``` \n " ),
207+ FastInputIconModel (GSYICons .ISSUE_EDIT_LINK , "[](url)" ),
208+ ];
209+
210+ class FastInputIconModel {
211+ final IconData iconData;
212+ final String content;
213+
214+ FastInputIconModel (this .iconData, this .content);
215+ }
0 commit comments