VTabIndicator class
@author: wzp_vicky @time: 2022年10月27日23:58:00 @version: V1.1 @description:自定义指示器,实现了2种:带有动画和不带动画,具体见下述
我们看到官方提供一个UnderlineTabIndicator类,通过insets参数可以设置指示器的边距从而达到设置指示器宽度的效果, 但是这并不能固定TabBar的宽度,而且当tabBar数量变化时或者文本长度改变,指示器宽度也会改变, 我这里直接对UnderlineTabIndicator这个类进行了二次改造, 关键代码:通过这个方法我们自定义返回已个矩形,自定义我们需要的宽度值即可。 */ 修改下划线自定义
- Inheritance
-
- Object
- Decoration
- VTabIndicator
Constructors
- VTabIndicator({BorderSide borderSide = const BorderSide(width: 10.0, color: Colors.blue), TabController? tabController, double controlIndicatorHeight = 5, double indicatorBottom = 0.0, required double indicatorWidth})
-
const
Properties
- borderSide → BorderSide
-
The color and weight of the horizontal line drawn below the selected tab.
不需要动画的时候,月就是tabController不传的时候
线的宽度:indicatorWidth
线的高度:borderSide.width
下边距实实在在的来自indicatorBottom
final
- controlIndicatorHeight → double
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indicatorBottom → double
-
final
- indicatorWidth → double
-
final
- isComplex → bool
-
Whether this decoration is complex enough to benefit from caching its painting.
no setterinherited
- padding → EdgeInsetsGeometry
-
Returns the insets to apply when using this decoration on a box
that has contents, so that the contents do not overlap the edges
of the decoration. For example, if the decoration draws a frame
around its edge, the padding would return the distance by which
to inset the children so as to not overlap the frame.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tabController → TabController?
-
需要动画的时候,
线的宽度:indicatorWidth
线的高度:controlIndictorHeight
下边距实实在在的来自indicatorBottom
final
Methods
-
createBoxPainter(
[VoidCallback? onChanged]) → BoxPainter -
Returns a BoxPainter that will paint this decoration.
override
-
debugAssertIsValid(
) → bool -
In debug mode, throws an exception if the object is not in a
valid configuration. Otherwise, returns true.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
getClipPath(
Rect rect, TextDirection textDirection) → Path -
Returns a closed Path that describes the outer edge of this decoration.
override
-
hitTest(
Size size, Offset position, {TextDirection? textDirection}) → bool -
Tests whether the given point, on a rectangle of a given size,
would be considered to hit the decoration or not. For example,
if the decoration only draws a circle, this function might
return true if the point was inside the circle and false
otherwise.
inherited
-
lerpFrom(
Decoration? a, double t) → Decoration? -
Linearly interpolates from another Decoration (which may be of a
different class) to
this
.inherited -
lerpTo(
Decoration? b, double t) → Decoration? -
Linearly interpolates from
this
to another Decoration (which may be of a different class).inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited