Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GlobalKey _textKey -- should not be a global #129

Closed
awhitford opened this issue Oct 23, 2020 · 0 comments
Closed

GlobalKey _textKey -- should not be a global #129

awhitford opened this issue Oct 23, 2020 · 0 comments

Comments

@awhitford
Copy link
Collaborator

This looks wrong:

Note that it is being set by _TextLiquidFillState.initState:

@override
void initState() {
super.initState();
_textKey = GlobalKey();

I'm guessing that _textKey should be a member of the _TextLiquidFillState class. However, I suspect that this was moved to expose it WavePainter:

class WavePainter extends CustomPainter {
Animation<double> waveAnimation;
double percentValue;
double boxHeight;
Color waveColor;
WavePainter(
{this.waveAnimation, this.percentValue, this.boxHeight, this.waveColor});
@override
void paint(Canvas canvas, Size size) {
double width = (size.width != null) ? size.width : 200;
double height = (size.height != null) ? size.height : 200;
Paint wavePaint = Paint()..color = waveColor;
RenderBox textBox = _textKey.currentContext.findRenderObject();

However, it should simply be passed.

The concern/risk is that two instances of TextLiquidFill will collide/overwrite this global.

awhitford added a commit to awhitford/Animated-Text-Kit that referenced this issue Oct 23, 2020
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

No branches or pull requests

1 participant