@@ -18,15 +18,11 @@ class GSYSearchDrawer extends StatefulWidget {
1818 GSYSearchDrawer (this .typeCallback, this .sortCallback, this .languageCallback);
1919
2020 @override
21- _GSYSearchDrawerState createState () => _GSYSearchDrawerState (this .typeCallback, this .sortCallback, this .languageCallback );
21+ _GSYSearchDrawerState createState () => _GSYSearchDrawerState ();
2222}
2323
2424class _GSYSearchDrawerState extends State <GSYSearchDrawer > {
25- final SearchSelectItemChanged <String > typeCallback;
26- final SearchSelectItemChanged <String > sortCallback;
27- final SearchSelectItemChanged <String > languageCallback;
28-
29- _GSYSearchDrawerState (this .typeCallback, this .sortCallback, this .languageCallback);
25+ _GSYSearchDrawerState ();
3026
3127 final double itemWidth = 200.0 ;
3228
@@ -54,20 +50,20 @@ class _GSYSearchDrawerState extends State<GSYSearchDrawer> {
5450 list.add (_renderTitle (CommonUtils .getLocale (context).search_type));
5551 for (int i = 0 ; i < searchFilterType.length; i++ ) {
5652 FilterModel model = searchFilterType[i];
57- list.add (_renderItem (model, searchFilterType, i, this .typeCallback));
53+ list.add (_renderItem (model, searchFilterType, i, widget .typeCallback));
5854 list.add (_renderDivider ());
5955 }
6056 list.add (_renderTitle (CommonUtils .getLocale (context).search_type));
6157
6258 for (int i = 0 ; i < sortType.length; i++ ) {
6359 FilterModel model = sortType[i];
64- list.add (_renderItem (model, sortType, i, this .sortCallback));
60+ list.add (_renderItem (model, sortType, i, widget .sortCallback));
6561 list.add (_renderDivider ());
6662 }
6763 list.add (_renderTitle (CommonUtils .getLocale (context).search_language));
6864 for (int i = 0 ; i < searchLanguageType.length; i++ ) {
6965 FilterModel model = searchLanguageType[i];
70- list.add (_renderItem (model, searchLanguageType, i, this .languageCallback));
66+ list.add (_renderItem (model, searchLanguageType, i, widget .languageCallback));
7167 list.add (_renderDivider ());
7268 }
7369 return list;
@@ -97,30 +93,37 @@ class _GSYSearchDrawerState extends State<GSYSearchDrawer> {
9793 }
9894
9995 _renderItem (FilterModel model, List <FilterModel > list, int index, SearchSelectItemChanged <String > select) {
100- return new Container (
101- height: 50.0 ,
102- child: new FlatButton (
103- onPressed: () {
104- setState (() {
105- for (FilterModel model in list) {
106- model.select = false ;
107- }
108- list[index].select = true ;
109- });
110- select? .call (model.value);
111- },
112- child: new Container (
113- width: itemWidth,
114- child: new Row (
115- mainAxisSize: MainAxisSize .min,
116- crossAxisAlignment: CrossAxisAlignment .start,
117- children: < Widget > [
118- new Center (child: new Checkbox (value: model.select, onChanged: (value) {})),
119- new Center (child: Text (model.name)),
120- ],
96+ return new Stack (
97+ children: < Widget > [
98+ new Container (
99+ height: 50.0 ,
100+ child: new Container (
101+ width: itemWidth,
102+ child: new Row (
103+ mainAxisSize: MainAxisSize .min,
104+ crossAxisAlignment: CrossAxisAlignment .start,
105+ children: < Widget > [
106+ new Center (child: new Checkbox (value: model.select, onChanged: (value) {})),
107+ new Center (child: Text (model.name)),
108+ ],
109+ ),
121110 ),
122111 ),
123- ),
112+ new FlatButton (
113+ onPressed: () {
114+ setState (() {
115+ for (FilterModel model in list) {
116+ model.select = false ;
117+ }
118+ list[index].select = true ;
119+ });
120+ select? .call (model.value);
121+ },
122+ child: new Container (
123+ width: itemWidth,
124+ ),
125+ )
126+ ],
124127 );
125128 }
126129}
0 commit comments