From 1c4d27c43fbbdf0c2f312109da770802e26e957f Mon Sep 17 00:00:00 2001 From: laiiihz Date: Fri, 12 Mar 2021 09:45:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=88=86=E7=B1=BB=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/home_page.dart | 58 ++++++++++++++++++++++------------- lib/widgets/sc_tab_bar.dart | 25 +++++++-------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index d146af0..ffe695e 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -1150,8 +1150,22 @@ class _HomePageState extends BaseStoreState ), ), Container( - width: rSize(48), height: rSize(62), + decoration: BoxDecoration( + color: AppColor.frenchColor, + boxShadow: [ + //使用多层阴影的方式实现单边boxShadow + /// more at [stackoverflow](https://stackoverflow.com/a/65296931/7963151) + BoxShadow( + color: Colors.black12, + blurRadius: 10, + offset: Offset(-5, 0), + ), + BoxShadow(color: AppColor.frenchColor, offset: Offset(0, -16)), + BoxShadow(color: AppColor.frenchColor, offset: Offset(0, 16)), + BoxShadow(color: AppColor.frenchColor, offset: Offset(16, 0)), + ], + ), child: _buildSingleGoodsCard( R.ASSETS_HOME_IC_CLASSIFICATION_PNG, '分类'), ), @@ -1161,8 +1175,12 @@ class _HomePageState extends BaseStoreState } Widget _buildSingleGoodsCard(String path, String name) { - return InkWell( - onTap: () async { + return MaterialButton( + minWidth: rSize(54), + padding: EdgeInsets.zero, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onPressed: () async { GSDialog.of(context).showLoadingDialog(context, ''); await HomeDao.getCategories(success: (data, code, msg) { GSDialog.of(context).dismiss(context); @@ -1176,26 +1194,22 @@ class _HomePageState extends BaseStoreState Toast.showError(msg); }); }, - child: Container( - alignment: Alignment.center, - margin: EdgeInsets.only(right: rSize(14)), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - path, - height: rSize(28), - width: rSize(28), - ), - Text( - name, - style: TextStyle( - color: Color(0xFF333333), - fontSize: rSize(10), - ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + path, + height: rSize(28), + width: rSize(28), + ), + Text( + name, + style: TextStyle( + color: Color(0xFF333333), + fontSize: rSize(10), ), - ], - ), + ), + ], ), ); } diff --git a/lib/widgets/sc_tab_bar.dart b/lib/widgets/sc_tab_bar.dart index 6010aca..ae9ff62 100644 --- a/lib/widgets/sc_tab_bar.dart +++ b/lib/widgets/sc_tab_bar.dart @@ -57,7 +57,6 @@ class _SCTabBarState extends State { int _selectedIndex; - @override void initState() { super.initState(); @@ -69,7 +68,6 @@ class _SCTabBarState extends State { _selectedIndex = index; }); }; - } @override @@ -88,16 +86,19 @@ class _SCTabBarState extends State { color: Colors.white, padding: _itemSpaceEdge(), child: Container( - height: widget.height, - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _indicatorBorder(index), - Expanded( - child: - itemBuilder(context, index, widget.items[index])), - ], - )), + height: widget.height, + child: Stack( + children: [ + itemBuilder(context, index, widget.items[index]), + Positioned( + left: 0, + top: 0, + bottom: 0, + child: _indicatorBorder(index), + ), + ], + ), + ), ), onTap: () { if (widget.itemClick != null) {