HyM attachments resolve: #2 #3

Merged
Juan merged 15 commits from login into main 2025-04-24 16:52:58 +00:00
2 changed files with 87 additions and 30 deletions
Showing only changes of commit 9ea012f7ad - Show all commits

47
lib/attachmentWidget.dart Normal file
View 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),
)
],
),
),
],
);
}
}

View File

@ -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;
@ -252,7 +253,7 @@ class AugmentClasses {
const Divider(height: 1), const Divider(height: 1),
Expanded( Expanded(
child: ListView( child: ListView(
children: _buildMenuItem(), children: _buildMenuItem(context),
), ),
), ),
], ],
@ -287,20 +288,29 @@ class AugmentClasses {
_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;