JHBitencourt / timeline_tile

A package to help build customisable timelines in Flutter.
https://pub.dev/packages/timeline_tile
MIT License
743 stars 146 forks source link

Gradient color #8

Open matheusrmribeiro opened 4 years ago

matheusrmribeiro commented 4 years ago

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

JHBitencourt commented 4 years ago

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?

matheusrmribeiro commented 4 years ago

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

bartcone-fulfilld commented 2 years ago

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