From c409345f22f5e755def5c2313a99e76afd2e5a4e Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 20 May 2020 17:29:26 +0000 Subject: [PATCH] Fix imageviewer --- CHANGELOG.md | 4 +++- lib/components/image_bubble.dart | 14 ++++++++++---- lib/views/image_view.dart | 14 +++++++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6c3b0..73b6e02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ -# Version 0.14.0 - 2020-??-?? +# Version 0.14.0 - 2020-05-20 ### Features: - Implement image viewer - Implement room pills - New chat appBar showing presences and room avatars - Implement well-known support +### Fixes: +- Minor fixes, refactoring and performance improvements # Version 0.13.2 - 2020-05-13 ### Fixes: diff --git a/lib/components/image_bubble.dart b/lib/components/image_bubble.dart index b52acff..a7e980d 100644 --- a/lib/components/image_bubble.dart +++ b/lib/components/image_bubble.dart @@ -8,11 +8,17 @@ class ImageBubble extends StatefulWidget { final Event event; final bool tapToView; final BoxFit fit; + final bool maxSize; + final Color backgroundColor; + final double radius; const ImageBubble( this.event, { this.tapToView = true, + this.maxSize = true, + this.backgroundColor, this.fit = BoxFit.cover, + this.radius = 10.0, Key key, }) : super(key: key); @@ -39,12 +45,12 @@ class _ImageBubbleState extends State { Widget build(BuildContext context) { return Bubble( padding: BubbleEdges.all(0), - radius: Radius.circular(10), - color: Theme.of(context).secondaryHeaderColor, + radius: Radius.circular(widget.radius), + color: widget.backgroundColor ?? Theme.of(context).secondaryHeaderColor, elevation: 0, child: Container( - height: 300, - width: 400, + height: widget.maxSize ? 300 : null, + width: widget.maxSize ? 400 : null, child: Builder( builder: (BuildContext context) { if (_error != null) { diff --git a/lib/views/image_view.dart b/lib/views/image_view.dart index f5b90ff..5da00f4 100644 --- a/lib/views/image_view.dart +++ b/lib/views/image_view.dart @@ -19,13 +19,15 @@ class ImageView extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, + extendBodyBehindAppBar: true, appBar: AppBar( + elevation: 0, leading: IconButton( icon: Icon(Icons.close), onPressed: () => Navigator.of(context).pop(), color: Colors.white, ), - backgroundColor: Colors.black, + backgroundColor: Color(0x44000000), actions: [ IconButton( icon: Icon(Icons.reply), @@ -42,8 +44,14 @@ class ImageView extends StatelessWidget { body: ZoomableWidget( minScale: 1.0, maxScale: 10.0, - panLimit: 0.0, - child: ImageBubble(event, tapToView: false, fit: BoxFit.contain), + child: ImageBubble( + event, + tapToView: false, + fit: BoxFit.contain, + backgroundColor: Colors.black, + maxSize: false, + radius: 0.0, + ), ), ); }