mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Create widget for fullscreen image
This commit is contained in:
parent
4b0b41a902
commit
bb62a3a159
29
lib/ui/routes/full_screen_image.dart
Normal file
29
lib/ui/routes/full_screen_image.dart
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:photo_view/photo_view.dart';
|
||||||
|
|
||||||
|
/// Full screen image details
|
||||||
|
///
|
||||||
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
|
class FullScreenImageRoute extends StatefulWidget {
|
||||||
|
final String url;
|
||||||
|
|
||||||
|
FullScreenImageRoute(this.url) : assert(url != null);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_FullScreenImageRouteState createState() => _FullScreenImageRouteState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FullScreenImageRouteState extends State<FullScreenImageRoute> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(tr("Image")),
|
||||||
|
),
|
||||||
|
body: PhotoView(imageProvider: CachedNetworkImageProvider(widget.url)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,8 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:comunic/helpers/preferences_helper.dart';
|
import 'package:comunic/helpers/preferences_helper.dart';
|
||||||
|
import 'package:comunic/ui/routes/full_screen_image.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
|
||||||
|
|
||||||
/// User interface utilities
|
/// User interface utilities
|
||||||
///
|
///
|
||||||
@ -69,14 +68,7 @@ Widget buildErrorCard(String message,
|
|||||||
/// Show an image with a given [url] in full screen
|
/// Show an image with a given [url] in full screen
|
||||||
void showImageFullScreen(BuildContext context, String url) {
|
void showImageFullScreen(BuildContext context, String url) {
|
||||||
Navigator.of(context).push(MaterialPageRoute(builder: (c) {
|
Navigator.of(context).push(MaterialPageRoute(builder: (c) {
|
||||||
return Scaffold(
|
return FullScreenImageRoute(url);
|
||||||
appBar: AppBar(
|
|
||||||
title: Text(tr("Image")),
|
|
||||||
),
|
|
||||||
body: PhotoView(
|
|
||||||
imageProvider: CachedNetworkImageProvider(url),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user