feat:更新好友菜谱功能
This commit is contained in:
@@ -5,7 +5,9 @@ import 'package:food_hub_app/widgets/recipe/card.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class RecipeList extends StatefulWidget {
|
||||
const RecipeList({super.key});
|
||||
final int userId;
|
||||
|
||||
const RecipeList({super.key, required this.userId});
|
||||
|
||||
@override
|
||||
State<RecipeList> createState() => _RecipeListState();
|
||||
@@ -18,8 +20,11 @@ class _RecipeListState extends State<RecipeList> {
|
||||
|
||||
// 初始化加载数据
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.read<FoodProvider>().refreshRecipeList();
|
||||
context.read<FoodProvider>().queryCategoryList();
|
||||
if (widget.userId == 0) {
|
||||
context.read<FoodProvider>().refreshRecipeList();
|
||||
} else {
|
||||
context.read<FoodProvider>().queryRecipeByUserId(widget.userId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,7 +35,7 @@ class _RecipeListState extends State<RecipeList> {
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 8,
|
||||
childAspectRatio: 0.9,
|
||||
childAspectRatio: 0.85,
|
||||
),
|
||||
itemCount: provider.recipeSummaryList.length,
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
Reference in New Issue
Block a user