Description:
When multiple InfoPopupWidget instances are displayed on the same screen (for example, two buttons that each show a popup), calling dismissInfoPopup() on one popup’s controller results in all popups closing at once, even if other popups are still visible.
This behavior is not expected — ideally, dismissInfoPopup() should close only the specific popup associated with that controller.
Steps to Reproduce:
-
Add two or more InfoPopupWidget instances to a single screen.
-
Show both popups (e.g., via controller.show()).
-
Call .dismissInfoPopup() on the first popup’s controller.
-
Observe that the second popup also closes.
Expected Behavior:
Each InfoPopupWidget should manage its own overlay independently.
Calling dismissInfoPopup() on one controller should only close that specific popup, not other popups on the screen.
`class TwoPopupsScreen extends StatefulWidget {
const TwoPopupsScreen({super.key});
@OverRide
State createState() => _TwoPopupsScreenState();
}
class _TwoPopupsScreenState extends State {
InfoPopupController? controller1;
InfoPopupController? controller2;
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Two Popups Example")),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
children: [
InfoPopupWidget(
onControllerCreated: (c) => controller1 = c,
customContent: () => Container(
padding: const EdgeInsets.all(12),
color: Colors.blue,
child: const Text(
"Popup 1",
style: TextStyle(color: Colors.white),
),
),
child: ElevatedButton(
onPressed: () {
controller1?.show();
},
child: const Text("Show Popup 1"),
),
),
const SizedBox(height: 24),
InfoPopupWidget(
onControllerCreated: (c) => controller2 = c,
customContent: () => Container(
padding: const EdgeInsets.all(12),
color: Colors.green,
child: const Text(
"Popup 2",
style: TextStyle(color: Colors.white),
),
),
child: ElevatedButton(
onPressed: () {
controller2?.show();
},
child: const Text("Show Popup 2"),
),
),
const SizedBox(height: 24),
ElevatedButton(
onPressed: () {
controller1?.dismissInfoPopup(); // closes only Popup 1
},
child: const Text("Dismiss Popup 1"),
),
ElevatedButton(
onPressed: () {
controller2?.dismissInfoPopup(); // closes only Popup 2
},
child: const Text("Dismiss Popup 2"),
),
],
),
),
);
}
}
`
Description:
When multiple InfoPopupWidget instances are displayed on the same screen (for example, two buttons that each show a popup), calling dismissInfoPopup() on one popup’s controller results in all popups closing at once, even if other popups are still visible.
This behavior is not expected — ideally, dismissInfoPopup() should close only the specific popup associated with that controller.
Steps to Reproduce:
Add two or more InfoPopupWidget instances to a single screen.
Show both popups (e.g., via controller.show()).
Call .dismissInfoPopup() on the first popup’s controller.
Observe that the second popup also closes.
Expected Behavior:
Each InfoPopupWidget should manage its own overlay independently.
Calling dismissInfoPopup() on one controller should only close that specific popup, not other popups on the screen.
`class TwoPopupsScreen extends StatefulWidget {
const TwoPopupsScreen({super.key});
@OverRide
State createState() => _TwoPopupsScreenState();
}
class _TwoPopupsScreenState extends State {
InfoPopupController? controller1;
InfoPopupController? controller2;
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Two Popups Example")),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
children: [
InfoPopupWidget(
onControllerCreated: (c) => controller1 = c,
customContent: () => Container(
padding: const EdgeInsets.all(12),
color: Colors.blue,
child: const Text(
"Popup 1",
style: TextStyle(color: Colors.white),
),
),
child: ElevatedButton(
onPressed: () {
controller1?.show();
},
child: const Text("Show Popup 1"),
),
),
const SizedBox(height: 24),
InfoPopupWidget(
onControllerCreated: (c) => controller2 = c,
customContent: () => Container(
padding: const EdgeInsets.all(12),
color: Colors.green,
child: const Text(
"Popup 2",
style: TextStyle(color: Colors.white),
),
),
child: ElevatedButton(
onPressed: () {
controller2?.show();
},
child: const Text("Show Popup 2"),
),
),
const SizedBox(height: 24),
ElevatedButton(
onPressed: () {
controller1?.dismissInfoPopup(); // closes only Popup 1
},
child: const Text("Dismiss Popup 1"),
),
ElevatedButton(
onPressed: () {
controller2?.dismissInfoPopup(); // closes only Popup 2
},
child: const Text("Dismiss Popup 2"),
),
],
),
),
);
}
}
`