feat:更新Card样式

This commit is contained in:
2025-11-19 22:48:25 +08:00
parent 5151430132
commit e6ee934a3e
5 changed files with 32 additions and 33 deletions

View File

@@ -174,7 +174,10 @@ class FoodProvider with ChangeNotifier {
if (isLoading) return; if (isLoading) return;
try { try {
isLoading = true; if (currentPage == 1) {
isLoading = true;
}
error = null; error = null;
notifyListeners(); notifyListeners();

View File

@@ -50,7 +50,6 @@ class _MomentPageState extends State<MomentPage> {
// 上拉加载 // 上拉加载
Future<void> _onLoad() async { Future<void> _onLoad() async {
final provider = context.read<FoodProvider>(); final provider = context.read<FoodProvider>();
if (provider.hasMore) { if (provider.hasMore) {
await provider.loadMoreMomentList(); await provider.loadMoreMomentList();
_freshController.finishLoad(IndicatorResult.success); _freshController.finishLoad(IndicatorResult.success);

View File

@@ -15,7 +15,7 @@ Widget formLabelText({required String labelText, bool isRequired = false}) {
} }
InputDecoration formInputDecoration({ InputDecoration formInputDecoration({
required String hintText, // 使用命名参数并标记为必填 required String hintText,
IconData? prefixIcon, IconData? prefixIcon,
}) { }) {
return InputDecoration( return InputDecoration(
@@ -38,9 +38,9 @@ Widget buildCard({required BuildContext context, required Widget child}) {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
border: Border.all(color: colors.outline.withAlpha(50)), // border: Border.all(color: colors.outline.withAlpha(50)),
), ),
child: Padding(padding: EdgeInsets.all(10 ), child: child), child: Padding(padding: EdgeInsets.all(10), child: child),
), ),
); );
} }
@@ -181,7 +181,7 @@ Widget buildLoadingIndicator(BuildContext context) {
child: Container( child: Container(
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: colors.surface, color: Colors.white,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow(color: Colors.black12, blurRadius: 8, offset: Offset(0, 2)), BoxShadow(color: Colors.black12, blurRadius: 8, offset: Offset(0, 2)),

View File

@@ -18,6 +18,7 @@ class _RecipeCalendarState extends State<RecipeCalendar> {
return TableCalendar( return TableCalendar(
locale: 'zh_CN', locale: 'zh_CN',
headerStyle: const HeaderStyle( headerStyle: const HeaderStyle(
headerPadding: EdgeInsets.symmetric(vertical: 0),
formatButtonVisible: false, formatButtonVisible: false,
titleCentered: true, titleCentered: true,
), ),

View File

@@ -36,39 +36,34 @@ class _RecipeListState extends State<RecipeList> {
padding: EdgeInsets.symmetric(horizontal: 16), padding: EdgeInsets.symmetric(horizontal: 16),
child: DropdownButton<String>( child: DropdownButton<String>(
value: provider.queryCategory, value: provider.queryCategory,
hint: Text( hint: Text('请选择菜谱类别', style: TextStyle(color: Colors.grey[500])),
'请选择菜谱类别',
style: TextStyle(color: Colors.grey[500]),
),
isExpanded: true, isExpanded: true,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
dropdownColor: Colors.white, dropdownColor: Colors.white,
elevation: 6, elevation: 6,
underline: Container(), underline: Container(),
items: provider.categoryList.map((String value) { items:
return DropdownMenuItem<String>( provider.categoryList.map((String value) {
value: value, return DropdownMenuItem<String>(
child: Row( value: value,
children: [ child: Row(
Container( children: [
width: 8, Container(
height: 8, width: 8,
decoration: BoxDecoration( height: 8,
color: colors.primary, decoration: BoxDecoration(
shape: BoxShape.circle, color: colors.primary,
), shape: BoxShape.circle,
),
),
SizedBox(width: 8),
Expanded(
child: Text(value, style: TextStyle(fontSize: 14)),
),
],
), ),
SizedBox(width: 8), );
Expanded( }).toList(),
child: Text(
value,
style: TextStyle(fontSize: 14),
),
)
],
),
);
}).toList(),
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
provider.queryCategory = value!; provider.queryCategory = value!;
@@ -86,6 +81,7 @@ class _RecipeListState extends State<RecipeList> {
return Column( return Column(
children: [ children: [
_buildSelectCategory(provider), _buildSelectCategory(provider),
SizedBox(height: 5),
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: provider.recipeSummaryList.length, itemCount: provider.recipeSummaryList.length,