mod: 封面图比例
This commit is contained in:
@ -4,5 +4,5 @@ class StyleString {
|
||||
static const double cardSpace = 8;
|
||||
static BorderRadius mdRadius = BorderRadius.circular(6);
|
||||
static const Radius imgRadius = Radius.circular(6);
|
||||
static const double aspectRatio = 16 / 9;
|
||||
static const double aspectRatio = 16 / 10;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double pr = MediaQuery.of(context).devicePixelRatio;
|
||||
// double pr = 2;
|
||||
return src != ''
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(type == 'avatar' ? 50 : 4),
|
||||
@ -32,20 +34,16 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
imageUrl: src!,
|
||||
width: width ?? double.infinity,
|
||||
height: height ?? double.infinity,
|
||||
maxWidthDiskCache:
|
||||
((cacheW ?? width!) * MediaQuery.of(context).devicePixelRatio)
|
||||
.toInt(),
|
||||
maxWidthDiskCache: ((cacheW ?? width!) * pr).toInt(),
|
||||
// maxHeightDiskCache: (cacheH ?? height!).toInt(),
|
||||
memCacheWidth:
|
||||
((cacheW ?? width!) * MediaQuery.of(context).devicePixelRatio)
|
||||
.toInt(),
|
||||
memCacheWidth: ((cacheW ?? width!) * pr).toInt(),
|
||||
// memCacheHeight: (cacheH ?? height!).toInt(),
|
||||
fit: BoxFit.fitWidth,
|
||||
fit: BoxFit.cover,
|
||||
fadeOutDuration:
|
||||
fadeOutDuration ?? const Duration(milliseconds: 200),
|
||||
fadeInDuration:
|
||||
fadeInDuration ?? const Duration(milliseconds: 200),
|
||||
filterQuality: FilterQuality.high,
|
||||
// filterQuality: FilterQuality.high,
|
||||
errorWidget: (context, url, error) => placeholder(context),
|
||||
placeholder: (context, url) => placeholder(context),
|
||||
),
|
||||
|
@ -26,7 +26,7 @@ class VideoCardH extends StatelessWidget {
|
||||
StyleString.cardSpace, 5, StyleString.cardSpace, 5),
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
double width =
|
||||
(boxConstraints.maxWidth - StyleString.cardSpace * 3) / 2;
|
||||
(boxConstraints.maxWidth - StyleString.cardSpace * 6) / 2;
|
||||
return SizedBox(
|
||||
height: width / StyleString.aspectRatio,
|
||||
child: Row(
|
||||
|
@ -48,7 +48,7 @@ class VideoCardV extends StatelessWidget {
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
// 指定图片尺寸
|
||||
// src: videoItem['pic'] + '@${(maxWidth * 2).toInt() }w',
|
||||
// src: videoItem.pic + '@${(maxWidth * 2).toInt()}w',
|
||||
src: videoItem.pic + '@.webp',
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
|
@ -18,6 +18,8 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return DynamicColorBuilder(
|
||||
builder: ((lightDynamic, darkDynamic) {
|
||||
// 图片缓存
|
||||
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
||||
return GetMaterialApp(
|
||||
title: 'PiLiPaLa',
|
||||
theme: ThemeData(
|
||||
|
Reference in New Issue
Block a user