Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.14.0 #79

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 39 additions & 8 deletions lib/src/components/tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@ typedef ArDriveTab = MapEntry<Tab, Widget>;

class ArDriveTabView extends StatefulWidget {
final List<ArDriveTab> tabs;
const ArDriveTabView({Key? key, required this.tabs}) : super(key: key);
final Color? backgroundColor;
final Color? selectedLabelColor;
final Color? unselectedLabelColor;
final Color? selectedTabColor;
final Color? unselectedTabColor;

const ArDriveTabView({
Key? key,
required this.tabs,
this.backgroundColor,
this.selectedLabelColor,
this.unselectedLabelColor,
this.selectedTabColor,
this.unselectedTabColor,
}) : super(key: key);

@override
State<ArDriveTabView> createState() => _ArDriveTabViewState();
Expand All @@ -31,14 +45,18 @@ class _ArDriveTabViewState extends State<ArDriveTabView>
ArDriveTabBar(
tabs: [...widget.tabs.map((tab) => tab.key)],
controller: _tabController,
selectedLabelColor: widget.selectedLabelColor,
unselectedLabelColor: widget.unselectedLabelColor,
selectedTabColor: widget.selectedTabColor,
unselectedTabColor: widget.unselectedTabColor,
),
const SizedBox(
height: 28,
),
Expanded(
child: ArDriveCard(
contentPadding: EdgeInsets.zero,
backgroundColor:
backgroundColor: widget.backgroundColor ??
ArDriveTheme.of(context).themeData.colors.themeBgCanvas,
content: TabBarView(
controller: _tabController,
Expand All @@ -54,9 +72,20 @@ class _ArDriveTabViewState extends State<ArDriveTabView>
class ArDriveTabBar extends StatelessWidget {
final List<Tab> tabs;
final TabController controller;
final Color? selectedTabColor;
final Color? unselectedTabColor;
final Color? selectedLabelColor;
final Color? unselectedLabelColor;

const ArDriveTabBar(
{super.key, required this.tabs, required this.controller});
const ArDriveTabBar({
super.key,
required this.tabs,
required this.controller,
this.selectedTabColor,
this.unselectedTabColor,
this.selectedLabelColor,
this.unselectedLabelColor,
});

final borderRadius = 8.0;

Expand All @@ -81,7 +110,8 @@ class ArDriveTabBar extends StatelessWidget {
return Container(
height: 40,
decoration: BoxDecoration(
color: ArDriveTheme.of(context).themeData.tableTheme.backgroundColor,
color: unselectedTabColor ??
ArDriveTheme.of(context).themeData.tableTheme.backgroundColor,
borderRadius: BorderRadius.circular(8),
),
child: TabBar(
Expand All @@ -91,11 +121,12 @@ class ArDriveTabBar extends StatelessWidget {
controller.index,
controller.length,
),
color:
color: selectedTabColor ??
ArDriveTheme.of(context).themeData.tableTheme.selectedItemColor,
),
labelColor: ArDriveTheme.of(context).themeData.colors.themeFgDefault,
unselectedLabelColor:
labelColor: selectedLabelColor ??
ArDriveTheme.of(context).themeData.colors.themeFgDefault,
unselectedLabelColor: unselectedLabelColor ??
ArDriveTheme.of(context).themeData.colors.themeAccentDisabled,
tabs: tabs,
),
Expand Down