Merge branch 'ipreview' of git.openprivacy.ca:cwtch.im/cwtch-ui into ipreview

This commit is contained in:
erinn 2021-12-16 17:04:35 -08:00
commit 9cb6eb857d
3 changed files with 22 additions and 26 deletions

View File

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

View File

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

View File

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