You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
887 B
41 lines
887 B
4 years ago
|
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));
|
||
|
}
|
||
|
}
|