timeline_tile icon indicating copy to clipboard operation
timeline_tile copied to clipboard

Gradient color

Open matheusrmribeiro opened this issue 4 years ago • 3 comments

Would be nice if the LineStyle have a gradient color option, like the Container widget.

matheusrmribeiro avatar Jun 18 '20 17:06 matheusrmribeiro

I agree, each TimelineTile could have its own gradient line.

But it would be hard (can't think an easy way right now) to keep the same gradient through all the tiles, which I assume that would be the most common desired use case. Any ideias?

JHBitencourt avatar Jun 18 '20 17:06 JHBitencourt

I did not explain so well, but the gradient option it's like you said, each TimelineTile will have your own gradient LineStyle.

What I needed was that each TimelineTile had your own gradient, not all the same. I think it's better in that way than have one that repeat on each tile or even one to all TimelineTile tree.

Some problems:

  1. If you have one gradient to all TimelineTile tree. • Maybe the user can't notice the effect on large lists

  2. If need to repeat the gradient on all tiles • You can create a gradient const and put it on all tiles manually

matheusrmribeiro avatar Jun 18 '20 17:06 matheusrmribeiro

Old thread, but you can use a ShaderMask (https://api.flutter.dev/flutter/widgets/ShaderMask-class.html) to achieve all different kinds of variations. Example below creates the gradient along the entire timeline.

ShaderMask(
              blendMode: BlendMode.srcIn,
              shaderCallback: (bounds) {
                return LinearGradient(colors: [
                  Colors.yellow,
                  Colors.deepOrange
                ], tileMode: TileMode.mirror)
                    .createShader(bounds);
              },
              child: WidgetEncapsulatingTime()),
Screen Shot 2022-07-28 at 5 19 11 PM

bartcone-fulfilld avatar Jul 28 '22 21:07 bartcone-fulfilld