From 513035789dbba5394ad04ad1a2b5cda78bae2c84 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 20 Dec 2021 16:34:51 -0500 Subject: [PATCH] add mouse icon over file previews to trigger dialog; add exit button to image preview dialoge; spacing --- lib/widgets/filebubble.dart | 58 ++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/lib/widgets/filebubble.dart b/lib/widgets/filebubble.dart index 6457ae6a..d63b28cd 100644 --- a/lib/widgets/filebubble.dart +++ b/lib/widgets/filebubble.dart @@ -109,25 +109,28 @@ class FileBubbleState extends State { if (Provider.of(context).shouldPreview(path!)) { isPreview = true; wdgDecorations = Center( - child: GestureDetector( - child: Padding( - padding: EdgeInsets.all(1.0), - child: Image.file( - myFile!, - cacheWidth: 2048, // limit the amount of space the image can decode too, we keep this high-ish to allow quality previews... - filterQuality: FilterQuality.medium, - fit: BoxFit.scaleDown, - alignment: Alignment.center, - height: MediaQuery.of(bcontext).size.height * 0.30, - isAntiAlias: false, - errorBuilder: (context, error, stackTrace) { - return MalformedBubble(); - }, - )), - onTap: () { - pop(bcontext, myFile!, wdgMessage); - }, - )); + child: MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + child: Padding( + padding: EdgeInsets.all(1.0), + child: Image.file( + myFile!, + cacheWidth: 2048, + // limit the amount of space the image can decode too, we keep this high-ish to allow quality previews... + filterQuality: FilterQuality.medium, + fit: BoxFit.scaleDown, + alignment: Alignment.center, + height: MediaQuery.of(bcontext).size.height * 0.30, + isAntiAlias: false, + errorBuilder: (context, error, stackTrace) { + return MalformedBubble(); + }, + )), + onTap: () { + pop(bcontext, myFile!, wdgMessage); + }, + ))); } else { wdgDecorations = Visibility(visible: widget.interactive, child: Text(AppLocalizations.of(context)!.fileSavedTo + ': ' + path + '\u202F')); } @@ -146,9 +149,7 @@ class FileBubbleState extends State { // in this case, the download was done in a previous application launch, // so we probably have to request an info lookup if (!downloadInterrupted) { - wdgDecorations = Text( - AppLocalizations.of(context)!.fileCheckingStatus + '...' + - '\u202F'); + wdgDecorations = Text(AppLocalizations.of(context)!.fileCheckingStatus + '...' + '\u202F'); } else { var path = Provider.of(context).downloadFinalPath(widget.fileKey()) ?? ""; wdgDecorations = Visibility( @@ -356,7 +357,15 @@ class FileBubbleState extends State { child: Container( padding: EdgeInsets.all(10), child: Column(children: [ - meta, + ListTile( + title: meta, + trailing: IconButton( + icon: Icon(Icons.close), + color: Provider.of(context, listen: false).theme.toolbarIconColor, + iconSize: 32, + onPressed: () { + Navigator.pop(context, true); + })), Image.file( myFile, cacheWidth: (MediaQuery.of(context).size.width * 0.6).floor(), @@ -364,6 +373,9 @@ class FileBubbleState extends State { height: (MediaQuery.of(context).size.height * 0.6), fit: BoxFit.scaleDown, ), + SizedBox( + height: 20, + ), Visibility(visible: !Platform.isAndroid, child: Text(myFile.path, textAlign: TextAlign.center)), Visibility(visible: Platform.isAndroid, child: IconButton(icon: Icon(Icons.arrow_downward), onPressed: androidExport)), ]),