mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
opt: show blocked item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -290,174 +290,138 @@ class OpusContent extends StatelessWidget {
|
|||||||
|
|
||||||
Widget moduleBlockedItem(
|
Widget moduleBlockedItem(
|
||||||
ThemeData theme, ModuleBlocked moduleBlocked, double maxWidth) {
|
ThemeData theme, ModuleBlocked moduleBlocked, double maxWidth) {
|
||||||
if (moduleBlocked.blockedType == 1) {
|
BoxDecoration? bgImg() {
|
||||||
maxWidth = min(400, maxWidth * 0.8);
|
return moduleBlocked.bgImg == null
|
||||||
return Stack(
|
? null
|
||||||
clipBehavior: Clip.none,
|
: BoxDecoration(
|
||||||
children: [
|
image: DecorationImage(
|
||||||
if (moduleBlocked.bgImg != null)
|
fit: BoxFit.fill,
|
||||||
CachedNetworkImage(
|
image: CachedNetworkImageProvider(
|
||||||
width: maxWidth,
|
Utils.thumbnailImgUrl(
|
||||||
fit: BoxFit.cover,
|
Get.isDarkMode
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
? moduleBlocked.bgImg!.imgDark
|
||||||
Get.isDarkMode
|
: moduleBlocked.bgImg!.imgDay,
|
||||||
? moduleBlocked.bgImg!.imgDark
|
|
||||||
: moduleBlocked.bgImg!.imgDay,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: maxWidth,
|
|
||||||
height: maxWidth,
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
if (moduleBlocked.icon != null)
|
|
||||||
CachedNetworkImage(
|
|
||||||
width: maxWidth / 7,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
|
||||||
Get.isDarkMode
|
|
||||||
? moduleBlocked.icon!.imgDark
|
|
||||||
: moduleBlocked.icon!.imgDay,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget icon(double width) {
|
||||||
|
return CachedNetworkImage(
|
||||||
|
width: width,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
imageUrl: Utils.thumbnailImgUrl(
|
||||||
|
Get.isDarkMode
|
||||||
|
? moduleBlocked.icon!.imgDark
|
||||||
|
: moduleBlocked.icon!.imgDay,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget btn({
|
||||||
|
OutlinedBorder? shape,
|
||||||
|
VisualDensity? visualDensity,
|
||||||
|
EdgeInsetsGeometry? padding,
|
||||||
|
}) {
|
||||||
|
return FilledButton.tonal(
|
||||||
|
style: FilledButton.styleFrom(
|
||||||
|
padding: padding,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
visualDensity: visualDensity,
|
||||||
|
backgroundColor:
|
||||||
|
Get.isDarkMode ? const Color(0xFF8F0030) : const Color(0xFFFF6699),
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
shape: shape,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (moduleBlocked.button!.jumpUrl != null) {
|
||||||
|
PiliScheme.routePushFromUrl(moduleBlocked.button!.jumpUrl!);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.button!.icon != null)
|
||||||
|
CachedNetworkImage(
|
||||||
|
height: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
imageUrl: moduleBlocked.button!.icon!,
|
||||||
|
),
|
||||||
|
Text(moduleBlocked.button!.text ?? ''),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (moduleBlocked.blockedType == 1) {
|
||||||
|
maxWidth = maxWidth <= 255 ? maxWidth : min(400, maxWidth * 0.8);
|
||||||
|
return Container(
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxWidth,
|
||||||
|
decoration: bgImg(),
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.icon != null) icon(max(40, maxWidth / 7)),
|
||||||
|
if (moduleBlocked.hintMessage != null) ...[
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Text(
|
||||||
|
moduleBlocked.hintMessage!,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (moduleBlocked.button != null) ...[
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
btn(
|
||||||
|
visualDensity: const VisualDensity(vertical: -2.5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
decoration: bgImg(),
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.icon != null) ...[
|
||||||
|
icon(42),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
],
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (moduleBlocked.title != null) Text(moduleBlocked.title!),
|
||||||
if (moduleBlocked.hintMessage != null) ...[
|
if (moduleBlocked.hintMessage != null) ...[
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 2),
|
||||||
Text(
|
Text(
|
||||||
moduleBlocked.hintMessage!,
|
moduleBlocked.hintMessage!,
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
color: theme.colorScheme.outline,
|
color: theme.colorScheme.outline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
if (moduleBlocked.button != null) ...[
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
FilledButton.tonal(
|
|
||||||
style: FilledButton.styleFrom(
|
|
||||||
visualDensity: const VisualDensity(vertical: -2.5),
|
|
||||||
backgroundColor: Get.isDarkMode
|
|
||||||
? const Color(0xFF8F0030)
|
|
||||||
: const Color(0xFFFF6699),
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (moduleBlocked.button!.jumpUrl != null) {
|
|
||||||
PiliScheme.routePushFromUrl(
|
|
||||||
moduleBlocked.button!.jumpUrl!);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
if (moduleBlocked.button!.icon != null)
|
|
||||||
CachedNetworkImage(
|
|
||||||
height: 16,
|
|
||||||
color: Colors.white,
|
|
||||||
imageUrl: moduleBlocked.button!.icon!,
|
|
||||||
),
|
|
||||||
Text(moduleBlocked.button!.text ?? ''),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
if (moduleBlocked.button != null) ...[
|
||||||
);
|
const SizedBox(width: 8),
|
||||||
}
|
btn(
|
||||||
return Stack(
|
visualDensity: const VisualDensity(vertical: -3, horizontal: -4),
|
||||||
clipBehavior: Clip.none,
|
shape: const RoundedRectangleBorder(
|
||||||
alignment: Alignment.center,
|
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||||
children: [
|
|
||||||
if (moduleBlocked.bgImg != null)
|
|
||||||
CachedNetworkImage(
|
|
||||||
width: maxWidth,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
|
||||||
Get.isDarkMode
|
|
||||||
? moduleBlocked.bgImg!.imgDark
|
|
||||||
: moduleBlocked.bgImg!.imgDay,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
if (moduleBlocked.icon != null) ...[
|
|
||||||
CachedNetworkImage(
|
|
||||||
width: 42,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
imageUrl: Utils.thumbnailImgUrl(
|
|
||||||
Get.isDarkMode
|
|
||||||
? moduleBlocked.icon!.imgDark
|
|
||||||
: moduleBlocked.icon!.imgDay,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
],
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
if (moduleBlocked.title != null)
|
|
||||||
Text(
|
|
||||||
moduleBlocked.title!,
|
|
||||||
),
|
|
||||||
if (moduleBlocked.hintMessage != null) ...[
|
|
||||||
const SizedBox(height: 2),
|
|
||||||
Text(
|
|
||||||
moduleBlocked.hintMessage!,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: theme.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (moduleBlocked.button != null) ...[
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
const SizedBox(width: 8),
|
),
|
||||||
FilledButton.tonal(
|
],
|
||||||
style: FilledButton.styleFrom(
|
],
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
),
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
visualDensity:
|
|
||||||
const VisualDensity(vertical: -3, horizontal: -4),
|
|
||||||
backgroundColor: Get.isDarkMode
|
|
||||||
? const Color(0xFF8F0030)
|
|
||||||
: const Color(0xFFFF6699),
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6))),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (moduleBlocked.button!.jumpUrl != null) {
|
|
||||||
PiliScheme.routePushFromUrl(moduleBlocked.button!.jumpUrl!);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
if (moduleBlocked.button!.icon != null)
|
|
||||||
CachedNetworkImage(
|
|
||||||
height: 16,
|
|
||||||
color: Colors.white,
|
|
||||||
imageUrl: moduleBlocked.button!.icon!,
|
|
||||||
),
|
|
||||||
Text(moduleBlocked.button!.text ?? ''),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user