Merge branch 'krille/fix-image-viewer' into 'master'

Fix imageviewer

See merge request ChristianPauly/fluffychat-flutter!67
This commit is contained in:
Christian Pauly 2020-05-20 17:29:26 +00:00
commit b6fcc32041
3 changed files with 24 additions and 8 deletions

View file

@ -1,9 +1,11 @@
# Version 0.14.0 - 2020-??-?? # Version 0.14.0 - 2020-05-20
### Features: ### Features:
- Implement image viewer - Implement image viewer
- Implement room pills - Implement room pills
- New chat appBar showing presences and room avatars - New chat appBar showing presences and room avatars
- Implement well-known support - Implement well-known support
### Fixes:
- Minor fixes, refactoring and performance improvements
# Version 0.13.2 - 2020-05-13 # Version 0.13.2 - 2020-05-13
### Fixes: ### Fixes:

View file

@ -8,11 +8,17 @@ class ImageBubble extends StatefulWidget {
final Event event; final Event event;
final bool tapToView; final bool tapToView;
final BoxFit fit; final BoxFit fit;
final bool maxSize;
final Color backgroundColor;
final double radius;
const ImageBubble( const ImageBubble(
this.event, { this.event, {
this.tapToView = true, this.tapToView = true,
this.maxSize = true,
this.backgroundColor,
this.fit = BoxFit.cover, this.fit = BoxFit.cover,
this.radius = 10.0,
Key key, Key key,
}) : super(key: key); }) : super(key: key);
@ -39,12 +45,12 @@ class _ImageBubbleState extends State<ImageBubble> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Bubble( return Bubble(
padding: BubbleEdges.all(0), padding: BubbleEdges.all(0),
radius: Radius.circular(10), radius: Radius.circular(widget.radius),
color: Theme.of(context).secondaryHeaderColor, color: widget.backgroundColor ?? Theme.of(context).secondaryHeaderColor,
elevation: 0, elevation: 0,
child: Container( child: Container(
height: 300, height: widget.maxSize ? 300 : null,
width: 400, width: widget.maxSize ? 400 : null,
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
if (_error != null) { if (_error != null) {

View file

@ -19,13 +19,15 @@ class ImageView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: Colors.black,
extendBodyBehindAppBar: true,
appBar: AppBar( appBar: AppBar(
elevation: 0,
leading: IconButton( leading: IconButton(
icon: Icon(Icons.close), icon: Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
color: Colors.white, color: Colors.white,
), ),
backgroundColor: Colors.black, backgroundColor: Color(0x44000000),
actions: [ actions: [
IconButton( IconButton(
icon: Icon(Icons.reply), icon: Icon(Icons.reply),
@ -42,8 +44,14 @@ class ImageView extends StatelessWidget {
body: ZoomableWidget( body: ZoomableWidget(
minScale: 1.0, minScale: 1.0,
maxScale: 10.0, maxScale: 10.0,
panLimit: 0.0, child: ImageBubble(
child: ImageBubble(event, tapToView: false, fit: BoxFit.contain), event,
tapToView: false,
fit: BoxFit.contain,
backgroundColor: Colors.black,
maxSize: false,
radius: 0.0,
),
), ),
); );
} }