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; color = Colors.white;
} }
if (type == 'color') { if (type == 'color') {
bgColor = t.primaryContainer.withOpacity(0.5); bgColor = t.secondaryContainer.withOpacity(0.5);
color = t.primary; color = t.onSecondaryContainer;
} }
if (type == 'line') { if (type == 'line') {
bgColor = Colors.transparent; bgColor = Colors.transparent;

View File

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

View File

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

View File

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

View File

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