|
|
@ -155,7 +155,10 @@ class _FriendTabState extends State<FriendTab> with TickerProviderStateMixin { |
|
|
return Container( |
|
|
return Container( |
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), |
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), |
|
|
child: Row( |
|
|
child: Row( |
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
|
|
|
const SizedBox(width: 13), |
|
|
_buildTabButton("我的关注", 0), |
|
|
_buildTabButton("我的关注", 0), |
|
|
const SizedBox(width: 16), |
|
|
const SizedBox(width: 16), |
|
|
_buildTabButton("好友", 1), |
|
|
_buildTabButton("好友", 1), |
|
|
@ -169,15 +172,20 @@ class _FriendTabState extends State<FriendTab> with TickerProviderStateMixin { |
|
|
// 构建标签按钮 |
|
|
// 构建标签按钮 |
|
|
Widget _buildTabButton(String title, int index) { |
|
|
Widget _buildTabButton(String title, int index) { |
|
|
final bool isSelected = _tabController.index == index; |
|
|
final bool isSelected = _tabController.index == index; |
|
|
return Expanded( |
|
|
|
|
|
child: GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
if (_tabController.index != index) { |
|
|
|
|
|
_tabController.animateTo(index); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 根据索引设置不同的宽高 |
|
|
|
|
|
final double width = index == 0 ? 72 : 36; |
|
|
|
|
|
final double height = index == 0 ? 42 : 21; |
|
|
|
|
|
|
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
if (_tabController.index != index) { |
|
|
|
|
|
_tabController.animateTo(index); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
child: SizedBox( |
|
|
|
|
|
width: width, |
|
|
|
|
|
height: height, |
|
|
child: Container( |
|
|
child: Container( |
|
|
padding: const EdgeInsets.symmetric(vertical: 8), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: isSelected ? _primaryPurple : Colors.white, |
|
|
color: isSelected ? _primaryPurple : Colors.white, |
|
|
borderRadius: BorderRadius.circular(20), |
|
|
borderRadius: BorderRadius.circular(20), |
|
|
|