opt: get theme color

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-28 21:32:30 +08:00
parent 451a84e696
commit ca993df0c6
149 changed files with 4415 additions and 4803 deletions

View File

@@ -13,6 +13,8 @@ class MemberArticleItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final outline = theme.colorScheme.outline;
return Material(
color: Colors.transparent,
child: InkWell(
@@ -23,7 +25,6 @@ class MemberArticleItem extends StatelessWidget {
},
onLongPress: () {
imageSaveDialog(
context: context,
title: item.title,
cover: item.originImageUrls?.firstOrNull,
);
@@ -65,10 +66,7 @@ class MemberArticleItem extends StatelessWidget {
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.bodyMedium!
.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
),
@@ -80,7 +78,7 @@ class MemberArticleItem extends StatelessWidget {
style: TextStyle(
fontSize: 12,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: outline,
),
),
const SizedBox(height: 3),
@@ -90,14 +88,14 @@ class MemberArticleItem extends StatelessWidget {
context: context,
value: item.stats?.view ?? 0,
goto: 'picture',
textColor: Theme.of(context).colorScheme.outline,
textColor: outline,
),
const SizedBox(width: 16),
StatView(
context: context,
goto: 'reply',
value: item.stats?.reply ?? 0,
textColor: Theme.of(context).colorScheme.outline,
textColor: outline,
),
],
),

View File

@@ -39,6 +39,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
}
_buildBody(LoadingState loadingState) {
final theme = Theme.of(context);
return switch (loadingState) {
Loading() => loadingWidget,
Success() => (loadingState.response as List?)?.isNotEmpty == true
@@ -50,12 +51,12 @@ class _MemberFavoriteState extends State<MemberFavorite>
slivers: [
SliverToBoxAdapter(
child: Obx(
() => _buildItem(_controller.first.value, true),
() => _buildItem(theme, _controller.first.value, true),
),
),
SliverToBoxAdapter(
child: Obx(
() => _buildItem(_controller.second.value, false),
() => _buildItem(theme, _controller.second.value, false),
),
),
SliverToBoxAdapter(
@@ -76,9 +77,9 @@ class _MemberFavoriteState extends State<MemberFavorite>
};
}
_buildItem(Datum data, bool isFirst) {
_buildItem(ThemeData theme, Datum data, bool isFirst) {
return Theme(
data: Theme.of(context).copyWith(
data: theme.copyWith(
dividerColor: Colors.transparent,
),
child: ExpansionTile(
@@ -95,7 +96,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
text: ' ${data.mediaListResponse?.count}',
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
],
@@ -127,14 +128,14 @@ class _MemberFavoriteState extends State<MemberFavorite>
? _controller.firstEnd.value
: _controller.secondEnd.value)
? const SizedBox.shrink()
: _buildLoadMoreItem(isFirst),
: _buildLoadMoreItem(theme, isFirst),
),
],
),
);
}
_buildLoadMoreItem(bool isFirst) {
_buildLoadMoreItem(ThemeData theme, bool isFirst) {
return ListTile(
dense: true,
onTap: () {
@@ -148,7 +149,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
'查看更多内容',
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
),
),
);

View File

@@ -16,6 +16,7 @@ class MemberFavItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Material(
color: Colors.transparent,
child: InkWell(
@@ -58,7 +59,6 @@ class MemberFavItem extends StatelessWidget {
},
onLongPress: () {
imageSaveDialog(
context: context,
title: item.title,
cover: item.cover,
);
@@ -100,12 +100,12 @@ class MemberFavItem extends StatelessWidget {
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.primary,
color: theme.colorScheme.primary,
),
child: Icon(
Icons.video_library_outlined,
size: 12,
color: Theme.of(context).colorScheme.onPrimary,
color: theme.colorScheme.onPrimary,
),
),
),
@@ -136,7 +136,7 @@ class MemberFavItem extends StatelessWidget {
: '${item.mediaCount}个内容',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
],

View File

@@ -19,7 +19,6 @@ class SeasonSeriesCard extends StatelessWidget {
return InkWell(
onLongPress: () {
imageSaveDialog(
context: context,
title: item['meta']['name'],
cover: item['meta']['cover'],
);
@@ -67,6 +66,7 @@ class SeasonSeriesCard extends StatelessWidget {
}
Widget videoContent(context) {
final theme = Theme.of(context);
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -75,7 +75,7 @@ class SeasonSeriesCard extends StatelessWidget {
item['meta']['name'],
textAlign: TextAlign.start,
style: TextStyle(
fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize,
fontSize: theme.textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
),
@@ -89,7 +89,7 @@ class SeasonSeriesCard extends StatelessWidget {
style: TextStyle(
fontSize: 12,
height: 1,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
overflow: TextOverflow.clip,
),
),

View File

@@ -61,6 +61,7 @@ class _MemberVideoState extends State<MemberVideo>
}
_buildBody(LoadingState<List<Item>?> loadingState) {
final theme = Theme.of(context);
return switch (loadingState) {
Loading() => loadingWidget,
Success() => loadingState.response?.isNotEmpty == true
@@ -82,7 +83,7 @@ class _MemberVideoState extends State<MemberVideo>
floating: true,
delegate: CustomSliverPersistentHeaderDelegate(
extent: 40,
bgColor: Theme.of(context).colorScheme.surface,
bgColor: theme.colorScheme.surface,
child: SizedBox(
height: 40,
child: Row(
@@ -115,9 +116,8 @@ class _MemberVideoState extends State<MemberVideo>
icon: Icon(
Icons.play_circle_outline_rounded,
size: 16,
color: Theme.of(context)
.colorScheme
.secondary,
color:
theme.colorScheme.secondary,
),
label: Text(
_controller.episodicButton.value
@@ -125,9 +125,8 @@ class _MemberVideoState extends State<MemberVideo>
'播放全部',
style: TextStyle(
fontSize: 13,
color: Theme.of(context)
.colorScheme
.secondary,
color:
theme.colorScheme.secondary,
),
),
),
@@ -142,9 +141,7 @@ class _MemberVideoState extends State<MemberVideo>
icon: Icon(
Icons.sort,
size: 16,
color: Theme.of(context)
.colorScheme
.secondary,
color: theme.colorScheme.secondary,
),
label: Obx(
() => Text(
@@ -158,9 +155,7 @@ class _MemberVideoState extends State<MemberVideo>
: '倒序',
style: TextStyle(
fontSize: 13,
color: Theme.of(context)
.colorScheme
.secondary,
color: theme.colorScheme.secondary,
),
),
),

View File

@@ -40,6 +40,7 @@ class _MemberContributeState extends State<MemberContribute>
@override
Widget build(BuildContext context) {
super.build(context);
final theme = Theme.of(context);
return _controller.tabs != null
? Column(
children: [
@@ -58,7 +59,7 @@ class _MemberContributeState extends State<MemberContribute>
indicatorPadding:
const EdgeInsets.symmetric(horizontal: 3, vertical: 8),
indicator: BoxDecoration(
color: Theme.of(context).colorScheme.secondaryContainer,
color: theme.colorScheme.secondaryContainer,
borderRadius: BorderRadius.circular(20),
),
indicatorSize: TabBarIndicatorSize.tab,
@@ -66,9 +67,8 @@ class _MemberContributeState extends State<MemberContribute>
.labelStyle
?.copyWith(fontSize: 14) ??
const TextStyle(fontSize: 14),
labelColor:
Theme.of(context).colorScheme.onSecondaryContainer,
unselectedLabelColor: Theme.of(context).colorScheme.outline,
labelColor: theme.colorScheme.onSecondaryContainer,
unselectedLabelColor: theme.colorScheme.outline,
),
),
Expanded(

View File

@@ -245,100 +245,94 @@ class _MemberHomeState extends State<MemberHome>
required String param,
String? param1,
required int count,
}) =>
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text.rich(
}) {
final color = Theme.of(context).colorScheme.outline;
return SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(text: '$title '),
TextSpan(
text: count.toString(),
style: TextStyle(fontSize: 13, color: color),
),
],
),
),
GestureDetector(
onTap: () {
int index =
_ctr.tab2!.indexWhere((item) => item.param == param);
if (index != -1) {
if (['video', 'article', 'audio'].contains(param1)) {
List<Item> items = _ctr.tab2!
.firstWhere((item) => item.param == param)
.items!;
int index1 =
items.indexWhere((item) => item.param == param1);
try {
final contributeCtr =
Get.find<MemberContributeCtr>(tag: widget.heroTag);
// contributeCtr.tabController?.animateTo(index1);
if (contributeCtr.tabController?.index != index1) {
contributeCtr.tabController?.index = index1;
}
debugPrint('initialized');
} catch (e) {
_ctr.contributeInitialIndex.value = index1;
debugPrint('not initialized');
}
}
_ctr.tabController?.animateTo(index);
} else {
if (param == 'coinArchive') {
Get.to(MemberCoinPage(
mid: _ctr.mid,
name: _ctr.username,
));
return;
}
if (param == 'likeArchive') {
Get.to(MemberLikePage(
mid: _ctr.mid,
name: _ctr.username,
));
return;
}
// else TODO
SmartDialog.showToast('view $param');
}
},
child: Text.rich(
TextSpan(
children: [
TextSpan(text: '$title '),
TextSpan(
text: count.toString(),
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.outline,
text: '查看更多',
style: TextStyle(color: color),
),
WidgetSpan(
alignment: PlaceholderAlignment.top,
child: Icon(
Icons.arrow_forward_ios,
size: 14,
color: color,
),
style: TextStyle(fontSize: 13, color: color),
),
],
),
),
GestureDetector(
onTap: () {
int index =
_ctr.tab2!.indexWhere((item) => item.param == param);
if (index != -1) {
if (['video', 'article', 'audio'].contains(param1)) {
List<Item> items = _ctr.tab2!
.firstWhere((item) => item.param == param)
.items!;
int index1 =
items.indexWhere((item) => item.param == param1);
try {
final contributeCtr =
Get.find<MemberContributeCtr>(tag: widget.heroTag);
// contributeCtr.tabController?.animateTo(index1);
if (contributeCtr.tabController?.index != index1) {
contributeCtr.tabController?.index = index1;
}
debugPrint('initialized');
} catch (e) {
_ctr.contributeInitialIndex.value = index1;
debugPrint('not initialized');
}
}
_ctr.tabController?.animateTo(index);
} else {
if (param == 'coinArchive') {
Get.to(MemberCoinPage(
mid: _ctr.mid,
name: _ctr.username,
));
return;
}
if (param == 'likeArchive') {
Get.to(MemberLikePage(
mid: _ctr.mid,
name: _ctr.username,
));
return;
}
// else TODO
SmartDialog.showToast('view $param');
}
},
child: Text.rich(
TextSpan(
children: [
TextSpan(
text: '查看更多',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
),
WidgetSpan(
alignment: PlaceholderAlignment.top,
child: Icon(
Icons.arrow_forward_ios,
size: 14,
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.outline,
),
),
],
),
),
),
],
),
),
],
),
);
),
);
}
}

