Flutter:特定于平台的对话框出现问题



我正在尝试制作一个特定于平台的对话框,但我的解决方案一直显示android(我正在使用iphone模拟器(。你知道问题出在哪里吗?

onTap: () => _onDeletePanel(context),
),
],
),
);
}
}
Future<void> _onDeletePanel(BuildContext context) async {
if (!Platform.isMacOS) {
await showDialog<bool>(
barrierDismissible: false,
context: context,
builder: (context) => AppConfirmationDialog(
title: 'Are you sure?',
contentText: 'Would you like to delete this?',
confirmText: I10n.of(context).reset,
),
);
} else {
await showCupertinoDialog<bool>(
context: context,
builder: (context) => CupertinoAlertDialog(
title: Text('Are you sure?'),
content: Text('Would you like to delete this?'),
actions: [],
),
);
}
}

就像你已经使用Platform.isMacOS来执行一些代码一样,对你针对Platform.isIOS的其他平台也这样做

else if(Platform.isIOS) {
//your code
}

最新更新