feat:更新好友菜谱功能
This commit is contained in:
@@ -44,7 +44,7 @@ class ProfileInfo extends StatelessWidget {
|
||||
children: [
|
||||
Icon(icon, size: 16, color: colors.primary),
|
||||
const SizedBox(width: 6),
|
||||
Text(text, style: Theme.of(context).textTheme.bodyMedium),
|
||||
Text(text, style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ class RecipeCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CommonImage(imageUrls: imageUrls, index: 0),
|
||||
SizedBox(height: 8),
|
||||
InkWell(
|
||||
onTap: () => navigatorToRecipeDetail(context),
|
||||
child: _buildRecipeContent(context),
|
||||
@@ -56,6 +55,11 @@ class RecipeCard extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
_buildIconText(
|
||||
icon: Icons.star,
|
||||
text: recipe.recommendRate.toString(),
|
||||
color: colors.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
@@ -70,7 +74,7 @@ class RecipeCard extends StatelessWidget {
|
||||
const SizedBox(width: 12),
|
||||
_buildIconText(
|
||||
icon: Icons.note_add,
|
||||
text: recipe.recordList.length.toString(),
|
||||
text: '${recipe.recordList.length.toString()}次',
|
||||
color: colors.primary,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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