View File

@@ -28,7 +28,6 @@ class MemberFavItem extends StatelessWidget {
},
onLongPress: () {
imageSaveDialog(
context: context,
title: item['title'],
cover: item['cover'],
);

View File

@@ -60,6 +60,7 @@ class _MemberPageNewState extends State<MemberPageNew> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
@@ -149,13 +150,12 @@ class _MemberPageNewState extends State<MemberPageNew> {
Icon(
Icons.error_outline,
size: 19,
color: Theme.of(context).colorScheme.error,
color: theme.colorScheme.error,
),
const SizedBox(width: 10),
Text(
'举报',
style: TextStyle(
color: Theme.of(context).colorScheme.error),
style: TextStyle(color: theme.colorScheme.error),
),
],
),
@@ -192,7 +192,7 @@ class _MemberPageNewState extends State<MemberPageNew> {
child: Column(
children: [
if ((_userController.tab2?.length ?? 0) > 1)
_buildTab,
_buildTab(theme),
Expanded(child: _buildBody),
],
),
@@ -208,8 +208,8 @@ class _MemberPageNewState extends State<MemberPageNew> {
);
}
Widget get _buildTab => Material(
color: Theme.of(context).colorScheme.surface,
Widget _buildTab(ThemeData theme) => Material(
color: theme.colorScheme.surface,
child: TabBar(
controller: _userController.tabController,
tabs: _userController.tabs,
@@ -316,6 +316,7 @@ class _ReportPanelState extends State<ReportPanel> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -364,8 +365,7 @@ class _ReportPanelState extends State<ReportPanel> {
onPressed: Get.back,
child: Text(
'取消',
style:
TextStyle(color: Theme.of(context).colorScheme.outline),
style: TextStyle(color: theme.colorScheme.outline),
),
),
TextButton(

View File

@@ -47,9 +47,10 @@ class _EditProfilePageState extends State<EditProfilePage> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(title: const Text('账号资料')),
body: _buildBody(_loadingState),
body: _buildBody(theme, _loadingState),
);
}
@@ -77,23 +78,24 @@ class _EditProfilePageState extends State<EditProfilePage> {
});
}
Widget get _divider => Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
);
Widget _buildBody(ThemeData theme, LoadingState loadingState) {
late final divider = Divider(
height: 1,
color: theme.dividerColor.withOpacity(0.1),
);
Widget get _divider1 => Divider(
thickness: 16,
color: Theme.of(context).dividerColor.withOpacity(0.1),
);
late final divider1 = Divider(
thickness: 16,
color: theme.dividerColor.withOpacity(0.1),
);
Widget _buildBody(LoadingState loadingState) {
return switch (loadingState) {
Loading() => loadingWidget,
Success() => SingleChildScrollView(
child: Column(
children: [
_item(
theme: theme,
title: '头像',
widget: Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
@@ -108,12 +110,13 @@ class _EditProfilePageState extends State<EditProfilePage> {
EasyThrottle.throttle(
'imagePicker', const Duration(milliseconds: 500),
() async {
_pickImg();
_pickImg(theme);
});
},
),
_divider,
divider,
_item(
theme: theme,
title: '昵称',
text: loadingState.response['name'],
onTap: () {
@@ -128,8 +131,9 @@ class _EditProfilePageState extends State<EditProfilePage> {
}
},
),
_divider,
divider,
_item(
theme: theme,
title: '性别',
text: _sex(loadingState.response['sex']),
onTap: () {
@@ -140,8 +144,9 @@ class _EditProfilePageState extends State<EditProfilePage> {
);
},
),
_divider,
divider,
_item(
theme: theme,
title: '出生年月',
text: loadingState.response['birthday'],
onTap: () {
@@ -161,8 +166,9 @@ class _EditProfilePageState extends State<EditProfilePage> {
});
},
),
_divider,
divider,
_item(
theme: theme,
title: '个性签名',
text: loadingState.response['sign'].isEmpty
? ''
@@ -175,27 +181,30 @@ class _EditProfilePageState extends State<EditProfilePage> {
);
},
),
_divider1,
divider1,
_item(
theme: theme,
title: '头像挂件',
onTap: () => PageUtils.launchURL(
'https://www.bilibili.com/h5/mall/pendant/home'),
),
_divider1,
divider1,
_item(
theme: theme,
title: 'UID',
needIcon: false,
text: loadingState.response['mid'].toString(),
onTap: () =>
Utils.copyText(loadingState.response['mid'].toString()),
),
_divider1,
divider1,
_item(
theme: theme,
title: '哔哩哔哩认证',
onTap: () => PageUtils.launchURL(
'https://account.bilibili.com/official/mobile/home'),
),
_divider,
divider,
SizedBox(height: 25 + MediaQuery.paddingOf(context).bottom),
],
),
@@ -254,6 +263,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
showDialog(
context: context,
builder: (BuildContext context) {
final theme = Theme.of(context);
return AlertDialog(
title: Text('修改$title'),
content: TextField(
@@ -272,7 +282,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
hintText: text,
hintStyle: TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
),
@@ -281,7 +291,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
style: TextStyle(color: theme.colorScheme.outline),
),
),
TextButton(
@@ -372,6 +382,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
}
Widget _item({
required ThemeData theme,
required String title,
Widget? widget,
String? text,
@@ -399,7 +410,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
)
else if (widget != null)
@@ -407,14 +418,14 @@ class _EditProfilePageState extends State<EditProfilePage> {
if (needIcon)
Icon(
Icons.keyboard_arrow_right,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
)
],
),
);
}
void _pickImg() async {
void _pickImg(ThemeData theme) async {
try {
XFile? pickedFile = await _imagePicker.pickImage(
source: ImageSource.gallery,
@@ -432,9 +443,8 @@ class _EditProfilePageState extends State<EditProfilePage> {
uiSettings: [
AndroidUiSettings(
toolbarTitle: '裁剪',
toolbarColor: Theme.of(context).colorScheme.secondaryContainer,
toolbarWidgetColor:
Theme.of(context).colorScheme.onSecondaryContainer,
toolbarColor: theme.colorScheme.secondaryContainer,
toolbarWidgetColor: theme.colorScheme.onSecondaryContainer,
aspectRatioPresets: [
CropAspectRatioPresetCustom(),
],

View File

@@ -38,10 +38,12 @@ class UserInfoCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return isV ? _buildV(context) : _buildH(context);
final theme = Theme.of(context);
return isV ? _buildV(context, theme) : _buildH(context, theme);
}
Widget _countWidget({
required ThemeData theme,
required String title,
required int count,
required VoidCallback onTap,
@@ -62,7 +64,7 @@ class UserInfoCard extends StatelessWidget {
style: TextStyle(
height: 1,
fontSize: 11,
color: Theme.of(Get.context!).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
],
@@ -70,8 +72,8 @@ class UserInfoCard extends StatelessWidget {
);
}
_buildHeader(BuildContext context) {
bool darken = Theme.of(context).brightness == Brightness.dark;
_buildHeader(BuildContext context, ThemeData theme) {
bool darken = theme.brightness == Brightness.dark;
String imgUrl = (darken
? images.nightImgurl?.isEmpty == true
? images.imgUrl
@@ -107,7 +109,7 @@ class UserInfoCard extends StatelessWidget {
);
}
_buildLeft(BuildContext context) => [
_buildLeft(BuildContext context, ThemeData theme) => [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Wrap(
@@ -181,7 +183,7 @@ class UserInfoCard extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(12)),
color: Theme.of(context).colorScheme.onInverseSurface,
color: theme.colorScheme.onInverseSurface,
),
child: Text.rich(
TextSpan(
@@ -192,7 +194,7 @@ class UserInfoCard extends StatelessWidget {
child: DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surface,
color: theme.colorScheme.surface,
),
child: Icon(
Icons.offline_bolt,
@@ -212,10 +214,7 @@ class UserInfoCard extends StatelessWidget {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.7),
color: theme.colorScheme.onSurface.withOpacity(0.7),
),
)
],
@@ -245,7 +244,7 @@ class UserInfoCard extends StatelessWidget {
'UID: ${card.mid}',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
),
@@ -255,7 +254,7 @@ class UserInfoCard extends StatelessWidget {
item.title ?? '',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
),
@@ -264,14 +263,14 @@ class UserInfoCard extends StatelessWidget {
),
if (silence == 1)
Builder(builder: (context) {
bool isLight = Theme.of(context).brightness == Brightness.light;
bool isLight = theme.brightness == Brightness.light;
return Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: isLight
? Theme.of(context).colorScheme.errorContainer
: Theme.of(context).colorScheme.error,
? theme.colorScheme.errorContainer
: theme.colorScheme.error,
),
margin: const EdgeInsets.only(left: 20, top: 8, right: 20),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
@@ -284,16 +283,16 @@ class UserInfoCard extends StatelessWidget {
Icons.info,
size: 17,
color: isLight
? Theme.of(context).colorScheme.onErrorContainer
: Theme.of(context).colorScheme.onError,
? theme.colorScheme.onErrorContainer
: theme.colorScheme.onError,
),
),
TextSpan(
text: ' 该账号封禁中${endTime ?? ''}',
style: TextStyle(
color: isLight
? Theme.of(context).colorScheme.onErrorContainer
: Theme.of(context).colorScheme.onError,
? theme.colorScheme.onErrorContainer
: theme.colorScheme.onError,
),
),
],
@@ -303,7 +302,7 @@ class UserInfoCard extends StatelessWidget {
}),
];
_buildRight(BuildContext context) => Column(
_buildRight(BuildContext context, ThemeData theme) => Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
@@ -312,6 +311,7 @@ class UserInfoCard extends StatelessWidget {
5,
(index) => index % 2 == 0
? _countWidget(
theme: theme,
title: ['粉丝', '关注', '获赞'][index ~/ 2],
count: index == 0
? card.fans
@@ -358,10 +358,7 @@ class UserInfoCard extends StatelessWidget {
style: IconButton.styleFrom(
side: BorderSide(
width: 1.0,
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.5),
color: theme.colorScheme.outline.withOpacity(0.5),
),
padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -378,7 +375,7 @@ class UserInfoCard extends StatelessWidget {
onPressed: onFollow,
style: FilledButton.styleFrom(
backgroundColor: relation != 0
? Theme.of(context).colorScheme.onInverseSurface
? theme.colorScheme.onInverseSurface
: null,
visualDensity: const VisualDensity(
horizontal: -2,
@@ -387,9 +384,7 @@ class UserInfoCard extends StatelessWidget {
),
child: Text.rich(
style: TextStyle(
color: relation != 0
? Theme.of(context).colorScheme.outline
: null,
color: relation != 0 ? theme.colorScheme.outline : null,
),
TextSpan(
children: [
@@ -399,7 +394,7 @@ class UserInfoCard extends StatelessWidget {
child: Icon(
Icons.sort,
size: 16,
color: Theme.of(context).colorScheme.outline,
color: theme.colorScheme.outline,
),
),
TextSpan(
@@ -440,7 +435,7 @@ class UserInfoCard extends StatelessWidget {
.imageView(imgList: [SourceModel(url: card.face.http2https)]),
));
_buildV(BuildContext context) => Column(
_buildV(BuildContext context, ThemeData theme) => Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -450,7 +445,7 @@ class UserInfoCard extends StatelessWidget {
Column(
mainAxisSize: MainAxisSize.min,
children: [
_buildHeader(context),
_buildHeader(context, theme),
const SizedBox(width: double.infinity, height: 85)
],
),
@@ -468,21 +463,21 @@ class UserInfoCard extends StatelessWidget {
builder: (_, constraints) => FittedBox(
child: SizedBox(
width: constraints.maxWidth,
child: _buildRight(context),
child: _buildRight(context, theme),
),
),
),
),
],
),
..._buildLeft(context),
if (card.prInfo?.content?.isNotEmpty == true) buildPrInfo,
..._buildLeft(context, theme),
if (card.prInfo?.content?.isNotEmpty == true) buildPrInfo(theme),
const SizedBox(height: 5),
],
);
Widget get buildPrInfo => Builder(builder: (context) {
final isDark = Theme.of(context).brightness == Brightness.dark;
Widget buildPrInfo(ThemeData theme) => Builder(builder: (context) {
final isDark = theme.brightness == Brightness.dark;
final textColor = isDark
? Color(int.parse('FF${card.prInfo?.textColorNight?.substring(1)}',
radix: 16))
@@ -537,7 +532,7 @@ class UserInfoCard extends StatelessWidget {
);
});
_buildH(BuildContext context) => Column(
_buildH(BuildContext context, ThemeData theme) => Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -565,16 +560,16 @@ class UserInfoCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 10),
..._buildLeft(context),
..._buildLeft(context, theme),
const SizedBox(height: 5),
],
),
),
Expanded(child: _buildRight(context)),
Expanded(child: _buildRight(context, theme)),
],
),
),
if (card.prInfo?.content?.isNotEmpty == true) buildPrInfo,
if (card.prInfo?.content?.isNotEmpty == true) buildPrInfo(theme),
],
);
}