infinum/flutter-charts

how to add color to caption text

andre-ab opened this issue · 1 comments

Hey @andre-ab this is similar to rotated issue. If you use WidgetDecoration for that part you can modify anything just as you do with Widgets. It is a little more overhead but you get much more customization. Same snippet from before can be used here but just to change text color:

WidgetDecoration(
  widgetDecorationBuilder: (builder, state, itemWidth, verticalMultiplier) {
    return Stack(
      children: [
        ...List.generate(
          state.data.listSize,
          (index) => Positioned(
            bottom: 0,
            width: itemWidth,
            height: 32,
            left: index * itemWidth,
            child: Center(
              child: RotatedBox(
                quarterTurns: 3,
                child: Text(
                  '$index',
                  style: TextStyle(
                    color: Colors.primaries[index % Colors.primaries.length],
                  ),
                ),
              ),
            ),
          ),
        ),
      ],
    );
  },
  margin: EdgeInsets.only(bottom: 32),
)