import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; const double _kTabHeight = 35.0; class MyTab extends StatelessWidget { MyTab({ Key key, this.text, }) : assert(text != null), super(key: key); final String text; Widget _buildLabelText() { return Text(text, softWrap: false, overflow: TextOverflow.fade); } @override Widget build(BuildContext context) { assert(debugCheckHasMaterial(context)); final double height = _kTabHeight; final Widget label = _buildLabelText(); return SizedBox( height: height, child: Center( child: label, widthFactor: 1.0, ), ); } @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties.add(StringProperty('text', text, defaultValue: null)); } }