Skip to content

Discovery example (There are multiple heroes that share the same tag within a subtree.) #124

@dt-justin

Description

@dt-justin

Describe the bug
I'm trying to use the Discovery example on a FloatingActionButton in the Scaffold.

To Reproduce
I had to mod the Painter code as for some release the combine action was not working at all no matter what I tried (I displayed each path and they were perfect boot combine difference wasn't subtracting it). This is my new Painter but I doubt that it's issue as it has nothing to do with Hero Animation. Everything else is from the example. This painter has a weird issue where the centre doesn't seem to be actually transparent and I can't see the barrier or background widgets through it, it's just white. But still looks better than no donut hole. But that's not the issue for this ticket. The There are multiple heroes that share the same tag within a subtree. is the issue, it's not a blocking bug, but I'd like to not see it at all in the logs.

import 'package:flutter/material.dart';

class DonutPainter extends CustomPainter {
  const DonutPainter(this.color, {this.innerCircleRadius = 40});

  final Color color;
  final double innerCircleRadius;

  @override
  void paint(Canvas canvas, Size size) {
    final center = Offset(size.width / 2, size.height / 2);
    final paint = Paint()
      ..color = color
      ..style = PaintingStyle.fill;

    canvas.drawCircle(center, size.width / 2, paint);

    // Draw the inner circle with a blend mode to create the "hole"
    final innerPaint = Paint()
      ..color = Colors.transparent // Or the background color
      ..style = PaintingStyle.fill
      ..blendMode = BlendMode.clear; // Clears the pixels covered by the inner circle

    canvas.drawCircle(center, innerCircleRadius, innerPaint);
  }

  @override
  bool shouldRepaint(DonutPainter oldDelegate) {
    return color != oldDelegate.color;
  }
}

Expected behaviour
No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions