mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
improve tab bar
This commit is contained in:
@@ -369,10 +369,14 @@ class _FilledTabBarState extends State<FilledTabBar> {
|
|||||||
final double tabWidth = tabRight - tabLeft;
|
final double tabWidth = tabRight - tabLeft;
|
||||||
final double tabCenter = tabLeft + tabWidth / 2;
|
final double tabCenter = tabLeft + tabWidth / 2;
|
||||||
final double tabBarWidth = tabBarBox.size.width;
|
final double tabBarWidth = tabBarBox.size.width;
|
||||||
final double scrollOffset = tabCenter - tabBarWidth / 2;
|
double scrollOffset = tabCenter - tabBarWidth / 2;
|
||||||
if (scrollOffset == scrollController.offset) {
|
if (scrollOffset == scrollController.offset) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
scrollOffset = scrollOffset.clamp(
|
||||||
|
0.0,
|
||||||
|
scrollController.position.maxScrollExtent,
|
||||||
|
);
|
||||||
scrollController.animateTo(
|
scrollController.animateTo(
|
||||||
scrollOffset,
|
scrollOffset,
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
|
Reference in New Issue
Block a user