首页分类按钮重构

master
laiiihz 4 years ago
parent 1b4550e27c
commit 1c4d27c43f

@ -1150,8 +1150,22 @@ class _HomePageState extends BaseStoreState<HomePage>
), ),
), ),
Container( Container(
width: rSize(48),
height: rSize(62), 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( child: _buildSingleGoodsCard(
R.ASSETS_HOME_IC_CLASSIFICATION_PNG, '分类'), R.ASSETS_HOME_IC_CLASSIFICATION_PNG, '分类'),
), ),
@ -1161,8 +1175,12 @@ class _HomePageState extends BaseStoreState<HomePage>
} }
Widget _buildSingleGoodsCard(String path, String name) { Widget _buildSingleGoodsCard(String path, String name) {
return InkWell( return MaterialButton(
onTap: () async { minWidth: rSize(54),
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: () async {
GSDialog.of(context).showLoadingDialog(context, ''); GSDialog.of(context).showLoadingDialog(context, '');
await HomeDao.getCategories(success: (data, code, msg) { await HomeDao.getCategories(success: (data, code, msg) {
GSDialog.of(context).dismiss(context); GSDialog.of(context).dismiss(context);
@ -1176,26 +1194,22 @@ class _HomePageState extends BaseStoreState<HomePage>
Toast.showError(msg); Toast.showError(msg);
}); });
}, },
child: Container( child: Column(
alignment: Alignment.center, mainAxisAlignment: MainAxisAlignment.center,
margin: EdgeInsets.only(right: rSize(14)), children: [
child: Column( Image.asset(
mainAxisAlignment: MainAxisAlignment.center, path,
children: [ height: rSize(28),
Image.asset( width: rSize(28),
path, ),
height: rSize(28), Text(
width: rSize(28), name,
), style: TextStyle(
Text( color: Color(0xFF333333),
name, fontSize: rSize(10),
style: TextStyle(
color: Color(0xFF333333),
fontSize: rSize(10),
),
), ),
], ),
), ],
), ),
); );
} }

@ -57,7 +57,6 @@ class _SCTabBarState<T> extends State<SCTabBar> {
int _selectedIndex; int _selectedIndex;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -69,7 +68,6 @@ class _SCTabBarState<T> extends State<SCTabBar> {
_selectedIndex = index; _selectedIndex = index;
}); });
}; };
} }
@override @override
@ -88,16 +86,19 @@ class _SCTabBarState<T> extends State<SCTabBar> {
color: Colors.white, color: Colors.white,
padding: _itemSpaceEdge(), padding: _itemSpaceEdge(),
child: Container( child: Container(
height: widget.height, height: widget.height,
child: Row( child: Stack(
crossAxisAlignment: CrossAxisAlignment.stretch, children: [
children: <Widget>[ itemBuilder(context, index, widget.items[index]),
_indicatorBorder(index), Positioned(
Expanded( left: 0,
child: top: 0,
itemBuilder(context, index, widget.items[index])), bottom: 0,
], child: _indicatorBorder(index),
)), ),
],
),
),
), ),
onTap: () { onTap: () {
if (widget.itemClick != null) { if (widget.itemClick != null) {

Loading…
Cancel
Save