Skip to content

feat(pie_chart): Add individual border control for pie chart sections#2053

Open
MatthiasMRC wants to merge 3 commits intoimaNNeo:mainfrom
MatthiasMRC:main
Open

feat(pie_chart): Add individual border control for pie chart sections#2053
MatthiasMRC wants to merge 3 commits intoimaNNeo:mainfrom
MatthiasMRC:main

Conversation

@MatthiasMRC
Copy link

Summary

  • Add PieChartSectionBorder class to allow controlling each border side independently on pie chart sections
  • New border sides: outer (outer arc), inner (inner arc), left (left radial), right (right radial)
  • Convenience constructors: .all(), .arcsOnly(), .outerOnly()
  • Deprecate existing borderSide parameter (still works for backwards compatibility)

Fixes #2052

Problem

When pie chart sections are adjacent, borders appear doubled/thicker because borderSide applies the same border to all sides.

Changes

  • Added PieChartSectionBorder class with individual border properties
  • Added drawSectionIndividualBorders method in PieChartPainter
  • Updated PieChartSectionData with new border parameter
  • Added unit tests for new functionality

Usage

PieChartSectionData(
  value: 40,
  color: Colors.blue,
  // Only draw borders on arcs, not on radial lines
  border: PieChartSectionBorder.arcsOnly(
    BorderSide(color: Colors.white, width: 2),
  ),
)

Test plan

  • All existing tests pass
  • Added tests for PieChartSectionBorder (constructors, lerp, copyWith, equality)
  • Added tests for drawSectionIndividualBorders
  • Backwards compatibility with deprecated borderSide maintained

Add PieChartSectionBorder class to allow controlling each border side
independently (outer arc, inner arc, left radial, right radial).

This solves the issue where adjacent sections have doubled borders
when using a single borderSide for all edges.

New features:
- PieChartSectionBorder class with outer, inner, left, right properties
- PieChartSectionBorder.all() - same border on all sides
- PieChartSectionBorder.arcsOnly() - borders only on arcs (no radial lines)
- PieChartSectionBorder.outerOnly() - border only on outer arc

The existing borderSide parameter is deprecated but still supported
for backwards compatibility.
Add PieChartSectionBorder class to allow controlling each border side
independently (outer arc, inner arc, left radial, right radial).

This solves the issue where adjacent sections have doubled borders
when using a single borderSide for all edges.

New constructors:
- PieChartSectionBorder.all() - same border on all sides
- PieChartSectionBorder.arcsOnly() - borders only on arcs
- PieChartSectionBorder.outerOnly() - border only on outer arc
- PieChartSectionBorder.smart() - outer + inner + right (avoids doubled borders)

The existing borderSide parameter is deprecated but still supported
for backwards compatibility.
Add PieChartSectionBorder class to allow controlling each border side
independently (outer arc, inner arc, left radial, right radial).

New constructors:
- PieChartSectionBorder.all() - same border on all sides
- PieChartSectionBorder.arcsOnly() - borders only on arcs
- PieChartSectionBorder.outerOnly() - border only on outer arc

The existing borderSide parameter is deprecated but still supported
for backwards compatibility.

Added unit tests for PieChartSectionBorder and drawSectionIndividualBorders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Allow controlling borders on each side of pie chart sections independently

1 participant