parent
c086599396
commit
001666f3e3
|
@ -1,4 +1,5 @@
|
|||
import 'package:feet/api/api.dart';
|
||||
import 'package:feet/pages/image_view.dart';
|
||||
import 'package:feet/widgets/homepage_post.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -112,6 +113,18 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||
child: SelectionArea(
|
||||
child: Html(
|
||||
data: widget.article.html,
|
||||
onImageTap: (url, ctx, attributes, element) => Navigator.of(context).push(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, _, __) => ImageView(url: url!),
|
||||
transitionsBuilder: (context, animation, _, child) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
17
lib/pages/image_view.dart
Normal file
17
lib/pages/image_view.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
class ImageView extends StatelessWidget {
|
||||
final String url;
|
||||
const ImageView({super.key, required this.url});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PhotoView(
|
||||
backgroundDecoration: BoxDecoration(color: Theme.of(context).colorScheme.background.withAlpha(200)),
|
||||
maxScale: 5.0,
|
||||
minScale: PhotoViewComputedScale.contained,
|
||||
imageProvider: NetworkImage(url),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -440,6 +440,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
photo_view:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: photo_view
|
||||
sha256: "8036802a00bae2a78fc197af8a158e3e2f7b500561ed23b4c458107685e645bb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.14.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -45,6 +45,7 @@ dependencies:
|
|||
workmanager: ^0.5.1
|
||||
flutter_local_notifications: ^9.1.4
|
||||
permission_handler: ^10.2.0
|
||||
photo_view: ^0.14.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in a new issue