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:js' as js;
|
||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||
import 'attachmentWidget.dart';
|
||||
|
||||
class EmailToolbar extends StatefulWidget {
|
||||
final Function(String) onJumpToSpan;
|
||||
@ -238,29 +239,29 @@ class AugmentClasses {
|
||||
// Focused content window
|
||||
PointerInterceptor(
|
||||
child: Center(
|
||||
child: Material(
|
||||
elevation: 8,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
maxHeight: 500,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
const Divider(height: 1),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: _buildMenuItem(),
|
||||
),
|
||||
child: Material(
|
||||
elevation: 8,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
maxHeight: 500,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
const Divider(height: 1),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: _buildMenuItem(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -275,32 +276,41 @@ class AugmentClasses {
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child:
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Text(
|
||||
'Thread Attachments',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Text(
|
||||
'Thread Attachments',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
CloseButton(
|
||||
onPressed: () {
|
||||
_overlayEntry?.remove();
|
||||
},
|
||||
),
|
||||
]
|
||||
));
|
||||
]));
|
||||
}
|
||||
|
||||
static List<Widget> _buildMenuItem() {
|
||||
static List<Widget> _buildMenuItem(BuildContext context) {
|
||||
List<Widget> listOfFiles = [];
|
||||
for (AttachmentResponse file in ApiService.threadAttachments) {
|
||||
listOfFiles.add(ListTile(
|
||||
leading: Icon(Icons.file_present),
|
||||
title: Text(file.name.toString()),
|
||||
onTap: () {
|
||||
print("rick rolled");
|
||||
html.window
|
||||
.open("https://www.youtube.com/watch?v=xvFZjo5PgG0", "testing");
|
||||
_overlayEntry?.remove();
|
||||
Navigator.push(
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user