Skip to content

Is there any way to test CustomPainter widget? #1

@james-tharit

Description

@james-tharit

Is there any way to test CustomPainter widget?
I want to test that the CustomPainter draw circle as expected

// dial.dart
import 'package:flutter/material.dart';

class DialPainter extends CustomPainter {
  final Color dialColor;
  final Offset offset;
  final double radius;

  DialPainter({
    required this.dialColor,
    required this.offset,
    required this.radius,
  });

  @override
  void paint(Canvas canvas, Size size) {
    var paint1 = Paint()
      ..color = dialColor
      ..style = PaintingStyle.fill;
    print(offset);
    canvas.drawCircle(offset, radius, paint1);
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) => true;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions