Commit f75dff10195e587ff1c78221a131141490a85cdd

Authored by 权海
1 parent ba1e6e73

feat(ui):修复自定义主题页不应该出现的弹窗

... ... @@ -32,6 +32,7 @@ class CreateWatchThemeController extends GetxController {
final isSaving = false.obs;
final List<int> _imageTaskVersions = List<int>.filled(4, 0);
bool _isClosed = false;
bool _creationCompleted = false;
late final TextEditingController themeNameController;
@override
... ... @@ -199,6 +200,9 @@ class CreateWatchThemeController extends GetxController {
}
Future<void> handleCreateBack() async {
if (_creationCompleted) {
return;
}
if (customThemeName.value.isEmpty &&
!customImagePaths.any((path) => path != null && path.isNotEmpty)) {
Get.back();
... ... @@ -260,12 +264,16 @@ class CreateWatchThemeController extends GetxController {
}
final createdTheme = await _loadCreatedTheme();
await Get.offAndToNamed(
Routes.WATCH_THEME_CUSTOM_PREVIEW,
arguments: {
'theme': createdTheme ?? _buildThemeItem(uploadedImageUrls),
},
_creationCompleted = true;
unawaited(
Get.offNamed(
Routes.WATCH_THEME_CUSTOM_PREVIEW,
arguments: {
'theme': createdTheme ?? _buildThemeItem(uploadedImageUrls),
},
),
);
return;
} catch (_) {
AppToast.show('创建表盘失败,请重试');
} finally {
... ...
... ... @@ -16,7 +16,11 @@ class CreateWatchThemeView extends GetView<CreateWatchThemeController> {
final topPadding = MediaQuery.paddingOf(context).top + kToolbarHeight;
return PopScope(
canPop: false,
onPopInvokedWithResult: (_, __) => controller.handleCreateBack(),
onPopInvokedWithResult: (didPop, _) {
if (!didPop) {
controller.handleCreateBack();
}
},
child: WatchThemeGradientScaffold(
title: '创作主题',
onBack: controller.handleCreateBack,
... ...