Accent color

This commit is contained in:
Hillel Coren 2020-07-31 13:48:28 +03:00
parent c4ebf23890
commit db65407f73
1 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
class AppTabBar extends StatelessWidget {
const AppTabBar({
this.isScrollable,
this.tabs,
this.controller,
});
final List<Widget> tabs;
final TabController controller;
final bool isScrollable;
@override
Widget build(BuildContext context) {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final tabBar = TabBar(
tabs: tabs,
controller: controller,
isScrollable: isScrollable,
indicatorColor: Theme.of(context).accentColor,
);
if (state.prefState.enableDarkMode || !state.hasAccentColor) {
return tabBar;
}
return Theme(
data: ThemeData(
tabBarTheme: TabBarTheme(
labelColor: Colors.black,
unselectedLabelColor: Colors.black.withOpacity(.65),
),
),
child: tabBar,
);
}
}