From c716215da144b2577f1c89db7a26c4b1dcd2109f Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Wed, 11 Dec 2024 06:33:45 +0900 Subject: [PATCH] fix: change timeline tabs to be square --- lib/view/page/timelines_page.dart | 2 +- lib/view/widget/timeline_header.dart | 1 + lib/view/widget/timeline_tab_bar.dart | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/view/page/timelines_page.dart b/lib/view/page/timelines_page.dart index 5fdc9428..38f4044f 100644 --- a/lib/view/page/timelines_page.dart +++ b/lib/view/page/timelines_page.dart @@ -269,7 +269,7 @@ class TimelinesPage extends HookConsumerWidget { bottomNavigationBar: showTimelineTabBarAtBottom ? BottomAppBar( padding: EdgeInsets.zero, - height: 56.0, + height: kToolbarHeight, color: colors.panel, elevation: 0.0, child: Row( diff --git a/lib/view/widget/timeline_header.dart b/lib/view/widget/timeline_header.dart index a2ccfcfa..c7a66511 100644 --- a/lib/view/widget/timeline_header.dart +++ b/lib/view/widget/timeline_header.dart @@ -149,6 +149,7 @@ class TimelineHeader extends HookConsumerWidget { }, backgroundColor: Theme.of(context).colorScheme.surface, collapsedBackgroundColor: Theme.of(context).colorScheme.surface, + visualDensity: VisualDensity.compact, children: [ if (onlineUsersCount != null) Text.rich( diff --git a/lib/view/widget/timeline_tab_bar.dart b/lib/view/widget/timeline_tab_bar.dart index e6598f22..a820b958 100644 --- a/lib/view/widget/timeline_tab_bar.dart +++ b/lib/view/widget/timeline_tab_bar.dart @@ -8,13 +8,14 @@ import '../../provider/timeline_scroll_controller_provider.dart'; import '../../provider/timeline_tabs_notifier_provider.dart'; import 'tab_icon_widget.dart'; -class TimelineTabBar extends HookConsumerWidget implements PreferredSizeWidget { +class TimelineTabBar extends HookConsumerWidget { const TimelineTabBar({super.key, required this.controller}); final TabController controller; @override Widget build(BuildContext context, WidgetRef ref) { + const tabHeight = 46.0; final tabs = ref.watch(timelineTabsNotifierProvider); return TabBar( @@ -30,6 +31,8 @@ class TimelineTabBar extends HookConsumerWidget implements PreferredSizeWidget { indicator: BoxDecoration( color: Theme.of(context).colorScheme.primary.withOpacity(0.5), ), + labelPadding: + const EdgeInsets.symmetric(horizontal: (tabHeight - 24.0) / 2), indicatorSize: TabBarIndicatorSize.tab, indicatorWeight: 0.0, dividerHeight: 0.0, @@ -56,7 +59,4 @@ class TimelineTabBar extends HookConsumerWidget implements PreferredSizeWidget { tabAlignment: TabAlignment.center, ); } - - @override - Size get preferredSize => const Size.fromHeight(46.0); }