From 8eda3e36c80f16bd9dd9ac53e27b42dc2d11785c Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sun, 18 Sep 2022 20:37:33 +0800 Subject: [PATCH] refactor: use popup show --- lib/models/theme.dart | 22 ++-------------------- lib/widgets/language_bar.dart | 9 +++++++-- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lib/models/theme.dart b/lib/models/theme.dart index 5662e1f..ce41669 100644 --- a/lib/models/theme.dart +++ b/lib/models/theme.dart @@ -232,25 +232,6 @@ class ThemeModel with ChangeNotifier { } } - Future showWarning(BuildContext context, String message) async { - showCupertinoDialog( - context: context, - builder: (context) { - return CupertinoAlertDialog( - title: Text(message), - actions: [ - CupertinoDialogAction( - child: const Text('OK'), - onPressed: () { - Navigator.pop(context, true); - }, - ), - ], - ); - }, - ); - } - Future showConfirm(BuildContext context, Widget content) { return showCupertinoDialog( context: context, @@ -281,8 +262,9 @@ class ThemeModel with ChangeNotifier { String? _selectedItem; showPicker(BuildContext context, PickerGroupItem groupItem) async { - await showCupertinoModalPopup( + await AntPopup.show( context: context, + closeOnMaskClick: true, builder: (context) { return Column( mainAxisAlignment: MainAxisAlignment.end, diff --git a/lib/widgets/language_bar.dart b/lib/widgets/language_bar.dart index a224782..46329e8 100644 --- a/lib/widgets/language_bar.dart +++ b/lib/widgets/language_bar.dart @@ -1,3 +1,4 @@ +import 'package:antd_mobile/antd_mobile.dart'; import 'package:flutter/cupertino.dart'; import 'package:from_css_color/from_css_color.dart'; import 'package:git_touch/models/theme.dart'; @@ -31,8 +32,12 @@ class LanguageBar extends StatelessWidget { return CupertinoButton( padding: EdgeInsets.zero, minSize: 0, - onPressed: () { - showCupertinoModalPopup(context: context, builder: _buildPopup); + onPressed: () async { + await AntPopup.show( + context: context, + closeOnMaskClick: true, + builder: _buildPopup, + ); }, child: Container( // color: theme.palette.background,