feat(app): 搜索改为调用后端并渲染卡片结果
This commit is contained in:
1 parent
730e38622f
commit
ade0cc3566
13 files changed
+424
-20
No files matched your search
@@ -0,0 +1,26 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import '../models/search_result.dart';
|
||||
import '../remote/catalog_api.dart';
|
||||
|
||||
/// 搜索数据来源:只调用后端 `/app/search`,不在客户端做本地过滤。
|
||||
abstract interface class SearchRepository {
|
||||
Future<SearchResult> search(
|
||||
String keyword, {
|
||||
int pageIndex = 1,
|
||||
int pageSize = 20,
|
||||
});
|
||||
}
|
||||
|
||||
class HttpSearchRepository implements SearchRepository {
|
||||
const HttpSearchRepository(this._api);
|
||||
|
||||
final CatalogApi _api;
|
||||
|
||||
@override
|
||||
Future<SearchResult> search(
|
||||
String keyword, {
|
||||
int pageIndex = 1,
|
||||
int pageSize = 20,
|
||||
}) => _api.search(keyword, pageIndex: pageIndex, pageSize: pageSize);
|
||||
}
|
||||
Reference in new issue
Block a user