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 {
if (currentPage == 1) {
isLoading = true; 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,7 +38,7 @@ 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,16 +36,14 @@ 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:
provider.categoryList.map((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Row( child: Row(
@@ -60,11 +58,8 @@ class _RecipeListState extends State<RecipeList> {
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(value, style: TextStyle(fontSize: 14)),
value,
style: TextStyle(fontSize: 14),
), ),
)
], ],
), ),
); );
@@ -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,