Skip to content

Commit

Permalink
fix(YaruTabBar): make TabController nullable, add onTap (#782)
Browse files Browse the repository at this point in the history
"If [TabController] is not provided, then the value of [DefaultTabController.of] will be used."
  • Loading branch information
Feichtmeier authored Sep 24, 2023
1 parent d7f62e9 commit 4e1cb14
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/src/widgets/yaru_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import 'package:yaru_widgets/yaru_widgets.dart';
class YaruTabBar extends StatelessWidget {
const YaruTabBar({
super.key,
required this.tabController,
this.tabController,
this.onTap,
required this.tabs,
this.height,
});

final TabController tabController;
final TabController? tabController;
final void Function(int)? onTap;
final List<Widget> tabs;
final double? height;

Expand All @@ -19,19 +21,17 @@ class YaruTabBar extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(5),
height: height ?? kYaruTitleBarItemHeight + 10,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(kYaruContainerRadius),
),
child: TabBar(
onTap: onTap,
dividerColor: Colors.transparent,
controller: tabController,
labelColor: Theme.of(context).colorScheme.onSurface,
indicatorSize: TabBarIndicatorSize.tab,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(kYaruContainerRadius),
borderRadius: BorderRadius.circular(kYaruButtonRadius),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1),
),
splashBorderRadius: BorderRadius.circular(kYaruContainerRadius),
splashBorderRadius: BorderRadius.circular(kYaruButtonRadius),
tabs: [for (final tab in tabs) tab],
),
);
Expand Down

0 comments on commit 4e1cb14

Please sign in to comment.