Skip to content

Commit 9cbe24c

Browse files
committed
search icon
1 parent 66dad4d commit 9cbe24c

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

lib/common/style/GSYStyle.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ class GSYICons {
305305

306306
static const IconData HOME = const IconData(0xe624, fontFamily: GSYICons.FONT_FAMILY);
307307
static const IconData MORE = const IconData(0xe674, fontFamily: GSYICons.FONT_FAMILY);
308+
static const IconData SEARCH = const IconData(0xe61c, fontFamily: GSYICons.FONT_FAMILY);
308309

309310
static const IconData MAIN_DT = const IconData(0xe684, fontFamily: GSYICons.FONT_FAMILY);
310311
static const IconData MAIN_QS = const IconData(0xe818, fontFamily: GSYICons.FONT_FAMILY);

lib/page/RepositoryDetailIssueListPage.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ class _RepositoryDetailIssuePageState extends GSYListState<RepositoryDetailIssue
143143
this.searchText = value;
144144
}, (value) {
145145
_resolveSelectIndex();
146+
}, (){
147+
_resolveSelectIndex();
146148
}),
147149
elevation: 0.0,
148150
backgroundColor: Color(GSYColors.mainBackgroundColor),

lib/page/SearchPage.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class _SearchPageState extends GSYListState<SearchPage> {
5050
return await ReposDao.searchRepositoryDao(searchText, language, type, sort, selectIndex == 0 ? null : 'user', page, Config.PAGE_SIZE);
5151
}
5252

53-
5453
_clearSelect(List<FilterModel> list) {
5554
for (FilterModel model in list) {
5655
model.select = false;
@@ -111,12 +110,19 @@ class _SearchPageState extends GSYListState<SearchPage> {
111110
backgroundColor: Color(GSYColors.mainBackgroundColor),
112111
appBar: new AppBar(
113112
title: new Text(GSYStrings.search_title),
114-
bottom: new SearchBottom((value) {}, (value) {
113+
bottom: new SearchBottom((value) {
114+
searchText = value;
115+
}, (value) {
115116
searchText = value;
116117
if (searchText == null || searchText.trim().length == 0) {
117118
return;
118119
}
119120
_resolveSelectIndex();
121+
}, () {
122+
if (searchText == null || searchText.trim().length == 0) {
123+
return;
124+
}
125+
_resolveSelectIndex();
120126
}, (selectIndex) {
121127
this.selectIndex = selectIndex;
122128
_resolveSelectIndex();
@@ -139,13 +145,15 @@ class SearchBottom extends StatelessWidget implements PreferredSizeWidget {
139145

140146
final SelectItemChanged selectItemChanged;
141147

142-
SearchBottom(this.onChanged, this.onSubmitted, this.selectItemChanged);
148+
final VoidCallback onSubmitPressed;
149+
150+
SearchBottom(this.onChanged, this.onSubmitted, this.onSubmitPressed, this.selectItemChanged);
143151

144152
@override
145153
Widget build(BuildContext context) {
146154
return Column(
147155
children: <Widget>[
148-
GSYSearchInputWidget(onChanged, onSubmitted),
156+
GSYSearchInputWidget(onChanged, onSubmitted, onSubmitPressed),
149157
new GSYSelectItemWidget(
150158
[
151159
GSYStrings.search_tab_repos,

lib/widget/GSYSearchInputWidget.dart

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
77
* Date: 2018-07-20
88
*/
99
class GSYSearchInputWidget extends StatelessWidget {
10-
1110
final ValueChanged<String> onChanged;
1211

1312
final ValueChanged<String> onSubmitted;
1413

15-
GSYSearchInputWidget(this.onChanged, this.onSubmitted);
14+
final VoidCallback onSubmitPressed;
15+
16+
GSYSearchInputWidget(this.onChanged, this.onSubmitted, this.onSubmitPressed);
1617

1718
@override
1819
Widget build(BuildContext context) {
@@ -22,15 +23,24 @@ class GSYSearchInputWidget extends StatelessWidget {
2223
color: Colors.white,
2324
border: new Border.all(color: Color(GSYColors.subTextColor), width: 0.3)),
2425
padding: new EdgeInsets.only(left: 20.0, top: 12.0, right: 20.0, bottom: 12.0),
25-
child: new TextField(
26-
autofocus: false,
27-
decoration: new InputDecoration.collapsed(
28-
hintText: GSYStrings.repos_issue_search,
29-
hintStyle: GSYConstant.middleSubText,
30-
),
31-
style: GSYConstant.middleText,
32-
onChanged: onChanged,
33-
onSubmitted: onSubmitted),
26+
child: new Row(children: <Widget>[
27+
new Expanded(
28+
child: new TextField(
29+
autofocus: false,
30+
decoration: new InputDecoration.collapsed(
31+
hintText: GSYStrings.repos_issue_search,
32+
hintStyle: GSYConstant.middleSubText,
33+
),
34+
style: GSYConstant.middleText,
35+
onChanged: onChanged,
36+
onSubmitted: onSubmitted)),
37+
new RawMaterialButton(
38+
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
39+
padding: const EdgeInsets.only(right:5.0, left: 10.0),
40+
constraints: const BoxConstraints(minWidth: 0.0, minHeight: 0.0),
41+
child: new Icon(GSYICons.SEARCH, size: 15.0),
42+
onPressed: onSubmitPressed)
43+
]),
3444
);
3545
}
3646
}

0 commit comments

Comments
 (0)