flame icon indicating copy to clipboard operation
flame copied to clipboard

Any possible way to set maxLines of Text in Flame?

Open tinhok02 opened this issue 2 years ago • 7 comments

I've tried using TextComponent and TextBoxComponent but I still cannot find any solution to set the line number of a text. I tried the following textRenderer, still not worked:

    textRenderer = TextPaint(
        style: const TextStyle(overflow: TextOverflow.ellipsis, height: 1, 
            fontSize: 18, color: Color.fromARGB(255, 215, 215, 215)));

Any solution, please kindly help me. Thanks

tinhok02 avatar Jan 21 '23 16:01 tinhok02

Thay feature doesn't exist currently afaik, but it would be a good addition.

spydon avatar Jan 21 '23 17:01 spydon

I looked at this real quick and I would think extending TextBoxConfig would be the ideal way to address this. If maxHeight is set and the text exceeds the height, you could either truncate the text or if time per char is set, you could vertically scroll the text. Same for like if can grow is set, then start at 1 line grow until max height then scroll.

I don't think text component itself really needs the max height, but maybe??

Additionally, I haven't really looked at the flame_jenny package, but does it need the textboxcomponent to function or does it already do the scrolling text thing I mentioned?

munsterlander avatar Jan 21 '23 22:01 munsterlander

@munsterlander Only maxWidth is found in TextBoxConfig. maxHeight isn't available

super(
            position: position,
            boxConfig: TextBoxConfig(
              maxWidth: 160,
              growingBox: false,
            )

tinhok02 avatar Jan 22 '23 09:01 tinhok02

@munsterlander Only maxWidth is found in TextBoxConfig. maxHeight isn't available

super(
            position: position,
            boxConfig: TextBoxConfig(
              maxWidth: 160,
              growingBox: false,
            )

Correct. That's why I was asking if we should look at extending config.

munsterlander avatar Jan 22 '23 13:01 munsterlander

@munsterlander I see thank you anyways. The only way is to customize my own to cut a string for a specific line number.

tinhok02 avatar Jan 23 '23 03:01 tinhok02

@tinhok02 cool. Yeah I was actually thinking out loud for @spydon to see if he thought that wild be the appropriate response and if a pr should be created for it. Not certain that I can make it a success, but I also know with the work on Jenny that @st-pasha might have some ideas about this or if it's being addressed in flame_jenny, etc.

munsterlander avatar Jan 23 '23 03:01 munsterlander

Sure, a PR adding that to the config would be great.

spydon avatar Jan 23 '23 07:01 spydon