feat:重构模块
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_common/widget/common_widget.dart';
|
||||
import 'package:food_hub_app/models/recipe.dart';
|
||||
import 'package:food_hub_app/widgets/common/image.dart';
|
||||
import 'package:liquid_glass_widgets/liquid_glass_widgets.dart';
|
||||
|
||||
class RecipeCard extends StatelessWidget {
|
||||
final RecipeSummary recipe;
|
||||
@@ -17,14 +18,22 @@ class RecipeCard extends StatelessWidget {
|
||||
final List<String> imageUrls =
|
||||
recipe.recordList.reversed.map((record) => record.imageUrl).toList();
|
||||
|
||||
return CommonCard(
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return GlassCard(
|
||||
padding: EdgeInsetsGeometry.all(10),
|
||||
useOwnLayer: true,
|
||||
settings: LiquidGlassSettings(glassColor: colors.surface),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CommonImage(imageUrls: imageUrls, index: 0),
|
||||
SizedBox(height: 8),
|
||||
_buildRecipeContent(context),
|
||||
InkWell(
|
||||
onTap: () => navigatorToRecipeDetail(context),
|
||||
child: _buildRecipeContent(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -32,6 +41,7 @@ class RecipeCard extends StatelessWidget {
|
||||
|
||||
Widget _buildRecipeContent(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -42,17 +52,10 @@ class RecipeCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
recipe.name,
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: textTheme.titleMedium,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => navigatorToRecipeDetail(context),
|
||||
child: Icon(
|
||||
Icons.arrow_circle_right_sharp,
|
||||
color: colors.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
@@ -62,19 +65,13 @@ class RecipeCard extends StatelessWidget {
|
||||
_buildIconText(
|
||||
icon: Icons.food_bank,
|
||||
text: recipe.category,
|
||||
color: Color(0xFF6A5ACD),
|
||||
color: colors.primary,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildIconText(
|
||||
icon: Icons.thumb_up_alt_outlined,
|
||||
text: recipe.likeCount.toString(),
|
||||
color: Color(0xFFDC143C),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildIconText(
|
||||
icon: Icons.star_outline,
|
||||
text: recipe.favouriteCount.toString(),
|
||||
color: Color(0xFF20B2AA),
|
||||
icon: Icons.note_add,
|
||||
text: recipe.recordList.length.toString(),
|
||||
color: colors.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user