|
...
|
...
|
@@ -4,10 +4,13 @@ import 'dart:convert'; |
|
|
|
import 'package:doublefeel_flutter/core/network/api/theme_api.dart';
|
|
|
|
import 'package:doublefeel_flutter/core/result/app_result.dart';
|
|
|
|
import 'package:doublefeel_flutter/core/util/app_toast.dart';
|
|
|
|
import 'package:doublefeel_flutter/pigeon/platform_api.g.dart';
|
|
|
|
import 'package:doublefeel_flutter/pigeon/wear_engine_api.g.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
import '../../friends/models/friend_health_data.dart';
|
|
|
|
import '../../friends/views/select_friend_view.dart';
|
|
|
|
import '../models/watch_theme_models.dart';
|
|
|
|
import '../widgets/watch_theme_dialogs.dart';
|
|
|
|
import '../widgets/watch_theme_no_watch_dialog.dart';
|
|
...
|
...
|
@@ -108,8 +111,25 @@ class CustomWatchThemePreviewController extends GetxController { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void changeFriend() {
|
|
|
|
//TODO: - bottomSheet 的方式展示出 SelectFriendView
|
|
|
|
Future<void> changeFriend() async {
|
|
|
|
final selectedFriend = await Get.bottomSheet<FriendHealthData>(
|
|
|
|
SizedBox(
|
|
|
|
height: Get.height * 0.9,
|
|
|
|
child: const SelectFriendView(),
|
|
|
|
),
|
|
|
|
ignoreSafeArea: false,
|
|
|
|
isScrollControlled: true,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
barrierColor: const Color(0xB3000000),
|
|
|
|
);
|
|
|
|
if (selectedFriend == null) return;
|
|
|
|
|
|
|
|
await loadFriendTheme();
|
|
|
|
try {
|
|
|
|
await WearEngineHostApi().sendWatchSyncPayload('');
|
|
|
|
} catch (_) {
|
|
|
|
// The selected friend is saved on the server; native refresh can retry.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> addWatchFace() async {
|
|
...
|
...
|
@@ -120,20 +140,20 @@ class CustomWatchThemePreviewController extends GetxController { |
|
|
|
device = null;
|
|
|
|
}
|
|
|
|
if (device == null) {
|
|
|
|
await Get.dialog<void>(
|
|
|
|
await Get.bottomSheet<void>(
|
|
|
|
const WatchThemeNoWatchDialog(),
|
|
|
|
barrierDismissible: true,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
barrierColor: const Color(0xB3000000),
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
await Get.dialog<void>(
|
|
|
|
await Get.bottomSheet<void>(
|
|
|
|
WatchThemeSyncDialog(
|
|
|
|
themeImageUrl: themeItem.energeticImage,
|
|
|
|
onSync: applyAndSyncWatchFace,
|
|
|
|
),
|
|
|
|
barrierDismissible: false,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
barrierColor: const Color(0xB3000000),
|
|
|
|
);
|
|
|
|
}
|
...
|
...
|
|