美文网首页
Flutter tabbar圆形indicator

Flutter tabbar圆形indicator

作者: _大风起兮尘飞扬 | 来源:发表于2021-05-15 12:31 被阅读0次

    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

          本文链接:https://www.haomeiwen.com/subject/eabhjltx.html