opt: color scheme

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-14 13:38:24 +08:00
parent bc0914e146
commit 4e7cf0a1bd
5 changed files with 90 additions and 104 deletions

View File

@@ -42,8 +42,8 @@ class PBadge extends StatelessWidget {
color = Colors.white;
}
if (type == 'color') {
bgColor = t.primaryContainer.withOpacity(0.5);
color = t.primary;
bgColor = t.secondaryContainer.withOpacity(0.5);
color = t.onSecondaryContainer;
}
if (type == 'line') {
bgColor = Colors.transparent;

View File

@@ -221,11 +221,7 @@ class MyApp extends StatelessWidget {
titleTextStyle: TextStyle(fontSize: 16, color: colorScheme.onSurface),
),
navigationBarTheme: NavigationBarThemeData(
surfaceTintColor: isDynamic
? colorScheme.surfaceTint
: isDark
? colorScheme.surfaceTint
: null,
surfaceTintColor: isDynamic ? colorScheme.onSurfaceVariant : null,
),
snackBarTheme: SnackBarThemeData(
actionTextColor: colorScheme.primary,
@@ -242,27 +238,16 @@ class MyApp extends StatelessWidget {
},
),
popupMenuTheme: PopupMenuThemeData(
surfaceTintColor:
isDynamic || variant == FlexSchemeVariant.material3Legacy
? isDark
? colorScheme.surfaceTint
: null
: null,
surfaceTintColor: isDynamic ? colorScheme.onSurfaceVariant : null,
),
cardTheme: CardTheme(
elevation: 1,
surfaceTintColor: isDynamic
? colorScheme.surfaceTint
: variant == FlexSchemeVariant.material3Legacy
? isDark
? colorScheme.surfaceTint
: null
: null,
surfaceTintColor: isDark ? colorScheme.onSurfaceVariant : null,
shadowColor: Colors.transparent,
),
dialogTheme: DialogTheme(
surfaceTintColor: isDark ? colorScheme.surfaceTint : null,
),
// dialogTheme: DialogTheme(
// surfaceTintColor: isDark ? colorScheme.onSurfaceVariant : null,
// ),
progressIndicatorTheme: ProgressIndicatorThemeData(
refreshBackgroundColor: colorScheme.onSecondary,
),

View File

@@ -101,69 +101,73 @@ class UserInfoCard extends StatelessWidget {
_buildLeft(BuildContext context) => [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Wrap(
spacing: 5,
runSpacing: 8,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
GestureDetector(
onTap: () => Utils.copyText(card.name ?? ''),
child: Text(
card.name ?? '',
style: TextStyle(
height: 1,
fontSize: 17,
fontWeight: FontWeight.bold,
color: (card.vip?.vipStatus ?? -1) > 0 &&
card.vip?.vipType == 2
? context.vipColor
: null,
child: FittedBox(
child: Row(
children: [
GestureDetector(
onTap: () => Utils.copyText(card.name ?? ''),
child: Text(
card.name ?? '',
style: TextStyle(
height: 1,
fontSize: 17,
fontWeight: FontWeight.bold,
color: (card.vip?.vipStatus ?? -1) > 0 &&
card.vip?.vipType == 2
? context.vipColor
: null,
),
),
),
),
Image.asset(
'assets/images/lv/lv${card.levelInfo?.currentLevel}.png',
height: 11,
semanticLabel: '等级${card.levelInfo?.currentLevel}',
),
if (card.vip?.vipStatus == 1)
CachedNetworkImage(
imageUrl: card.vip!.label!.image!,
height: 20,
const SizedBox(width: 8),
Image.asset(
'assets/images/lv/lv${card.levelInfo?.currentLevel}.png',
height: 11,
semanticLabel: '等级${card.levelInfo?.currentLevel}',
),
// if (card.nameplate?.image?.isNotEmpty == true)
// CachedNetworkImage(
// imageUrl: card.nameplate!.image!,
// height: 20,
// ),
// GestureDetector(
// onTap: () {
// Utils.copyText(card.mid.toString());
// },
// 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: ${card.mid}',
// style: TextStyle(
// height: 1,
// fontSize: 12,
// fontWeight: FontWeight.w500,
// color: Theme.of(context).colorScheme.onSecondaryContainer,
// ),
// strutStyle: const StrutStyle(
// height: 1,
// leading: 0,
// fontSize: 12,
// ),
// ),
// ),
// ),
],
if (card.vip?.vipStatus == 1) ...[
const SizedBox(width: 8),
CachedNetworkImage(
imageUrl: card.vip!.label!.image!,
height: 20,
),
],
if (card.nameplate?.image?.isNotEmpty == true) ...[
const SizedBox(width: 8),
CachedNetworkImage(
imageUrl: card.nameplate!.image!,
height: 20,
),
],
// GestureDetector(
// onTap: () {
// Utils.copyText(card.mid.toString());
// },
// 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: ${card.mid}',
// style: TextStyle(
// height: 1,
// fontSize: 12,
// fontWeight: FontWeight.w500,
// color: Theme.of(context).colorScheme.onSecondaryContainer,
// ),
// strutStyle: const StrutStyle(
// height: 1,
// leading: 0,
// fontSize: 12,
// ),
// ),
// ),
// ),
],
),
),
),
if (card.officialVerify?.desc?.isNotEmpty == true)
@@ -275,25 +279,21 @@ class UserInfoCard extends StatelessWidget {
children: List.generate(
5,
(index) => index % 2 == 0
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: _countWidget(
title: ['粉丝', '关注', '获赞'][index ~/ 2],
count: index == 0
? card.fans
: index == 2
? card.attention
: card.likes?.likeNum ?? 0,
onTap: () {
if (index == 0) {
Get.toNamed(
'/fan?mid=${card.mid}&name=${card.name}');
} else if (index == 2) {
Get.toNamed(
'/follow?mid=${card.mid}&name=${card.name}');
}
},
),
? _countWidget(
title: ['粉丝', '关注', '获赞'][index ~/ 2],
count: index == 0
? card.fans
: index == 2
? card.attention
: card.likes?.likeNum ?? 0,
onTap: () {
if (index == 0) {
Get.toNamed('/fan?mid=${card.mid}&name=${card.name}');
} else if (index == 2) {
Get.toNamed(
'/follow?mid=${card.mid}&name=${card.name}');
}
},
)
: SizedBox(
height: 15,
@@ -462,6 +462,7 @@ class UserInfoCard extends StatelessWidget {
child: _buildBadge(context),
),
Positioned(
left: 120,
top: 140,
right: 20,
child: _buildRight(context),

View File

@@ -686,7 +686,7 @@ class ReplyItem extends StatelessWidget {
TextSpan(
text: matchStr,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.primary.withOpacity(0.8),
),
recognizer: TapGestureRecognizer()
..onTap = () {

View File

@@ -709,7 +709,7 @@ class ReplyItemGrpc extends StatelessWidget {
TextSpan(
text: matchStr,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.primary.withOpacity(0.8),
),
recognizer: TapGestureRecognizer()
..onTap = () {