mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-03 08:39:46 +08:00
@@ -15,6 +15,7 @@ import 'package:PiliPlus/pages/follow_type/followed/view.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
@@ -49,12 +50,13 @@ class UserInfoCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isLight = colorScheme.isLight;
|
||||
final isPortrait = context.width < 600;
|
||||
final width = context.width;
|
||||
final isPortrait = width < 600;
|
||||
return ViewSafeArea(
|
||||
top: !isPortrait,
|
||||
child: isPortrait
|
||||
? _buildV(context, colorScheme, isLight)
|
||||
: _buildH(colorScheme, isLight),
|
||||
? _buildV(context, colorScheme, isLight, width)
|
||||
: _buildH(context, colorScheme, isLight),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -107,7 +109,12 @@ class UserInfoCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader(ColorScheme colorScheme, bool isLight) {
|
||||
Widget _buildHeader(
|
||||
BuildContext context,
|
||||
ColorScheme colorScheme,
|
||||
bool isLight,
|
||||
double width,
|
||||
) {
|
||||
String imgUrl =
|
||||
(isLight
|
||||
? images.imgUrl
|
||||
@@ -120,21 +127,14 @@ class UserInfoCard extends StatelessWidget {
|
||||
child: Hero(
|
||||
tag: imgUrl,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: ImageUtils.thumbnailUrl(imgUrl),
|
||||
width: double.infinity,
|
||||
fit: .cover,
|
||||
height: 135,
|
||||
imageBuilder: (context, imageProvider) => DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: imageProvider,
|
||||
fit: BoxFit.cover,
|
||||
colorFilter: ColorFilter.mode(
|
||||
isLight ? const Color(0x5DFFFFFF) : const Color(0x8D000000),
|
||||
isLight ? BlendMode.lighten : BlendMode.darken,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
width: width,
|
||||
memCacheWidth: width.cacheSize(context),
|
||||
imageUrl: ImageUtils.thumbnailUrl(imgUrl),
|
||||
placeholder: (_, _) => const SizedBox.shrink(),
|
||||
color: isLight ? const Color(0x5DFFFFFF) : const Color(0x8D000000),
|
||||
colorBlendMode: isLight ? BlendMode.lighten : BlendMode.darken,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -461,47 +461,52 @@ class UserInfoCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
|
||||
Column _buildV(BuildContext context, ColorScheme colorScheme, bool isLight) =>
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
Column _buildV(
|
||||
BuildContext context,
|
||||
ColorScheme colorScheme,
|
||||
bool isLight,
|
||||
double width,
|
||||
) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
Column(
|
||||
crossAxisAlignment: .stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildHeader(colorScheme, isLight),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.textScalerOf(context).scale(30) + 60,
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 110,
|
||||
left: 20,
|
||||
child: _buildAvatar,
|
||||
),
|
||||
Positioned(
|
||||
left: 160,
|
||||
top: 140,
|
||||
right: 15,
|
||||
bottom: 0,
|
||||
child: _buildRight(colorScheme),
|
||||
_buildHeader(context, colorScheme, isLight, width),
|
||||
SizedBox(
|
||||
height: MediaQuery.textScalerOf(context).scale(30) + 60,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
..._buildLeft(colorScheme, isLight),
|
||||
if (card.prInfo?.content?.isNotEmpty == true)
|
||||
buildPrInfo(colorScheme, isLight, card.prInfo!),
|
||||
const SizedBox(height: 5),
|
||||
Positioned(
|
||||
top: 110,
|
||||
left: 20,
|
||||
child: _buildAvatar,
|
||||
),
|
||||
Positioned(
|
||||
left: 160,
|
||||
top: 140,
|
||||
right: 15,
|
||||
bottom: 0,
|
||||
child: _buildRight(colorScheme),
|
||||
),
|
||||
],
|
||||
);
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
..._buildLeft(colorScheme, isLight),
|
||||
if (card.prInfo?.content?.isNotEmpty == true)
|
||||
buildPrInfo(context, colorScheme, isLight, card.prInfo!),
|
||||
const SizedBox(height: 5),
|
||||
],
|
||||
);
|
||||
|
||||
Widget buildPrInfo(
|
||||
BuildContext context,
|
||||
ColorScheme colorScheme,
|
||||
bool isLight,
|
||||
SpacePrInfo prInfo,
|
||||
@@ -509,22 +514,24 @@ class UserInfoCard extends StatelessWidget {
|
||||
final textColor = Utils.parseColor(
|
||||
isLight ? prInfo.textColor : prInfo.textColorNight,
|
||||
);
|
||||
String? icon = !isLight && prInfo.iconNight?.isNotEmpty == true
|
||||
? prInfo.iconNight
|
||||
: prInfo.icon?.isNotEmpty == true
|
||||
? prInfo.icon
|
||||
: null;
|
||||
|
||||
Widget child = Container(
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
color: Utils.parseColor(isLight ? prInfo.bgColor : prInfo.bgColorNight),
|
||||
child: Row(
|
||||
children: [
|
||||
if (!isLight && prInfo.iconNight?.isNotEmpty == true) ...[
|
||||
if (icon != null) ...[
|
||||
CachedNetworkImage(
|
||||
imageUrl: ImageUtils.thumbnailUrl(card.prInfo!.iconNight!),
|
||||
height: 20,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
] else if (prInfo.icon?.isNotEmpty == true) ...[
|
||||
CachedNetworkImage(
|
||||
imageUrl: ImageUtils.thumbnailUrl(card.prInfo!.icon!),
|
||||
height: 20,
|
||||
memCacheHeight: 20.cacheSize(context),
|
||||
imageUrl: ImageUtils.thumbnailUrl(icon),
|
||||
placeholder: (_, _) => const SizedBox.shrink(),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
@@ -553,46 +560,47 @@ class UserInfoCard extends StatelessWidget {
|
||||
return child;
|
||||
}
|
||||
|
||||
Column _buildH(ColorScheme colorScheme, bool isLight) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// _buildHeader(context),
|
||||
const SizedBox(height: 56),
|
||||
Row(
|
||||
Column _buildH(BuildContext context, ColorScheme colorScheme, bool isLight) =>
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(width: 20),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: card.prInfo?.content?.isNotEmpty == true ? 0 : 10,
|
||||
),
|
||||
child: _buildAvatar,
|
||||
// _buildHeader(context),
|
||||
const SizedBox(height: 56),
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(width: 20),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: card.prInfo?.content?.isNotEmpty == true ? 0 : 10,
|
||||
),
|
||||
child: _buildAvatar,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
..._buildLeft(colorScheme, isLight),
|
||||
const SizedBox(height: 5),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: _buildRight(colorScheme),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
..._buildLeft(colorScheme, isLight),
|
||||
const SizedBox(height: 5),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: _buildRight(colorScheme),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
if (card.prInfo?.content?.isNotEmpty == true)
|
||||
buildPrInfo(context, colorScheme, isLight, card.prInfo!),
|
||||
],
|
||||
),
|
||||
if (card.prInfo?.content?.isNotEmpty == true)
|
||||
buildPrInfo(colorScheme, isLight, card.prInfo!),
|
||||
],
|
||||
);
|
||||
);
|
||||
|
||||
Widget _buildFollowedUp(
|
||||
ColorScheme colorScheme,
|
||||
|
||||
Reference in New Issue
Block a user