From e6ee934a3e733053217fe70d5268de2cd2ea72a4 Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Wed, 19 Nov 2025 22:48:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9B=B4=E6=96=B0Card=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/provider/food_provider.dart | 5 +++- lib/views/moment.dart | 1 - lib/widgets/common/index.dart | 8 ++--- lib/widgets/recipe/calendar.dart | 1 + lib/widgets/recipe/list.dart | 50 +++++++++++++++----------------- 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/lib/provider/food_provider.dart b/lib/provider/food_provider.dart index 2b4983a..1ba1025 100644 --- a/lib/provider/food_provider.dart +++ b/lib/provider/food_provider.dart @@ -174,7 +174,10 @@ class FoodProvider with ChangeNotifier { if (isLoading) return; try { - isLoading = true; + if (currentPage == 1) { + isLoading = true; + } + error = null; notifyListeners(); diff --git a/lib/views/moment.dart b/lib/views/moment.dart index dcf4571..3f70a19 100644 --- a/lib/views/moment.dart +++ b/lib/views/moment.dart @@ -50,7 +50,6 @@ class _MomentPageState extends State { // 上拉加载 Future _onLoad() async { final provider = context.read(); - if (provider.hasMore) { await provider.loadMoreMomentList(); _freshController.finishLoad(IndicatorResult.success); diff --git a/lib/widgets/common/index.dart b/lib/widgets/common/index.dart index 5e98fbf..6110ee3 100644 --- a/lib/widgets/common/index.dart +++ b/lib/widgets/common/index.dart @@ -15,7 +15,7 @@ Widget formLabelText({required String labelText, bool isRequired = false}) { } InputDecoration formInputDecoration({ - required String hintText, // 使用命名参数并标记为必填 + required String hintText, IconData? prefixIcon, }) { return InputDecoration( @@ -38,9 +38,9 @@ Widget buildCard({required BuildContext context, required Widget child}) { decoration: BoxDecoration( color: Colors.white, 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( padding: EdgeInsets.all(16), decoration: BoxDecoration( - color: colors.surface, + color: Colors.white, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow(color: Colors.black12, blurRadius: 8, offset: Offset(0, 2)), diff --git a/lib/widgets/recipe/calendar.dart b/lib/widgets/recipe/calendar.dart index 1b60930..09c3154 100644 --- a/lib/widgets/recipe/calendar.dart +++ b/lib/widgets/recipe/calendar.dart @@ -18,6 +18,7 @@ class _RecipeCalendarState extends State { return TableCalendar( locale: 'zh_CN', headerStyle: const HeaderStyle( + headerPadding: EdgeInsets.symmetric(vertical: 0), formatButtonVisible: false, titleCentered: true, ), diff --git a/lib/widgets/recipe/list.dart b/lib/widgets/recipe/list.dart index 7b6db3a..f5588a9 100644 --- a/lib/widgets/recipe/list.dart +++ b/lib/widgets/recipe/list.dart @@ -36,39 +36,34 @@ class _RecipeListState extends State { padding: EdgeInsets.symmetric(horizontal: 16), child: DropdownButton( value: provider.queryCategory, - hint: Text( - '请选择菜谱类别', - style: TextStyle(color: Colors.grey[500]), - ), + hint: Text('请选择菜谱类别', style: TextStyle(color: Colors.grey[500])), isExpanded: true, borderRadius: BorderRadius.circular(12), dropdownColor: Colors.white, elevation: 6, underline: Container(), - items: provider.categoryList.map((String value) { - return DropdownMenuItem( - value: value, - child: Row( - children: [ - Container( - width: 8, - height: 8, - decoration: BoxDecoration( - color: colors.primary, - shape: BoxShape.circle, - ), + items: + provider.categoryList.map((String value) { + return DropdownMenuItem( + value: value, + child: Row( + children: [ + Container( + width: 8, + height: 8, + decoration: BoxDecoration( + color: colors.primary, + shape: BoxShape.circle, + ), + ), + SizedBox(width: 8), + Expanded( + child: Text(value, style: TextStyle(fontSize: 14)), + ), + ], ), - SizedBox(width: 8), - Expanded( - child: Text( - value, - style: TextStyle(fontSize: 14), - ), - ) - ], - ), - ); - }).toList(), + ); + }).toList(), onChanged: (value) { setState(() { provider.queryCategory = value!; @@ -86,6 +81,7 @@ class _RecipeListState extends State { return Column( children: [ _buildSelectCategory(provider), + SizedBox(height: 5), Expanded( child: ListView.builder( itemCount: provider.recipeSummaryList.length,