mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-21 08:38:37 +00:00
opt: http2https
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPalaX/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPalaX/models/dynamics/article_content_model.dart';
|
||||
import 'package:PiliPalaX/pages/preview/view.dart';
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
@@ -55,7 +56,7 @@ class ArticleContent extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: item.line?.pic?.url ?? '',
|
||||
imageUrl: item.line?.pic?.url?.http2https ?? '',
|
||||
height: item.line?.pic?.height?.toDouble(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -68,7 +68,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
: StyleString.imgRadius.x,
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
imageUrl: imageUrl.http2https,
|
||||
width: width,
|
||||
height:
|
||||
ignoreHeight == null || ignoreHeight == false ? height : null,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -35,15 +36,18 @@ class _ImagePreviewState extends State<ImagePreview>
|
||||
late DoubleClickAnimationListener _doubleClickAnimationListener;
|
||||
List<double> doubleTapScales = <double>[1.0, 2.0];
|
||||
bool _dismissDisabled = false;
|
||||
List<String>? imgList;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
imgList = widget.imgList?.map((url) => url.http2https).toList();
|
||||
|
||||
_previewController.initialPage.value = widget.initialPage!;
|
||||
_previewController.currentPage.value = widget.initialPage! + 1;
|
||||
_previewController.imgList.value = widget.imgList!;
|
||||
_previewController.currentImgUrl = widget.imgList![widget.initialPage!];
|
||||
_previewController.imgList.value = imgList!;
|
||||
_previewController.currentImgUrl = imgList![widget.initialPage!];
|
||||
// animationController = AnimationController(
|
||||
// vsync: this, duration: const Duration(milliseconds: 400));
|
||||
setStatusBar();
|
||||
@@ -149,10 +153,10 @@ class _ImagePreviewState extends State<ImagePreview>
|
||||
canScrollPage: (GestureDetails? gestureDetails) =>
|
||||
gestureDetails?.totalScale == null ||
|
||||
gestureDetails!.totalScale! <= 1.0,
|
||||
itemCount: widget.imgList!.length,
|
||||
itemCount: imgList!.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ExtendedImage.network(
|
||||
widget.imgList![index],
|
||||
imgList![index],
|
||||
fit: BoxFit.contain,
|
||||
mode: ExtendedImageMode.gesture,
|
||||
handleLoadingProgress: true,
|
||||
@@ -262,7 +266,7 @@ class _ImagePreviewState extends State<ImagePreview>
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
widget.imgList!.length > 1
|
||||
imgList!.length > 1
|
||||
? Obx(
|
||||
() => Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
@@ -274,9 +278,7 @@ class _ImagePreviewState extends State<ImagePreview>
|
||||
text: _previewController.currentPage
|
||||
.toString()),
|
||||
const TextSpan(text: ' / '),
|
||||
TextSpan(
|
||||
text:
|
||||
widget.imgList!.length.toString()),
|
||||
TextSpan(text: imgList!.length.toString()),
|
||||
]),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ignore: file_names
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -50,7 +51,9 @@ class HotKeyword extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 15,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: i.icon!, height: 15.0),
|
||||
imageUrl: (i.icon as String).http2https,
|
||||
height: 15.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -41,3 +41,7 @@ extension ListExt<T> on List<T>? {
|
||||
|
||||
bool ne(List<T>? other) => !eq(other);
|
||||
}
|
||||
|
||||
extension StringExt on String {
|
||||
String get http2https => replaceFirst(RegExp("^http://"), "https://");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user