mod: 图片质量
This commit is contained in:
@ -43,7 +43,7 @@ class LiveCard extends StatelessWidget {
|
|||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: liveItem.cover + '@.webp',
|
src: liveItem.cover,
|
||||||
type: 'emote',
|
type: 'emote',
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
|
|||||||
@ -11,6 +11,7 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
final String? type;
|
final String? type;
|
||||||
final Duration? fadeOutDuration;
|
final Duration? fadeOutDuration;
|
||||||
final Duration? fadeInDuration;
|
final Duration? fadeInDuration;
|
||||||
|
final int? quality;
|
||||||
|
|
||||||
const NetworkImgLayer({
|
const NetworkImgLayer({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -22,6 +23,8 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
this.type,
|
this.type,
|
||||||
this.fadeOutDuration,
|
this.fadeOutDuration,
|
||||||
this.fadeInDuration,
|
this.fadeInDuration,
|
||||||
|
// 图片质量 默认1%
|
||||||
|
this.quality = 1,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -37,7 +40,8 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
? 0
|
? 0
|
||||||
: StyleString.imgRadius.x),
|
: StyleString.imgRadius.x),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: src!.startsWith('//') ? 'https:${src!}' : src!,
|
imageUrl:
|
||||||
|
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality}q.webp',
|
||||||
width: width ?? double.infinity,
|
width: width ?? double.infinity,
|
||||||
height: height ?? double.infinity,
|
height: height ?? double.infinity,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class VideoCardH extends StatelessWidget {
|
|||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: videoItem.pic + '@.webp',
|
src: videoItem.pic,
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class VideoCardV extends StatelessWidget {
|
|||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: videoItem.pic + '@.webp',
|
src: videoItem.pic,
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class FavItem extends StatelessWidget {
|
|||||||
return Hero(
|
return Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: favFolderItem.cover + '@.webp',
|
src: favFolderItem.cover,
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class FavVideoCardH extends StatelessWidget {
|
|||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: videoItem.pic + '@.webp',
|
src: videoItem.pic,
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -83,8 +83,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: (videoItem.cover != ''
|
src: (videoItem.cover != ''
|
||||||
? videoItem.cover
|
? videoItem.cover
|
||||||
: videoItem.covers.first) +
|
: videoItem.covers.first),
|
||||||
'@.webp',
|
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class LiveCardV extends StatelessWidget {
|
|||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: '${liveItem.cover!}@.webp',
|
src: liveItem.cover!,
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// ignore_for_file: library_private_types_in_public_api
|
// ignore_for_file: library_private_types_in_public_api
|
||||||
|
|
||||||
import 'package:dismissible_page/dismissible_page.dart';
|
import 'package:dismissible_page/dismissible_page.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:extended_image/extended_image.dart';
|
import 'package:extended_image/extended_image.dart';
|
||||||
@ -44,7 +45,15 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
appBar: AppBar(
|
||||||
|
primary: false,
|
||||||
|
toolbarHeight: 0,
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
systemOverlayStyle: SystemUiOverlayStyle.light,
|
||||||
|
),
|
||||||
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
DismissiblePage(
|
DismissiblePage(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
@ -139,7 +148,8 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 150.0,
|
width: 150.0,
|
||||||
child: LinearProgressIndicator(value: progress),
|
child:
|
||||||
|
LinearProgressIndicator(value: progress),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
Text('${((progress ?? 0.0) * 100).toInt()}%'),
|
Text('${((progress ?? 0.0) * 100).toInt()}%'),
|
||||||
@ -194,8 +204,8 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
color: Colors.white, fontSize: 18),
|
color: Colors.white, fontSize: 18),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text:
|
text: _previewController.currentPage
|
||||||
_previewController.currentPage.toString()),
|
.toString()),
|
||||||
const TextSpan(text: ' / '),
|
const TextSpan(text: ' / '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: _previewController.imgList.length
|
text: _previewController.imgList.length
|
||||||
@ -217,6 +227,7 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Widget searchLivePanel(BuildContext context, ctr, list) {
|
|||||||
Hero(
|
Hero(
|
||||||
tag: Utils.makeHeroTag(i.roomid),
|
tag: Utils.makeHeroTag(i.roomid),
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: i.cover + '@.webp',
|
src: i.cover,
|
||||||
type: 'emote',
|
type: 'emote',
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
|
|||||||
Reference in New Issue
Block a user