forked from cwtch.im/cwtch-ui
Fix Android Export Image Preview
This commit is contained in:
parent
1a70937898
commit
d5d9bd8530
|
@ -9,6 +9,7 @@ import 'package:cwtch/models/message.dart';
|
||||||
import 'package:cwtch/models/profile.dart';
|
import 'package:cwtch/models/profile.dart';
|
||||||
import 'package:cwtch/widgets/malformedbubble.dart';
|
import 'package:cwtch/widgets/malformedbubble.dart';
|
||||||
import 'package:file_picker_desktop/file_picker_desktop.dart';
|
import 'package:file_picker_desktop/file_picker_desktop.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
@ -172,7 +173,7 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Padding(padding: EdgeInsets.all(1.0), child: getPreview(context)),
|
child: Padding(padding: EdgeInsets.all(1.0), child: getPreview(context)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
pop(bcontext, myFile!, wdgMessage);
|
pop(bcontext, myFile!, widget.nameSuggestion);
|
||||||
},
|
},
|
||||||
)));
|
)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -406,16 +407,19 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop(context, File myFile, Widget meta) async {
|
void pop(context, File myFile, String meta) async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (bcontext) => Dialog(
|
builder: (bcontext) => Dialog(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.topCenter,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: ScrollController(),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
child: Column(children: [
|
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
title: meta,
|
leading: Icon(CwtchIcons.attached_file_2),
|
||||||
|
title: Text(meta),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: Icon(Icons.close),
|
icon: Icon(Icons.close),
|
||||||
color: Provider.of<Settings>(bcontext, listen: false).theme.toolbarIconColor,
|
color: Provider.of<Settings>(bcontext, listen: false).theme.toolbarIconColor,
|
||||||
|
@ -423,20 +427,29 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(bcontext, true);
|
Navigator.pop(bcontext, true);
|
||||||
})),
|
})),
|
||||||
Image.file(
|
Padding(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
child: Image.file(
|
||||||
myFile,
|
myFile,
|
||||||
cacheWidth: (MediaQuery.of(bcontext).size.width * 0.6).floor(),
|
cacheWidth: (MediaQuery.of(bcontext).size.width * 0.6).floor(),
|
||||||
width: (MediaQuery.of(bcontext).size.width * 0.6),
|
width: (MediaQuery.of(bcontext).size.width * 0.6),
|
||||||
height: (MediaQuery.of(bcontext).size.height * 0.6),
|
height: (MediaQuery.of(bcontext).size.height * 0.6),
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
),
|
)),
|
||||||
SizedBox(
|
Visibility(visible: !Platform.isAndroid, maintainSize: false, child: Text(myFile.path, textAlign: TextAlign.center)),
|
||||||
height: 20,
|
Visibility(
|
||||||
),
|
visible: Platform.isAndroid,
|
||||||
Visibility(visible: !Platform.isAndroid, child: Text(myFile.path, textAlign: TextAlign.center)),
|
maintainSize: false,
|
||||||
Visibility(visible: Platform.isAndroid, child: IconButton(icon: Icon(Icons.arrow_downward), onPressed: androidExport)),
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
child: ElevatedButton.icon(
|
||||||
|
icon: Icon(Icons.arrow_downward),
|
||||||
|
onPressed: androidExport,
|
||||||
|
label: Text(
|
||||||
|
AppLocalizations.of(context)!.saveBtn,
|
||||||
|
)))),
|
||||||
]),
|
]),
|
||||||
)));
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void androidExport() async {
|
void androidExport() async {
|
||||||
|
|
Loading…
Reference in New Issue