feat: implement dialog callback

This commit is contained in:
Kingtous
2023-05-08 12:34:19 +08:00
parent 19f81ad317
commit 77fa807b57
55 changed files with 734 additions and 554 deletions

View File

@@ -664,7 +664,7 @@ abstract class BasePeerCard extends StatelessWidget {
RxBool isInProgress = false.obs;
String name = await _getAlias(id);
var controller = TextEditingController(text: name);
gFFI.dialogManager.show((setState, close) {
gFFI.dialogManager.show((setState, close, context) {
submit() async {
isInProgress.value = true;
String name = controller.text.trim();
@@ -724,7 +724,7 @@ abstract class BasePeerCard extends StatelessWidget {
void _delete(String id, bool isLan, Function reloadFunc) async {
gFFI.dialogManager.show(
(setState, close) {
(setState, close, context) {
submit() async {
if (isLan) {
bind.mainRemoveDiscovered(id: id);
@@ -1023,7 +1023,7 @@ class AddressBookPeerCard extends BasePeerCard {
final tags = List.of(gFFI.abModel.tags);
var selectedTag = gFFI.abModel.getPeerTags(id).obs;
gFFI.dialogManager.show((setState, close) {
gFFI.dialogManager.show((setState, close, context) {
submit() async {
setState(() {
isInProgress = true;
@@ -1115,7 +1115,7 @@ void _rdpDialog(String id) async {
text: await bind.mainGetPeerOption(id: id, key: 'rdp_password'));
RxBool secure = true.obs;
gFFI.dialogManager.show((setState, close) {
gFFI.dialogManager.show((setState, close, context) {
submit() async {
String port = portController.text.trim();
String username = userController.text;