Fixup Preview Dialog

This commit is contained in:
Sarah Jamie Lewis 2021-12-16 16:54:53 -08:00
parent 8a8c5fc3e2
commit df3617c5a1
3 changed files with 22 additions and 26 deletions

View File

@ -151,7 +151,10 @@ class CwtchGomobile implements Cwtch {
// ignore: non_constant_identifier_names
void ExportPreviewedFile(String sourceFile, String suggestion) {
cwtchPlatform.invokeMethod("ExportPreviewedFile", {"Path": sourceFile, "FileName": suggestion,});
cwtchPlatform.invokeMethod("ExportPreviewedFile", {
"Path": sourceFile,
"FileName": suggestion,
});
}
@override

View File

@ -250,12 +250,12 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
Visibility(
visible: settings.isExperimentEnabled(ImagePreviewsExperiment) && !Platform.isAndroid,
child: CwtchFolderPicker(
label: AppLocalizations.of(context)!.settingDownloadFolder,
initialValue: settings.downloadPath,
onSave: (newVal) {
settings.downloadPath = newVal;
saveSettings(context);
},
label: AppLocalizations.of(context)!.settingDownloadFolder,
initialValue: settings.downloadPath,
onSave: (newVal) {
settings.downloadPath = newVal;
saveSettings(context);
},
),
),
SwitchListTile(

View File

@ -80,7 +80,7 @@ class FileBubbleState extends State<FileBubble> {
senderDisplayStr = Provider.of<MessageMetadata>(context).senderHandle;
}
}
return LayoutBuilder(builder: (context, constraints) {
return LayoutBuilder(builder: (bcontext, constraints) {
var wdgSender = Center(
widthFactor: 1,
child: SelectableText(senderDisplayStr + '\u202F',
@ -117,7 +117,7 @@ class FileBubbleState extends State<FileBubble> {
},
),
onTap: () {
pop(myFile!, wdgMessage);
pop(bcontext, myFile!, wdgMessage);
},
);
} else {
@ -330,30 +330,23 @@ class FileBubbleState extends State<FileBubble> {
);
}
void pop(File myFile, Widget meta) async {
void pop(context, File myFile, Widget meta) async {
await showDialog(
context: context,
builder: (_) => Dialog(
child: Container(
alignment: Alignment.center,
child: Container(
padding: EdgeInsets.all(10),
width: 500,
height: 550,
child: Column(children: [
meta,
Container(
width: 300,
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
image: Image.file(myFile, cacheHeight: 1024, cacheWidth: 1024).image,
fit: BoxFit.fitWidth,
filterQuality: FilterQuality.none,
)),
),
Visibility(
visible: Platform.isAndroid,
child: IconButton(icon: Icon(Icons.arrow_downward), onPressed: androidExport)
Image.file(
myFile,
cacheHeight: (MediaQuery.of(context).size.height * 0.6).floor(),
cacheWidth: (MediaQuery.of(context).size.width * 0.6).floor(),
fit: BoxFit.scaleDown,
),
Visibility(visible: !Platform.isAndroid, child: Text(myFile.path, textAlign: TextAlign.center)),
Visibility(visible: Platform.isAndroid, child: IconButton(icon: Icon(Icons.arrow_downward), onPressed: androidExport)),
]),
)));
}