Skip to content
Closed
Changes from all 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
24 changes: 18 additions & 6 deletions packages/flutter/lib/src/material/tabs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -822,14 +822,25 @@ class _TabBarViewState extends State<TabBarView> {
/// ancestor.
class TabPageSelector extends StatelessWidget {
/// Creates a compact widget that indicates which tab has been selected.
TabPageSelector({ Key key, this.controller }) : super(key: key);
TabPageSelector({
Key key,
this.controller,
this.emptyIndicatorFillColor: Colors.transparent,
this.indicatorSize: 12.0
}) : super(key: key);

/// This widget's selection and animation state.
///
/// If [TabController] is not provided, then the value of [DefaultTabController.of]
/// will be used.
final TabController controller;

/// The fill color for an unselected indicator. Defaults to Colors.transparent.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Colors.transparent]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add more color to these docs in a second paragraph, saying why you would set it.

final Color emptyIndicatorFillColor;

/// The size of the indicator. Defaults to 12.0.
final double indicatorSize;

Widget _buildTabIndicator(
int tabIndex,
TabController tabController,
Expand All @@ -848,13 +859,14 @@ class TabPageSelector extends StatelessWidget {
} else {
background = tabController.index == tabIndex ? selectedColor.end : selectedColor.begin;
}
Color borderColor = emptyIndicatorFillColor == Colors.transparent ? selectedColor.end : background;
return new Container(
width: 12.0,
height: 12.0,
width: indicatorSize,
height: indicatorSize,
margin: const EdgeInsets.all(4.0),
decoration: new BoxDecoration(
backgroundColor: background,
border: new Border.all(color: selectedColor.end),
border: new Border.all(color: borderColor),
shape: BoxShape.circle
)
);
Expand All @@ -863,8 +875,8 @@ class TabPageSelector extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Color color = Theme.of(context).accentColor;
final ColorTween selectedColor = new ColorTween(begin: Colors.transparent, end: color);
final ColorTween previousColor = new ColorTween(begin: color, end: Colors.transparent);
final ColorTween selectedColor = new ColorTween(begin: emptyIndicatorFillColor, end: color);
final ColorTween previousColor = new ColorTween(begin: color, end: emptyIndicatorFillColor);
final TabController tabController = controller ?? DefaultTabController.of(context);
final Animation<double> animation = new CurvedAnimation(
parent: tabController.animation,
Expand Down