better peer tab
This commit is contained in:
parent
c099ff2d8b
commit
5455cd3dea
@ -86,7 +86,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 28,
|
height: 32,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2),
|
padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2),
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -114,40 +114,40 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
Widget _createSwitchBar(BuildContext context) {
|
Widget _createSwitchBar(BuildContext context) {
|
||||||
final model = Provider.of<PeerTabModel>(context);
|
final model = Provider.of<PeerTabModel>(context);
|
||||||
|
|
||||||
getTabChild(int t) {
|
|
||||||
final color = model.currentTab == t
|
|
||||||
? MyTheme.tabbar(context).selectedTextColor
|
|
||||||
: MyTheme.tabbar(context).unSelectedTextColor
|
|
||||||
?..withOpacity(0.5);
|
|
||||||
return Obx(() => Tooltip(
|
|
||||||
message: model.tabTooltip(t, gFFI.groupModel.groupName.value),
|
|
||||||
child: Icon(model.tabIcon(t), color: color),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
children: model.indexs.map((t) {
|
children: model.indexs.map((t) {
|
||||||
return InkWell(
|
final selected = model.currentTab == t;
|
||||||
child: Container(
|
final color = selected
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
? MyTheme.tabbar(context).selectedTextColor
|
||||||
decoration: BoxDecoration(
|
: MyTheme.tabbar(context).unSelectedTextColor
|
||||||
color: model.currentTab == t
|
?..withOpacity(0.5);
|
||||||
? Theme.of(context).colorScheme.background
|
final hover = false.obs;
|
||||||
: null,
|
final deco = BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(6),
|
color: Theme.of(context).colorScheme.background,
|
||||||
),
|
borderRadius: BorderRadius.circular(6));
|
||||||
child: Align(
|
final decoBorder = BoxDecoration(
|
||||||
alignment: Alignment.center,
|
border: Border(
|
||||||
child: getTabChild(t),
|
bottom: BorderSide(width: 2, color: color!),
|
||||||
)),
|
));
|
||||||
onTap: () async {
|
return Obx(() => InkWell(
|
||||||
await handleTabSelection(t);
|
child: Container(
|
||||||
await bind.setLocalFlutterConfig(
|
decoration:
|
||||||
k: 'peer-tab-index', v: t.toString());
|
selected ? decoBorder : (hover.value ? deco : null),
|
||||||
},
|
child: Tooltip(
|
||||||
);
|
message:
|
||||||
|
model.tabTooltip(t, gFFI.groupModel.groupName.value),
|
||||||
|
child: Icon(model.tabIcon(t), color: color),
|
||||||
|
).paddingSymmetric(horizontal: 4),
|
||||||
|
).paddingSymmetric(horizontal: 4),
|
||||||
|
onTap: () async {
|
||||||
|
await handleTabSelection(t);
|
||||||
|
await bind.setLocalFlutterConfig(
|
||||||
|
k: 'peer-tab-index', v: t.toString());
|
||||||
|
},
|
||||||
|
onHover: (value) => hover.value = value,
|
||||||
|
));
|
||||||
}).toList());
|
}).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user