diff --git a/lib/pages/shop/home/widgets/product_item.dart b/lib/pages/shop/home/widgets/product_item.dart index 6c92213..727007f 100644 --- a/lib/pages/shop/home/widgets/product_item.dart +++ b/lib/pages/shop/home/widgets/product_item.dart @@ -1,4 +1,3 @@ -import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:wow_english/models/product_entity.dart'; @@ -47,44 +46,48 @@ class ProductItem extends StatelessWidget { style: TextStyle( fontSize: 16.sp, color: const Color(0xFF333333)), ), - RichText( - text: TextSpan(children: [ - TextSpan( - text: '¥', + FittedBox( + fit: BoxFit.scaleDown, + child: RichText( + text: TextSpan(children: [ + TextSpan( + text: '¥', + style: TextStyle( + fontSize: 21.sp, + color: const Color(0xFFF51A1A), + )), + TextSpan( + text: entity?.price?.toString() ?? '', style: TextStyle( - fontSize: 21.sp, + fontSize: 40.sp, color: const Color(0xFFF51A1A), - )), - TextSpan( - text: entity?.price?.toString() ?? '', - style: TextStyle( - fontSize: 40.sp, - color: const Color(0xFFF51A1A), - ), - ) - ]), + ), + ) + ]), + ), ), GestureDetector( onTap: () { onTap(); }, child: Container( - decoration: BoxDecoration( - color: const Color(0xFFF5C51F), - borderRadius: BorderRadius.circular(5.r), - border: Border.all( - color: const Color(0xFF333333), - width: 1.0, - )), - padding: EdgeInsets.symmetric( - vertical: 1.h, - horizontal: 26.5.w, - ), - child: Text( - '立即购买', - style: TextStyle( - fontSize: 10.sp, color: const Color(0xFF333333)), - ), + decoration: BoxDecoration( + color: const Color(0xFFF5C51F), + borderRadius: BorderRadius.circular(5.r), + border: Border.all( + color: const Color(0xFF333333), + width: 1.0, + )), + padding: EdgeInsets.symmetric( + vertical: 1.h + ), + child: Center( + child: Text( + '立即购买', + style: TextStyle( + fontSize: 10.sp, color: const Color(0xFF333333)), + ), + ) ), ) ],