diff --git a/lib/app/router/app_router.dart b/lib/app/router/app_router.dart index 176477b..1dde563 100644 --- a/lib/app/router/app_router.dart +++ b/lib/app/router/app_router.dart @@ -13,6 +13,7 @@ import '../../features/auth/presentation/legal_document_page.dart'; import '../../features/auth/presentation/splash_page.dart'; import '../../features/home/presentation/home_page.dart'; import '../../features/home/presentation/home_tab_pager.dart'; +import '../../features/home/presentation/home_layout_page.dart'; import '../../features/home/presentation/home_tab.dart'; import '../../features/home/presentation/map_page.dart'; import '../../features/home/presentation/screenshot_page.dart'; @@ -216,6 +217,10 @@ GoRouter buildAppRouter() { path: '/wallpaper', builder: (context, state) => const WallpaperPage(), ), + _cupertinoRoute( + path: '/home-layout', + builder: (context, state) => const HomeLayoutPage(), + ), StatefulShellRoute( builder: (context, state, shell) => HomePage(navigationShell: shell), navigatorContainerBuilder: (context, shell, children) => diff --git a/lib/features/device/data/device_api.dart b/lib/features/device/data/device_api.dart index 2a938e2..e52485c 100644 --- a/lib/features/device/data/device_api.dart +++ b/lib/features/device/data/device_api.dart @@ -17,6 +17,9 @@ import 'package:ttstd_family_care/features/device/domain/device_models.dart'; class DeviceApi { const DeviceApi(); + /// 首页分页布局接口路径(家属端)。 + static const String _homeLayoutPath = 'v1/client/sn/home-layout'; + /// 获取当前用户已绑定的设备列表。 Future> getMyDevices() async { try { @@ -176,6 +179,53 @@ class DeviceApi { } } + /// 获取已绑定设备首页分页布局(分页顺序 + 默认展示页)。 + /// + /// 对应后台 `GET /api/v1/client/sn/home-layout?sn=xxx`;未配置时后台返回默认布局。 + /// 失败时返回 null。 + Future getHomeLayout(String sn) async { + try { + final data = await DioClient.get( + _homeLayoutPath, + allowStale: true, + queryParameters: {'sn': sn}, + ); + return data is Map + ? DeviceHomeLayout.fromJson(data) + : null; + } on ApiException { + return null; + } + } + + /// 保存设备首页分页布局并推送设备(老人端收到后重建桌面)。 + /// + /// 对应后台 `PUT /api/v1/client/sn/home-layout?sn=xxx`,请求体 + /// `{pages, defaultPage}`。返回值直接使用后台已规范化的顺序回填本地, + /// 无需再发起一次 GET。 + Future<({DeviceHomeLayout? layout, String? error})> saveHomeLayout( + String sn, List pages, String defaultPage) async { + try { + final data = await DioClient.put( + '$_homeLayoutPath?sn=${Uri.encodeQueryComponent(sn)}', + data: {'pages': pages, 'defaultPage': defaultPage}, + ); + await DioClient.invalidateReadCache( + _homeLayoutPath, + queryParameters: {'sn': sn}, + ); + final layout = + data is Map ? DeviceHomeLayout.fromJson(data) : null; + debugPrint('[DeviceApi] saveHomeLayout sn=$sn pages=$pages data=$data'); + return (layout: layout, error: null); + } on ApiException catch (e) { + debugPrint( + '[DeviceApi] saveHomeLayout sn=$sn pages=$pages failed: ${e.message}', + ); + return (layout: null, error: e.message); + } + } + /// 向设备下发操作指令(重启/关机/截屏/刷新/定位/拍照等)。 /// /// [op] 为后端操作标识,如 `reboot` / `shutdown` / `screenshot` / `refresh` / `locate` / `take_photo`, diff --git a/lib/features/device/data/device_repository_impl.dart b/lib/features/device/data/device_repository_impl.dart index 27ccecf..a155576 100644 --- a/lib/features/device/data/device_repository_impl.dart +++ b/lib/features/device/data/device_repository_impl.dart @@ -54,6 +54,14 @@ class DeviceRepositoryImpl implements DeviceRepository { Future togglePolicy(String sn, String field, int value) => _api.togglePolicy(sn, field, value); + @override + Future getHomeLayout(String sn) => _api.getHomeLayout(sn); + + @override + Future<({DeviceHomeLayout? layout, String? error})> saveHomeLayout( + String sn, List pages, String defaultPage) => + _api.saveHomeLayout(sn, pages, defaultPage); + @override Future sendDeviceOp(String sn, String op, {Map? extra}) => _api.sendDeviceOp(sn, op, extra: extra); diff --git a/lib/features/device/domain/device_models.dart b/lib/features/device/domain/device_models.dart index ed13e83..109b1b8 100644 --- a/lib/features/device/domain/device_models.dart +++ b/lib/features/device/domain/device_models.dart @@ -521,6 +521,56 @@ class DevicePictureInfo { ); } +/// 设备首页分页布局(与后台 DeviceHomeLayoutVO 对齐)。 +/// +/// [pages] 为老人端桌面的分页展示顺序,取值 [slotHome] / [slotContact] / +/// [slotSettings];应用页(apps)由老人端按已安装应用动态生成,恒排在最后, +/// 不参与排序。[defaultPage] 为开机与按 Home 键时展示的页面,一定包含在 +/// [pages] 中。 +class DeviceHomeLayout { + const DeviceHomeLayout({ + this.serialno, + this.pages = const [], + this.defaultPage = defaultPageSlot, + }); + + /// 分页槽位:首页(天气 / 时间 / 应用宫格)。 + static const String slotHome = 'home'; + + /// 分页槽位:联系人页。 + static const String slotContact = 'contact'; + + /// 分页槽位:设置页。 + static const String slotSettings = 'settings'; + + /// 默认分页顺序,与后台 `DeviceHomeLayoutService.DEFAULT_PAGES` 保持一致。 + static const List defaultPages = [ + slotSettings, + slotContact, + slotHome, + ]; + + /// 默认展示页。 + static const String defaultPageSlot = slotHome; + + final String? serialno; + + /// 分页顺序(仅含可排序槽位)。 + final List pages; + + /// 默认展示页。 + final String defaultPage; + + factory DeviceHomeLayout.fromJson(Map json) => + DeviceHomeLayout( + serialno: json['serialno'] as String?, + pages: (json['pages'] as List? ?? const []) + .whereType() + .toList(), + defaultPage: json['defaultPage'] as String? ?? defaultPageSlot, + ); +} + /// 容错整型解析:后台可能以字符串(如 "123")或数字返回整型字段, /// 直接用 `as int?` 在字符串场景下会抛出 /// `type 'String' is not a subtype of type 'int'`,故统一在此转换。 diff --git a/lib/features/device/domain/device_repository.dart b/lib/features/device/domain/device_repository.dart index 9a3f785..7c218f7 100644 --- a/lib/features/device/domain/device_repository.dart +++ b/lib/features/device/domain/device_repository.dart @@ -44,6 +44,16 @@ abstract class DeviceRepository { /// 成功返回 null;失败返回错误提示。 Future togglePolicy(String sn, String field, int value); + /// 已绑定设备首页分页布局(分页顺序 + 默认展示页),失败返回 null。 + Future getHomeLayout(String sn); + + /// 保存首页分页布局并推送设备。 + /// + /// 成功时 [layout] 为后台规范化后的布局,可直接用于本地顺序(避免再次请求); + /// 失败时 [error] 为后台错误提示。 + Future<({DeviceHomeLayout? layout, String? error})> saveHomeLayout( + String sn, List pages, String defaultPage); + /// 向设备下发操作指令(重启/关机/截屏/刷新/定位/拍照等)。 /// /// [op] 为后端操作标识,如 `reboot` / `shutdown` / `screenshot` / `refresh` / `locate` / `take_photo`。 diff --git a/lib/features/home/presentation/home_layout_page.dart b/lib/features/home/presentation/home_layout_page.dart new file mode 100644 index 0000000..a05f449 --- /dev/null +++ b/lib/features/home/presentation/home_layout_page.dart @@ -0,0 +1,442 @@ +import 'dart:async'; + +import 'package:cupertino_ui/cupertino_ui.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:material_ui/material_ui.dart'; +import 'package:ttstd_family_care/app/theme/dark_mode.dart'; +import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart'; + +import '../../../core/network/error_message.dart'; +import '../../../core/widgets/cupertino_hint.dart'; +import '../../../core/widgets/feature_ui.dart'; +import '../../../features/device/data/device_providers.dart'; +import '../../../features/device/domain/device_models.dart'; +import '../../../features/device/presentation/device_switcher.dart'; +import '../../../l10n/app_localizations.dart'; + +/// 首页布局页(首页 → 系统设置 → 首页布局)。 +/// +/// 家属端远程调整老人端桌面(ElderlyDialer)的分页顺序: +/// - 列表上下拖动即可排序,**松手立即保存**,不需要额外的提交按钮; +/// - 保存接口返回的顺序直接回填本地,不再重复请求; +/// - 右上角「默认」恢复服务端默认排序并立即保存; +/// - 请求期间展示模态 loading,屏蔽页面操作,避免重复提交。 +/// +/// 应用页(apps)由老人端按已安装应用动态生成,恒排在最后,不参与排序。 +class HomeLayoutPage extends ConsumerStatefulWidget { + const HomeLayoutPage({super.key}); + + @override + ConsumerState createState() => _HomeLayoutPageState(); +} + +class _HomeLayoutPageState extends ConsumerState { + /// 可排序槽位(与后台规范化白名单一致)。 + static const Set _sortableSlots = { + DeviceHomeLayout.slotHome, + DeviceHomeLayout.slotContact, + DeviceHomeLayout.slotSettings, + }; + + List _pages = const []; + String _defaultPage = DeviceHomeLayout.defaultPageSlot; + bool _loading = true; + bool _saving = false; + int _loadVersion = 0; + + AppLocalizations get _l10n => AppLocalizations.of(context); + + String? get _sn => ref.read(selectedDeviceSnProvider); + + /// 请求进行中:屏蔽拖动与按钮,避免并发保存。 + bool get _busy => _loading || _saving; + + @override + void initState() { + super.initState(); + _load(); + } + + @override + void dispose() { + _loadVersion++; + super.dispose(); + } + + /// 拉取当前设备的首页布局(失败时回落到默认顺序,页面仍可操作)。 + Future _load() async { + final sn = _sn; + final version = ++_loadVersion; + if (sn == null || sn.isEmpty) { + setState(() { + _loading = false; + _apply(null); + }); + return; + } + setState(() => _loading = true); + final layout = await ref.read(deviceRepositoryProvider).getHomeLayout(sn); + if (!mounted || version != _loadVersion) return; + setState(() { + _loading = false; + _apply(layout); + }); + } + + /// 应用服务端返回的布局;本地再做一次防御性规范化。 + void _apply(DeviceHomeLayout? layout) { + if (layout == null) { + _pages = List.of(DeviceHomeLayout.defaultPages); + _defaultPage = DeviceHomeLayout.defaultPageSlot; + return; + } + final pages = _sanitize(layout.pages); + _pages = pages; + _defaultPage = pages.contains(layout.defaultPage) + ? layout.defaultPage + : (pages.contains(DeviceHomeLayout.defaultPageSlot) + ? DeviceHomeLayout.defaultPageSlot + : pages.first); + } + + /// 过滤非法槽位、去重、保证首页存在(与后台规范化规则保持一致)。 + static List _sanitize(List pages) { + final order = []; + for (final page in pages) { + if (_sortableSlots.contains(page) && !order.contains(page)) { + order.add(page); + } + } + if (order.isEmpty) return List.of(DeviceHomeLayout.defaultPages); + if (!order.contains(DeviceHomeLayout.slotHome)) { + // 首页承载天气 / 时间 / 应用宫格,不允许被隐藏 + order.insert(0, DeviceHomeLayout.slotHome); + } + return order; + } + + /// 拖动排序:先更新本地顺序,松手后立即保存。 + void _onReorder(int oldIndex, int newIndex) { + if (_busy) return; + final count = _pages.length; + if (newIndex >= count) newIndex = count - 1; + if (newIndex < 0) newIndex = 0; + if (newIndex == oldIndex) return; + final previous = _snapshot(); + setState(() { + final page = _pages.removeAt(oldIndex); + _pages.insert(newIndex, page); + }); + unawaited(_save(previous)); + } + + /// 恢复服务端默认排序并立即保存。 + Future _restoreDefault() async { + if (_busy) return; + final previous = _snapshot(); + setState(() { + _pages = List.of(DeviceHomeLayout.defaultPages); + _defaultPage = DeviceHomeLayout.defaultPageSlot; + }); + final saved = await _save(previous); + if (saved && mounted) { + showCupertinoHint(context, _l10n.homeLayoutResetDone); + } + } + + /// 当前布局快照,保存失败时用于整体回滚。 + ({List pages, String defaultPage}) _snapshot() => ( + pages: List.of(_pages), + defaultPage: _defaultPage, + ); + + /// 保存当前顺序;成功后用接口返回的顺序覆盖本地,避免再次请求。 + /// + /// [previous] 为保存前的快照,失败时用于回滚(服务端未变更,本地也不应保留)。 + Future _save(({List pages, String defaultPage}) previous) async { + final sn = _sn; + if (sn == null || sn.isEmpty) { + _rollback(previous); + _showNoDevice(); + return false; + } + setState(() => _saving = true); + try { + final result = await ref + .read(deviceRepositoryProvider) + .saveHomeLayout(sn, _pages, _defaultPage); + if (!mounted) return false; + if (result.error case final error?) { + _rollback(previous); + showCupertinoHint(context, error); + return false; + } + setState(() => _apply(result.layout)); + return true; + } catch (error) { + if (!mounted) return false; + _rollback(previous); + showCupertinoHint(context, userMessageOf(error)); + return false; + } finally { + if (mounted) setState(() => _saving = false); + } + } + + /// 回滚到保存前的顺序与默认页。 + void _rollback(({List pages, String defaultPage}) previous) { + if (!mounted) return; + setState(() { + _pages = previous.pages; + _defaultPage = previous.defaultPage; + }); + } + + /// 未绑定设备提示。 + void _showNoDevice() { + showCupertinoHint(context, _l10n.contactNoDevice); + } + + @override + Widget build(BuildContext context) { + ref.listen(selectedDeviceSnProvider, (previous, next) { + if (previous == next) return; + setState(() { + _pages = const []; + _defaultPage = DeviceHomeLayout.defaultPageSlot; + }); + _load(); + }); + final l10n = _l10n; + return PopScope( + canPop: false, + onPopInvokedWithResult: (didPop, _) { + if (didPop || _busy) return; + if (context.canPop()) { + context.pop(); + } else { + context.go('/home'); + } + }, + child: Stack( + children: [ + AppPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: DeviceContextTitle(l10n.homeLayoutTitle), + leading: CupertinoButton( + padding: EdgeInsets.zero, + onPressed: _busy ? null : () => context.pop(), + child: const Icon(CupertinoIcons.back), + ), + // 右上角「默认」:恢复默认排序并保存 + trailing: CupertinoButton( + padding: const EdgeInsets.symmetric(horizontal: 4), + onPressed: _busy ? null : _restoreDefault, + child: Text( + l10n.homeLayoutReset, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.w600, + color: _busy + ? CupertinoColors.inactiveGray + : AppColors.green, + ), + ), + ), + ), + child: SafeArea(child: _buildBody(l10n)), + ), + if (_busy) ...[ + const Positioned.fill( + child: ModalBarrier( + dismissible: false, + color: Color(0x55000000), + ), + ), + const Center( + child: CupertinoPopupSurface( + child: Padding( + padding: EdgeInsets.all(28), + child: CupertinoActivityIndicator(radius: 14), + ), + ), + ), + ], + ], + ), + ); + } + + Widget _buildBody(AppLocalizations l10n) { + if (_pages.isEmpty) { + return Center( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 40), + child: Text( + l10n.homeLayoutLoadFailed, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 13, + color: DarkMode.color(context, AppColors.sub), + ), + ), + ), + ); + } + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(18, 12, 18, 6), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + l10n.homeLayoutDragTip, + style: TextStyle( + fontSize: 12, + color: DarkMode.color(context, AppColors.sub), + ), + ), + const SizedBox(height: 2), + Text( + l10n.homeLayoutAppsNote, + style: TextStyle( + fontSize: 11, + color: DarkMode.color(context, AppColors.sub), + ), + ), + ], + ), + ), + Expanded( + child: ReorderableListView.builder( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 24), + buildDefaultDragHandles: false, + // 默认 proxyDecorator 用不透明 Material 包裹拖拽项,会把圆角 + // 与内边距渲染成白底;改用透明 Material,仅保留阴影。 + proxyDecorator: (child, index, animation) => Material( + type: MaterialType.canvas, + color: Colors.transparent, + elevation: 4, + shadowColor: Colors.black26, + borderRadius: BorderRadius.circular(14), + child: child, + ), + itemCount: _pages.length, + onReorderItem: _onReorder, + itemBuilder: (context, index) => Padding( + key: ValueKey('home_layout_${_pages[index]}'), + padding: const EdgeInsets.only(bottom: 12), + child: _buildTile(index), + ), + ), + ), + ], + ); + } + + /// 单个分页项:图标 + 标题/说明 + 右侧拖动把手。 + Widget _buildTile(int index) { + final slot = _pages[index]; + final info = _slotInfo(slot); + return Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), + decoration: BoxDecoration( + color: DarkMode.color(context, AppColors.card), + borderRadius: BorderRadius.circular(14), + ), + child: Row( + children: [ + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + color: info.color, + borderRadius: BorderRadius.circular(11), + ), + child: Center( + child: Text(info.emoji, style: const TextStyle(fontSize: 17)), + ), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + info.title, + style: TextStyle( + fontSize: 14.5, + fontWeight: FontWeight.w600, + color: DarkMode.color(context, AppColors.ink), + ), + ), + const SizedBox(height: 2), + Text( + info.subtitle, + style: TextStyle( + fontSize: 12, + color: DarkMode.color(context, AppColors.sub), + ), + ), + ], + ), + ), + ReorderableDragStartListener( + index: index, + child: Padding( + padding: const EdgeInsets.only(left: 10), + child: Icon( + CupertinoIcons.bars, + size: 20, + color: DarkMode.color(context, AppColors.sub), + ), + ), + ), + ], + ), + ); + } + + /// 槽位对应的展示信息。 + _SlotInfo _slotInfo(String slot) { + final l10n = _l10n; + return switch (slot) { + DeviceHomeLayout.slotContact => _SlotInfo( + emoji: '👥', + color: AppColors.green, + title: l10n.homeLayoutSlotContact, + subtitle: l10n.homeLayoutSlotContactDesc, + ), + DeviceHomeLayout.slotSettings => _SlotInfo( + emoji: '⚙️', + color: AppColors.gray, + title: l10n.homeLayoutSlotSettings, + subtitle: l10n.homeLayoutSlotSettingsDesc, + ), + _ => _SlotInfo( + emoji: '🏠', + color: AppColors.blue, + title: l10n.homeLayoutSlotHome, + subtitle: l10n.homeLayoutSlotHomeDesc, + ), + }; + } +} + +/// 单个分页槽位的展示信息。 +class _SlotInfo { + const _SlotInfo({ + required this.emoji, + required this.color, + required this.title, + required this.subtitle, + }); + + final String emoji; + final Color color; + final String title; + final String subtitle; +} diff --git a/lib/features/home/presentation/system_settings_page.dart b/lib/features/home/presentation/system_settings_page.dart index f911cd1..7c67cce 100644 --- a/lib/features/home/presentation/system_settings_page.dart +++ b/lib/features/home/presentation/system_settings_page.dart @@ -6,6 +6,7 @@ import 'package:ttstd_family_care/core/widgets/cupertino_hint.dart'; import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart'; import '../../../core/widgets/feature_ui.dart'; +import '../../../core/widgets/settings_ui.dart'; import '../../../core/network/error_message.dart'; import 'system_settings_controller.dart'; import '../../../features/device/data/device_providers.dart'; @@ -169,6 +170,18 @@ class SystemSettingsPage extends ConsumerWidget { return ListView( padding: const EdgeInsets.only(bottom: 24), children: [ + // 首页布局入口:与策略开关分开,进入后可拖动调整老人端桌面分页顺序 + SectionTitle(l10n.homeLayoutTitle), + CardBox( + padding: EdgeInsets.zero, + child: SettingsRow( + emoji: '🏠', + color: AppColors.blue, + title: l10n.homeLayoutTitle, + subtitle: l10n.homeLayoutEntrySubtitle, + onTap: () => context.push('/home-layout'), + ), + ), for (final group in groups) ...[ SectionTitle(group.title), CardBox( diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 199c325..c5079f1 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -2635,6 +2635,84 @@ abstract class AppLocalizations { /// In zh, this message translates to: /// **'让平板拨打 {phone}?'** String callRecordsReverseDialConfirm(String phone); + + /// 系统设置:首页布局入口与页面标题 + /// + /// In zh, this message translates to: + /// **'首页布局'** + String get homeLayoutTitle; + + /// 系统设置:首页布局入口副标题 + /// + /// In zh, this message translates to: + /// **'调整老人端桌面的分页顺序'** + String get homeLayoutEntrySubtitle; + + /// 首页布局:右上角恢复默认排序按钮 + /// + /// In zh, this message translates to: + /// **'默认'** + String get homeLayoutReset; + + /// 首页布局:恢复默认排序成功提示 + /// + /// In zh, this message translates to: + /// **'已恢复默认排序'** + String get homeLayoutResetDone; + + /// 首页布局:拖动排序提示 + /// + /// In zh, this message translates to: + /// **'拖动右侧把手调整上下顺序,松手后立即保存'** + String get homeLayoutDragTip; + + /// 首页布局:应用页固定排最后的说明 + /// + /// In zh, this message translates to: + /// **'应用页由老人端按已安装应用生成,始终排在最后'** + String get homeLayoutAppsNote; + + /// 首页布局:首页分页名称 + /// + /// In zh, this message translates to: + /// **'首页'** + String get homeLayoutSlotHome; + + /// 首页布局:首页分页说明 + /// + /// In zh, this message translates to: + /// **'天气、时间与应用宫格'** + String get homeLayoutSlotHomeDesc; + + /// 首页布局:联系人分页名称 + /// + /// In zh, this message translates to: + /// **'联系人'** + String get homeLayoutSlotContact; + + /// 首页布局:联系人分页说明 + /// + /// In zh, this message translates to: + /// **'常用联系人呼叫'** + String get homeLayoutSlotContactDesc; + + /// 首页布局:设置分页名称 + /// + /// In zh, this message translates to: + /// **'设置'** + String get homeLayoutSlotSettings; + + /// 首页布局:设置分页说明 + /// + /// In zh, this message translates to: + /// **'系统设置入口'** + String get homeLayoutSlotSettingsDesc; + + /// 首页布局:加载失败提示 + /// + /// In zh, this message translates to: + /// **'加载首页布局失败,请返回重试'** + String get homeLayoutLoadFailed; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index f2dbd5b..221523b 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1329,4 +1329,46 @@ class AppLocalizationsEn extends AppLocalizations { String callRecordsReverseDialConfirm(String phone) { return 'Call $phone from the tablet?'; } + + @override + String get homeLayoutTitle => 'Home layout'; + + @override + String get homeLayoutEntrySubtitle => 'Rearrange the tablet home pages'; + + @override + String get homeLayoutReset => 'Default'; + + @override + String get homeLayoutResetDone => 'Default order restored'; + + @override + String get homeLayoutDragTip => + 'Drag the handle on the right to reorder. Changes save immediately.'; + + @override + String get homeLayoutAppsNote => + 'App pages are generated from installed apps and always come last.'; + + @override + String get homeLayoutSlotHome => 'Home'; + + @override + String get homeLayoutSlotHomeDesc => 'Weather, clock and app grid'; + + @override + String get homeLayoutSlotContact => 'Contacts'; + + @override + String get homeLayoutSlotContactDesc => 'Call frequent contacts'; + + @override + String get homeLayoutSlotSettings => 'Settings'; + + @override + String get homeLayoutSlotSettingsDesc => 'System settings entry'; + + @override + String get homeLayoutLoadFailed => + 'Failed to load the home layout. Please go back and retry.'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 2dc6647..9c3d352 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -1295,4 +1295,43 @@ class AppLocalizationsZh extends AppLocalizations { String callRecordsReverseDialConfirm(String phone) { return '让平板拨打 $phone?'; } + + @override + String get homeLayoutTitle => '首页布局'; + + @override + String get homeLayoutEntrySubtitle => '调整老人端桌面的分页顺序'; + + @override + String get homeLayoutReset => '默认'; + + @override + String get homeLayoutResetDone => '已恢复默认排序'; + + @override + String get homeLayoutDragTip => '拖动右侧把手调整上下顺序,松手后立即保存'; + + @override + String get homeLayoutAppsNote => '应用页由老人端按已安装应用生成,始终排在最后'; + + @override + String get homeLayoutSlotHome => '首页'; + + @override + String get homeLayoutSlotHomeDesc => '天气、时间与应用宫格'; + + @override + String get homeLayoutSlotContact => '联系人'; + + @override + String get homeLayoutSlotContactDesc => '常用联系人呼叫'; + + @override + String get homeLayoutSlotSettings => '设置'; + + @override + String get homeLayoutSlotSettingsDesc => '系统设置入口'; + + @override + String get homeLayoutLoadFailed => '加载首页布局失败,请返回重试'; } diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 98332f7..d455a4f 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -434,5 +434,18 @@ "iconPackOriginal": "Restore original icons", "iconPackUnavailable": "Icon pack unavailable", "callRecordsConfirmDial": "Confirm call", - "callRecordsReverseDialConfirm": "Call {phone} from the tablet?" + "callRecordsReverseDialConfirm": "Call {phone} from the tablet?", + "homeLayoutTitle": "Home layout", + "homeLayoutEntrySubtitle": "Rearrange the tablet home pages", + "homeLayoutReset": "Default", + "homeLayoutResetDone": "Default order restored", + "homeLayoutDragTip": "Drag the handle on the right to reorder. Changes save immediately.", + "homeLayoutAppsNote": "App pages are generated from installed apps and always come last.", + "homeLayoutSlotHome": "Home", + "homeLayoutSlotHomeDesc": "Weather, clock and app grid", + "homeLayoutSlotContact": "Contacts", + "homeLayoutSlotContactDesc": "Call frequent contacts", + "homeLayoutSlotSettings": "Settings", + "homeLayoutSlotSettingsDesc": "System settings entry", + "homeLayoutLoadFailed": "Failed to load the home layout. Please go back and retry." } diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index 03b3e26..531c86b 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -1550,5 +1550,57 @@ "callRecordsReverseDialConfirm": "让平板拨打 {phone}?", "@callRecordsReverseDialConfirm": { "placeholders": {"phone": {"type": "String"}} + }, + "homeLayoutTitle": "首页布局", + "@homeLayoutTitle": { + "description": "系统设置:首页布局入口与页面标题" + }, + "homeLayoutEntrySubtitle": "调整老人端桌面的分页顺序", + "@homeLayoutEntrySubtitle": { + "description": "系统设置:首页布局入口副标题" + }, + "homeLayoutReset": "默认", + "@homeLayoutReset": { + "description": "首页布局:右上角恢复默认排序按钮" + }, + "homeLayoutResetDone": "已恢复默认排序", + "@homeLayoutResetDone": { + "description": "首页布局:恢复默认排序成功提示" + }, + "homeLayoutDragTip": "拖动右侧把手调整上下顺序,松手后立即保存", + "@homeLayoutDragTip": { + "description": "首页布局:拖动排序提示" + }, + "homeLayoutAppsNote": "应用页由老人端按已安装应用生成,始终排在最后", + "@homeLayoutAppsNote": { + "description": "首页布局:应用页固定排最后的说明" + }, + "homeLayoutSlotHome": "首页", + "@homeLayoutSlotHome": { + "description": "首页布局:首页分页名称" + }, + "homeLayoutSlotHomeDesc": "天气、时间与应用宫格", + "@homeLayoutSlotHomeDesc": { + "description": "首页布局:首页分页说明" + }, + "homeLayoutSlotContact": "联系人", + "@homeLayoutSlotContact": { + "description": "首页布局:联系人分页名称" + }, + "homeLayoutSlotContactDesc": "常用联系人呼叫", + "@homeLayoutSlotContactDesc": { + "description": "首页布局:联系人分页说明" + }, + "homeLayoutSlotSettings": "设置", + "@homeLayoutSlotSettings": { + "description": "首页布局:设置分页名称" + }, + "homeLayoutSlotSettingsDesc": "系统设置入口", + "@homeLayoutSlotSettingsDesc": { + "description": "首页布局:设置分页说明" + }, + "homeLayoutLoadFailed": "加载首页布局失败,请返回重试", + "@homeLayoutLoadFailed": { + "description": "首页布局:加载失败提示" } }