update carton form and add recent search
This commit is contained in:
@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../data/services/services.dart';
|
||||
import '../../helpers/shared_pref.dart';
|
||||
import '../widgets/suggest_list.dart';
|
||||
|
||||
typedef OnUserSelect(User suer);
|
||||
typedef OnUserRowSelect(User suer);
|
||||
@@ -79,7 +81,7 @@ class UserSearchDelegate extends SearchDelegate<User> {
|
||||
child: Text(
|
||||
"No result found",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color:Colors.black),
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -118,12 +120,26 @@ class UserSearchDelegate extends SearchDelegate<User> {
|
||||
|
||||
@override
|
||||
Widget buildSuggestions(BuildContext context) {
|
||||
return Container(
|
||||
child: Center(
|
||||
child: Opacity(
|
||||
opacity: 0.2,
|
||||
child: Icon(Icons.perm_identity, size: 200, color: primaryColor)),
|
||||
),
|
||||
return FutureBuilder<List<String>?>(
|
||||
future: SharedPref.getRecentSearch('account_search', query),
|
||||
builder: (context, snapshot) {
|
||||
List<String> _oldFilters = snapshot.data ?? [];
|
||||
if (_oldFilters.isEmpty) {
|
||||
return const Center(
|
||||
child: Opacity(
|
||||
opacity: 0.2,
|
||||
child: Icon(Icons.perm_identity, color: primaryColor, size: 200),
|
||||
),
|
||||
);
|
||||
}
|
||||
return SuggestList(
|
||||
recentSearchList: _oldFilters,
|
||||
onTap: (String s) {
|
||||
query = s;
|
||||
showResults(context);
|
||||
},
|
||||
prefKey: 'account_search');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user