From 788f9930691f85633b8dd975a855cc8ebf0e34e7 Mon Sep 17 00:00:00 2001 From: DASHU <385321165@qq.com> Date: Mon, 9 Dec 2024 14:51:32 +0800 Subject: [PATCH] bookedit bugfix and hide quik action --- lib/component/bookmark_edit_dialog.dart | 66 +++++++++++++------------ lib/main.dart | 1 + lib/router/index/index_router.dart | 2 + 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/lib/component/bookmark_edit_dialog.dart b/lib/component/bookmark_edit_dialog.dart index fdd8437..06766a2 100644 --- a/lib/component/bookmark_edit_dialog.dart +++ b/lib/component/bookmark_edit_dialog.dart @@ -118,25 +118,27 @@ class _BookmarkEditDialog extends State { ), )); - list.add(Container( - child: Row( - children: [ - Text("Add to quick action"), - Expanded( - child: Checkbox( - value: addedToQa, - onChanged: (v) { - if (v != null) { - setState(() { - addedToQa = v; - }); - } - }, - ), - ) - ], - ), - )); + if (!PlatformUtil.isPC()) { + list.add(Container( + child: Row( + children: [ + Text("Add to quick action"), + Expanded( + child: Checkbox( + value: addedToQa, + onChanged: (v) { + if (v != null) { + setState(() { + addedToQa = v; + }); + } + }, + ), + ) + ], + ), + )); + } list.add(Container( margin: EdgeInsets.only( @@ -195,20 +197,22 @@ class _BookmarkEditDialog extends State { await BookmarkDB.update(bookmark); } - try { - var allQas = await BookmarkDB.allQas(); - List qas = []; - for (var bk in allQas) { - if (StringUtil.isBlank(bk.title) || StringUtil.isBlank(bk.url)) { - continue; - } + if (!PlatformUtil.isPC()) { + try { + var allQas = await BookmarkDB.allQas(); + List qas = []; + for (var bk in allQas) { + if (StringUtil.isBlank(bk.title) || StringUtil.isBlank(bk.url)) { + continue; + } - qas.add(ShortcutItem( - type: bk.url!, localizedTitle: bk.title!, icon: 'ic_launcher')); - quickActions.setShortcutItems(qas); + qas.add(ShortcutItem( + type: bk.url!, localizedTitle: bk.title!, icon: 'ic_launcher')); + quickActions.setShortcutItems(qas); + } + } catch (e) { + print(e); } - } catch (e) { - print(e); } await bookmarkProvider.reload(); diff --git a/lib/main.dart b/lib/main.dart index 00841ea..736b7b8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -97,6 +97,7 @@ Future main() async { await doInit(); + mediaDataCache = MediaDataCache(); await bookmarkProvider.init(); runApp(MyApp()); diff --git a/lib/router/index/index_router.dart b/lib/router/index/index_router.dart index 5268e0f..52d862c 100644 --- a/lib/router/index/index_router.dart +++ b/lib/router/index/index_router.dart @@ -67,6 +67,8 @@ class _IndexRouter extends CustState @override Widget doBuild(BuildContext context) { var themeData = Theme.of(context); + mediaDataCache.update(context); + // if (PlatformUtil.isAndroid()) { // WidgetsBinding.instance.addPostFrameCallback((_) async { // var intent = await getInitialIntent();