Skip to content

Conversation

@fstotz
Copy link
Contributor

@fstotz fstotz commented Oct 15, 2025

fix showcase key change crashes app

Description

fixes the issue with changing the key of a showcase widget

`class TestStateful extends StatefulWidget {
const TestStateful({super.key});

@OverRide
State createState() => _TestStatefulState();
}

class _TestStatefulState extends State {
int count = 0;

GlobalKey testKey = GlobalKey();

@OverRide
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Counter(count, testKey),
ElevatedButton(
onPressed: () => setState(() {
count++;
testKey = GlobalKey();
}),
child: const Icon(Icons.plus_one))
],
);
}
}

class Counter extends StatelessWidget {
const Counter(this.count, this.testKey,{super.key});

final int count;

final GlobalKey testKey;

@OverRide
Widget build(BuildContext context) {
return Showcase(
key: testKey,
title: "testcount",
child: Text(count.toString()),
);
}
}`

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

#576

fix showcase key change crashes app
@fstotz fstotz changed the title [fix] fix did update widget Fixes #576 fix: fix did update widget Fixes #576 Oct 15, 2025
@aditya-css
Copy link
Collaborator

@fstotz Thank you for raising a PR. Can you please format your code using dart format command.

@aditya-css aditya-css merged commit 84537f0 into SimformSolutionsPvtLtd:master Oct 17, 2025
1 of 3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants