Flutter tabbar圆形indicator

import 'package:flutter/cupertino.dart';

class CircleTabIndicatorextends Decoration{

  final BoxPainter_painter;

  CircleTabIndicator({@required Color color, @required double radius}) :_painter =_CirclePainter(color, radius);

  @override

  BoxPaintercreateBoxPainter([onChanged]) =>_painter;

}

class _CirclePainterextends BoxPainter{

  final Paint_paint;

  final doubleradius;

  _CirclePainter(Color color, this.radius)

      :_paint =Paint()

    ..color = color

..isAntiAlias =true;

  @override

  void paint(Canvas canvas, Offset offset, ImageConfiguration cfg) {

    final Offset circleOffset = offset +Offset(cfg.size.width /2, cfg.size.height -radius);

    canvas.drawCircle(circleOffset, radius, _paint);

  }

}

你可能感兴趣的:(Flutter tabbar圆形indicator)