@@ -66,7 +66,8 @@ class SearchScreenState extends State<SearchScreen> {
66
66
}
67
67
68
68
Widget _buildContent () {
69
- var key = "${service .getName }${widget .title .name .toUpperCase ()}_searchHistory" ;
69
+ var key =
70
+ "${service .getName }${widget .title .name .toUpperCase ()}_searchHistory" ;
70
71
var theme = context.theme.colorScheme;
71
72
List <String > searchHistory = loadCustomData (key) ?? [];
72
73
@@ -81,60 +82,67 @@ class SearchScreenState extends State<SearchScreen> {
81
82
padding: const EdgeInsets .symmetric (vertical: 8 ),
82
83
child: Obx (() {
83
84
if (screen.showHistory.value) {
84
- return ListView .builder (
85
- shrinkWrap: true ,
86
- physics: const NeverScrollableScrollPhysics (),
87
- itemCount: searchHistory.length,
88
- itemBuilder: (context, index) {
89
- return Padding (
90
- padding: const EdgeInsets .symmetric (
91
- vertical: 4.0 ,
92
- horizontal: 24.0 ,
93
- ),
94
- child: Card (
95
- elevation: 3 ,
96
- shape: RoundedRectangleBorder (
97
- borderRadius: BorderRadius .circular (10 ),
98
- ),
99
- child: ListTile (
100
- title: Text (
101
- searchHistory[index],
102
- style: TextStyle (
103
- color: theme.onSurface,
104
- fontWeight: FontWeight .bold,
105
- ),
106
- ),
107
- contentPadding: const EdgeInsets .only (
108
- right: 8 ,
109
- bottom: 4 ,
110
- top: 4 ,
111
- left: 16 ,
85
+ return Column (
86
+ children: [
87
+ ...screen.topWidget (context),
88
+ ListView .builder (
89
+ shrinkWrap: true ,
90
+ physics: const NeverScrollableScrollPhysics (),
91
+ itemCount: searchHistory.length,
92
+ itemBuilder: (context, index) {
93
+ return Padding (
94
+ padding: const EdgeInsets .symmetric (
95
+ vertical: 4.0 ,
96
+ horizontal: 24.0 ,
112
97
),
113
- trailing: IconButton (
114
- icon: Icon (
115
- FontAwesome .trash_solid,
116
- size: 18 ,
98
+ child: Card (
99
+ elevation: 3 ,
100
+ shape: RoundedRectangleBorder (
101
+ borderRadius: BorderRadius .circular (10 ),
102
+ ),
103
+ child: ListTile (
104
+ title: Text (
105
+ searchHistory[index],
106
+ style: TextStyle (
107
+ color: theme.onSurface,
108
+ fontWeight: FontWeight .bold,
109
+ ),
110
+ ),
111
+ contentPadding: const EdgeInsets .only (
112
+ right: 8 ,
113
+ bottom: 4 ,
114
+ top: 4 ,
115
+ left: 16 ,
116
+ ),
117
+ trailing: IconButton (
118
+ icon: Icon (
119
+ FontAwesome .trash_solid,
120
+ size: 18 ,
121
+ ),
122
+ onPressed: () {
123
+ setState (() {
124
+ var list =
125
+ List <String >.from (searchHistory);
126
+ list.removeAt (index);
127
+ saveCustomData (key, list);
128
+ });
129
+ },
130
+ ),
131
+ onTap: () {
132
+ _searchController.text = searchHistory[index];
133
+ _onSearchChanged (searchHistory[index]);
134
+ },
117
135
),
118
- onPressed: () {
119
- setState (() {
120
- var list = List <String >.from (searchHistory);
121
- list.removeAt (index);
122
- saveCustomData (key, list);
123
- });
124
- },
125
136
),
126
- onTap: () {
127
- _searchController.text = searchHistory[index];
128
- _onSearchChanged (searchHistory[index]);
129
- },
130
- ),
131
- ),
132
- );
133
- },
137
+ );
138
+ },
139
+ )
140
+ ],
134
141
);
135
142
} else {
136
143
return Column (
137
144
children: [
145
+ ...screen.topWidget (context),
138
146
...screen.searchWidget (context),
139
147
SizedBox (
140
148
height: 64 ,
@@ -244,7 +252,8 @@ class SearchScreenState extends State<SearchScreen> {
244
252
void _onSearchChanged (String value) {
245
253
if (_debounce? .isActive ?? false ) _debounce! .cancel ();
246
254
_debounce = Timer (const Duration (milliseconds: 500 ), () {
247
- var key = "${service .getName }${widget .title .name .toUpperCase ()}_searchHistory" ;
255
+ var key =
256
+ "${service .getName }${widget .title .name .toUpperCase ()}_searchHistory" ;
248
257
List <String > searchHistory = loadCustomData (key) ?? [];
249
258
if (! searchHistory.contains (value.trim ().toLowerCase ()) &&
250
259
value.isNotEmpty) {
0 commit comments