feat:新增菜谱详细信息模块
This commit is contained in:
@@ -12,7 +12,7 @@ class RecipeList extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RecipeListState extends State<RecipeList> {
|
||||
List<Recipe> recipeList = [];
|
||||
List<RecipeSummary> recipeSummaryList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -24,19 +24,19 @@ class _RecipeListState extends State<RecipeList> {
|
||||
final result = await queryRecipeApi(RecipeQuery(category: ""));
|
||||
|
||||
setState(() {
|
||||
recipeList = result;
|
||||
recipeSummaryList = result;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (recipeList.isEmpty) {
|
||||
if (recipeSummaryList.isEmpty) {
|
||||
return const TDEmpty(type: TDEmptyType.plain, emptyText: '暂无数据');
|
||||
} else {
|
||||
return ListView.builder(
|
||||
itemCount: recipeList.length,
|
||||
itemCount: recipeSummaryList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return RecipeCard(recipe: recipeList[index]);
|
||||
return RecipeCard(recipe: recipeSummaryList[index]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user