support for images works
This commit is contained in:
parent
7f77f2e01b
commit
9ea012f7ad
47
lib/attachmentWidget.dart
Normal file
47
lib/attachmentWidget.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import "package:crab_ui/structs.dart";
|
||||||
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
|
class AttachmentWidget extends StatelessWidget {
|
||||||
|
final AttachmentResponse attachment;
|
||||||
|
AttachmentWidget({required this.attachment});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Stack(
|
||||||
|
// appBar: AppBar(title: Text('New Tab Content')),
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(10, 20, 0, 0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
CloseButton(
|
||||||
|
onPressed: () => {
|
||||||
|
Navigator.pop(context)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
attachment.name.toString(), //its alr a string but incase ¯\(ツ)/¯
|
||||||
|
style: TextStyle(color: Colors.black, fontSize: 20), //TODO: personalize your fonts
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 1000,
|
||||||
|
height: 600,
|
||||||
|
child: Image.memory(attachment.data),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:pointer_interceptor/pointer_interceptor.dart';
|
|||||||
import 'dart:html' as html;
|
import 'dart:html' as html;
|
||||||
import 'dart:js' as js;
|
import 'dart:js' as js;
|
||||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
|
import 'attachmentWidget.dart';
|
||||||
|
|
||||||
class EmailToolbar extends StatefulWidget {
|
class EmailToolbar extends StatefulWidget {
|
||||||
final Function(String) onJumpToSpan;
|
final Function(String) onJumpToSpan;
|
||||||
@ -238,29 +239,29 @@ class AugmentClasses {
|
|||||||
// Focused content window
|
// Focused content window
|
||||||
PointerInterceptor(
|
PointerInterceptor(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: 8,
|
elevation: 8,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 400,
|
maxWidth: 400,
|
||||||
maxHeight: 500,
|
maxHeight: 500,
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildHeader(context),
|
_buildHeader(context),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: _buildMenuItem(),
|
children: _buildMenuItem(context),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -275,32 +276,41 @@ class AugmentClasses {
|
|||||||
padding: EdgeInsets.all(16.0),
|
padding: EdgeInsets.all(16.0),
|
||||||
child:
|
child:
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
Text(
|
Text(
|
||||||
'Thread Attachments',
|
'Thread Attachments',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
CloseButton(
|
CloseButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_overlayEntry?.remove();
|
_overlayEntry?.remove();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Widget> _buildMenuItem() {
|
static List<Widget> _buildMenuItem(BuildContext context) {
|
||||||
List<Widget> listOfFiles = [];
|
List<Widget> listOfFiles = [];
|
||||||
for (AttachmentResponse file in ApiService.threadAttachments) {
|
for (AttachmentResponse file in ApiService.threadAttachments) {
|
||||||
listOfFiles.add(ListTile(
|
listOfFiles.add(ListTile(
|
||||||
leading: Icon(Icons.file_present),
|
leading: Icon(Icons.file_present),
|
||||||
title: Text(file.name.toString()),
|
title: Text(file.name.toString()),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
print("rick rolled");
|
_overlayEntry?.remove();
|
||||||
html.window
|
Navigator.push(
|
||||||
.open("https://www.youtube.com/watch?v=xvFZjo5PgG0", "testing");
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AttachmentWidget(attachment: file)));
|
||||||
|
|
||||||
|
// openAtta
|
||||||
|
|
||||||
|
// Image attachment = Image.memory(file.data);
|
||||||
|
|
||||||
|
// print("rick rolled");
|
||||||
|
// html.window
|
||||||
|
// .open("https://www.youtube.com/watch?v=xvFZjo5PgG0", "testing");
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return listOfFiles;
|
return listOfFiles;
|
||||||
|
Loading…
Reference in New Issue
Block a user