修改选择器样式

This commit is contained in:
czz
2025-06-06 09:18:06 +08:00
parent 682728eb1e
commit bc86cf7d78
94 changed files with 3929 additions and 2299 deletions

View File

@@ -22,66 +22,71 @@ class BezierBottomNavigationBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final itemCount = path.length;
return SizedBox(
height: 130.rpx,
child: Stack(
children: [
Positioned.fill(
child: CustomPaint(
size: Size(MediaQuery.of(context).size.width, 130.rpx),
painter: BezierPainter(
position: animatedPosition,
itemCount: itemCount,
return Material(
// ✅ 整个底部栏使用一个透明 Material 包裹
type: MaterialType.transparency,
child: SizedBox(
height: 130.rpx,
child: Stack(
children: [
Positioned.fill(
child: CustomPaint(
size: Size(MediaQuery.of(context).size.width, 130.rpx),
painter: BezierPainter(
position: animatedPosition,
itemCount: itemCount,
),
),
),
),
Row(
children: path.asMap().entries.map((entry) {
final i = entry.key;
final icon = entry.value;
return Expanded(
child: GestureDetector(
// 用 InkWell 替换 GestureDetector支持点击反馈
onTap: () => onTap(i),
// splashColor: Colors.transparent, // 可选:关闭 splash 效果
// highlightColor: Colors.transparent, // 可选:关闭高亮效果
child: SizedBox.expand(
Row(
children: path.asMap().entries.map((entry) {
final i = entry.key;
final icon = entry.value;
return Expanded(
child: InkWell(
onTap: () => onTap(i),
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
child: SizedBox.expand(
child: Padding(
padding: EdgeInsets.only(top: 14.rpx),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 11.rpx),
child: SvgPicture.asset(icon,
width: 42.rpx,
height: 42.rpx,
color: selectedIndex == i
? Colors.white
: Color(0XFF929699)),
padding: EdgeInsets.only(top: 14.rpx),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 11.rpx),
child: SvgPicture.asset(
icon,
width: 42.rpx,
height: 42.rpx,
color: selectedIndex == i
? Colors.white
: const Color(0XFF929699),
),
),
const SizedBox(height: 3),
Text(
titles[i],
style: TextStyle(
fontSize: 22.rpx,
color: selectedIndex == i
? Colors.white
: Colors.grey.shade400,
),
),
],
),
SizedBox(height: 3),
Text(
titles[i],
style: TextStyle(
fontSize: 22.rpx,
color: selectedIndex == i
? Colors.white
: Colors.grey.shade400,
),
),
],
),
)
// 关键点:撑满 Expanded 区域
),
),
);
}).toList(),
),
],
),
),
),
);
}).toList(),
),
],
),
),
);
}
}