12.9 Tab 商品详情 实现步骤:
第 1 步:商品详情子视图 lib/pages/goods/product_details/widgets/tab_detail.dart
1 2 3 4 _buildTitle(String title) { return TextWidget.title3(title).paddingBottom(AppSpace.listRow); }
1 2 3 4 5 6 7 8 _buildContent(String? title) { return TextWidget.title2( title ?? "-" , softWrap: true , maxLines: 10 , ).paddingBottom(AppSpace.listRow * 2 ); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 @override Widget build(BuildContext context) { return <Widget>[ _buildTitle("Description" ), _buildContent(controller.product?.description?.clearHtml), _buildTitle("SKU" ), _buildContent(controller.product?.sku ?? "-" ), _buildTitle("Price" ), _buildContent(controller.product?.price ?? "-" ), _buildTitle("Regular price" ), _buildContent(controller.product?.regularPrice ?? "-" ), _buildTitle("Weight" ), _buildContent(controller.product?.weight ?? "-" ), _buildTitle("dimensions" ), _buildContent( "${controller.product?.dimensions?.length} x ${controller.product?.dimensions?.width} x ${controller.product?.dimensions?.height} " ), ] .toColumn( crossAxisAlignment: CrossAxisAlignment.start, ) .scrollable() .paddingVertical(AppSpace.page); }
fix:底部导航穿透问题 lib/common/widgets/navigation.dart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @override Widget build(BuildContext context) { ... ws.add( <Widget>[ ... ] .toColumn( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max, ) .onTap(() => onTap(i)) .expanded(), ); }
mainAxisSize: MainAxisSize.max, // 撑满
mainAxisAlignment: MainAxisAlignment.center, // 居中
onTap 中已经是 behavior: behavior ?? HitTestBehavior.opaque, 防事件穿透
提交代码到 git