mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-04-19 21:32:03 +00:00
Update connection_list.dart
This commit is contained in:
parent
356f197a4c
commit
fc56f7af2a
1 changed files with 38 additions and 33 deletions
|
|
@ -113,39 +113,44 @@ class _ConnectionCardState extends State<ConnectionCard> {
|
|||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
trailing: widget.canDisconnect
|
||||
? TextButton(
|
||||
onPressed: () => showDialog(
|
||||
builder: (ctx) {
|
||||
return AlertDialog(
|
||||
title: const Text("Confirmation"),
|
||||
content: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Text(
|
||||
"Are your sure you want to delete ${widget.connection.title}?",
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: const Text("CANCEL"),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
_handleConnection(context, ref);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text("DISCONNECT"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
context: context,
|
||||
),
|
||||
child: isLoading
|
||||
? const CircularProgressIndicator()
|
||||
: const Text("Disconnect"),
|
||||
)
|
||||
onPressed: () async { // Make onPressed async
|
||||
final result = await showDialog<bool>( // Await the dialog result
|
||||
context: context,
|
||||
builder: (ctx) {
|
||||
return AlertDialog(
|
||||
title: const Text("Confirmation"),
|
||||
content: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Text(
|
||||
"Are you sure you want to delete ${widget.connection.title}?",
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop(false); // Return false on cancel
|
||||
},
|
||||
child: const Text("CANCEL"),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop(true); // Return true on disconnect
|
||||
},
|
||||
child: const Text("DISCONNECT"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (result == true) { // Check if the user pressed disconnect
|
||||
_handleConnection(context, ref);
|
||||
}
|
||||
},
|
||||
child: isLoading
|
||||
? const CircularProgressIndicator()
|
||||
: const Text("Disconnect"),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue