diff --git a/lib/components/topic/reply_item.dart b/lib/components/topic/reply_item.dart index b230f27..e39b4f6 100644 --- a/lib/components/topic/reply_item.dart +++ b/lib/components/topic/reply_item.dart @@ -78,6 +78,7 @@ class _ReplyListItemState extends State { final GlobalKey repaintKey = GlobalKey(); bool ignoreStatus = false; // 对当前主题的忽略状态 默认false String? loginUserName; + bool highLightOp = GStorage().getHighlightOp(); @override void initState() { @@ -416,7 +417,7 @@ class _ReplyListItemState extends State { return RepaintBoundary( key: repaintKey, child: Material( - color: reply.isOwner + color: reply.isOwner && highLightOp ? Theme.of(context).colorScheme.onInverseSurface : null, child: InkWell( @@ -446,7 +447,7 @@ class _ReplyListItemState extends State { child: Material( borderRadius: BorderRadius.circular(20), // color: reply.isOwner ? Theme.of(context).colorScheme.onInverseSurface : null, - elevation: reply.isOwner ? 3 : 0, + elevation: reply.isOwner && highLightOp ? 3 : 0, child: InkWell( onTap: () async { /// 增加200毫秒延迟 水波纹动画 diff --git a/lib/pages/page_setting.dart b/lib/pages/page_setting.dart index 60dfc1e..b587d62 100644 --- a/lib/pages/page_setting.dart +++ b/lib/pages/page_setting.dart @@ -27,6 +27,7 @@ class _SettingPageState extends State { late String cacheSize = ''; late bool expendAppBar = GStorage().getExpendAppBar(); late bool noticeOn = GStorage().getNoticeOn(); + late bool highlightOp = GStorage().getHighlightOp(); @override void initState() { @@ -238,6 +239,35 @@ class _SettingPageState extends State { }), ), ), + ListTile( + onTap: () { + setState(() { + highlightOp = !highlightOp; + GStorage().setHighlightOp(noticeOn); + }); + }, + leading: Icon(Icons.notifications_none, color: iconStyle), + title: const Text('突出显示OP回复'), + trailing: Transform.scale( + scale: 0.8, + child: Switch( + thumbIcon: MaterialStateProperty.resolveWith( + (Set states) { + if (states.isNotEmpty && + states.first == MaterialState.selected) { + return const Icon(Icons.done); + } + return null; // All other states will use the default thumbIcon. + }), + value: highlightOp, + onChanged: (value) { + setState(() { + highlightOp = !highlightOp; + GStorage().setHighlightOp(highlightOp); + }); + }), + ), + ), ListTile( onTap: () => Get.toNamed('/setFont'), leading: Icon(Icons.font_download_outlined, color: iconStyle), diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 24a2f23..f006951 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -25,7 +25,8 @@ enum StoreKeys { htmlFs, replyFs, tabs, - autoUpdate + autoUpdate, + highlightOp, } class GStorage { @@ -166,4 +167,9 @@ class GStorage { setAutoUpdate(bool value) => _box.write(StoreKeys.autoUpdate.toString(), value); bool getAutoUpdate() => _box.read(StoreKeys.autoUpdate.toString()) ?? true; + + // 自动更新 + setHighlightOp(bool value) => _box.write(StoreKeys.highlightOp.toString(), value); + + bool getHighlightOp() => _box.read(StoreKeys.highlightOp.toString()) ?? false; }