From 6e6f53bf79afd989cf1e70e9686d2ad4feff2b28 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Tue, 27 Aug 2024 13:15:20 +0800 Subject: [PATCH] mod: vip color --- lib/pages/dynamics/widgets/author_panel.dart | 5 +- lib/pages/member/view.dart | 67 ++++++++++++------- .../detail/reply/widgets/reply_item.dart | 4 +- lib/utils/utils.dart | 6 ++ 4 files changed, 52 insertions(+), 30 deletions(-) diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index ec0f7ead..92dc42de 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -1,4 +1,3 @@ -import 'package:PiliPalaX/utils/storage.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -58,9 +57,7 @@ class AuthorPanel extends StatelessWidget { style: TextStyle( color: item.modules.moduleAuthor!.vip != null && item.modules.moduleAuthor!.vip['status'] > 0 - ? GStorage.brightness == Brightness.light - ? const Color(0xFFFF6699) - : const Color(0xFFD44E7D) + ? Utils.vipColor : Theme.of(context).colorScheme.onSurface, fontSize: Theme.of(context).textTheme.titleSmall!.fontSize, ), diff --git a/lib/pages/member/view.dart b/lib/pages/member/view.dart index 72fcf347..693bf9ef 100644 --- a/lib/pages/member/view.dart +++ b/lib/pages/member/view.dart @@ -94,9 +94,8 @@ class _MemberPageState extends State () => Text( _memberController.memberInfo.value.name ?? '', style: TextStyle( - color: Theme.of(context) - .colorScheme - .onBackground, + color: + Theme.of(context).colorScheme.onSurface, fontSize: 14), ), ), @@ -152,6 +151,9 @@ class _MemberPageState extends State ), Expanded( child: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics( + parent: BouncingScrollPhysics(), + ), controller: _extendNestCtr, child: Padding( padding: EdgeInsets.only( @@ -353,10 +355,14 @@ class _MemberPageState extends State _memberController.memberInfo.value.name ?? '', maxLines: 1, overflow: TextOverflow.ellipsis, - style: Theme.of(context) - .textTheme - .titleMedium! - .copyWith(fontWeight: FontWeight.bold), + style: Theme.of(context).textTheme.titleMedium!.copyWith( + fontWeight: FontWeight.bold, + color: _memberController.memberInfo.value.vip?.status != + null && + _memberController.memberInfo.value.vip!.status! > 0 + ? Utils.vipColor + : Theme.of(context).colorScheme.onSurface, + ), )), const SizedBox(width: 2), if (_memberController.memberInfo.value.sex == '女') @@ -403,22 +409,37 @@ class _MemberPageState extends State _memberController.memberInfo.value.vip!.label!['text'], ), ], - TextButton( - child: Text("UID ${_memberController.mid}", - style: TextStyle( - color: Theme.of(context) - .colorScheme - .secondary - .withOpacity(0.5), - fontSize: 12, - // fontWeight: FontWeight.w200, - )), - onPressed: () { - Clipboard.setData( - ClipboardData(text: _memberController.mid.toString()), - ); - SmartDialog.showToast('已复制${_memberController.mid}至剪贴板'); - }), + const SizedBox(width: 5), + GestureDetector( + onTap: () { + Clipboard.setData( + ClipboardData(text: _memberController.mid.toString()), + ); + SmartDialog.showToast('已复制${_memberController.mid}至剪贴板'); + }, + child: Container( + padding: + const EdgeInsets.symmetric(horizontal: 8, vertical: 2.5), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondaryContainer, + borderRadius: const BorderRadius.all(Radius.circular(12)), + ), + child: Text( + 'UID: ${_memberController.mid}', + style: TextStyle( + height: 1, + fontSize: 12, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.onSecondaryContainer, + ), + strutStyle: const StrutStyle( + height: 1, + leading: 0, + fontSize: 12, + ), + ), + ), + ), ], ), if (_memberController.memberInfo.value.official != null && diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index a4d409bb..000843fb 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -188,9 +188,7 @@ class ReplyItem extends StatelessWidget { style: TextStyle( color: (replyItem!.member!.vip!['vipStatus'] > 0 && replyItem!.member!.vip!['vipType'] == 2) - ? GStorage.brightness == Brightness.light - ? const Color(0xFFFF6699) - : const Color(0xFFD44E7D) + ? Utils.vipColor : Theme.of(context).colorScheme.outline, fontSize: 13, ), diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 001b0814..467c89da 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -21,6 +21,12 @@ import '../models/github/latest.dart'; class Utils { static final Random random = Random(); + static Color get vipColor { + return GStorage.brightness == Brightness.light + ? const Color(0xFFFF6699) + : const Color(0xFFD44E7D); + } + static Future getCookiePath() async { final Directory tempDir = await getApplicationSupportDirectory(); final String tempPath = "${tempDir.path}/.plpl/";