From 9e27401b0703a4ce7627739ef854e30dc8308416 Mon Sep 17 00:00:00 2001 From: juan Date: Tue, 4 Mar 2025 22:15:43 -0500 Subject: [PATCH] fixed Focusing problem, now the attachment box is clickable --- lib/augment.dart | 89 ++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/lib/augment.dart b/lib/augment.dart index 96922f0..fe4de59 100644 --- a/lib/augment.dart +++ b/lib/augment.dart @@ -1,8 +1,10 @@ import 'package:crab_ui/api_service.dart'; import 'package:crab_ui/structs.dart'; import 'package:flutter/material.dart'; +import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'dart:html' as html; import 'dart:js' as js; +import 'package:pointer_interceptor/pointer_interceptor.dart'; class EmailToolbar extends StatefulWidget { final Function(String) onJumpToSpan; @@ -228,42 +230,37 @@ class AugmentClasses { builder: (context) => Stack( children: [ // Dimmed background - GestureDetector( - onTap: () => _overlayEntry?.remove(), - child: Container( - color: Colors.black54, - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - ), + Container( + color: Colors.black54, + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, ), // Focused content window - Center( - child: Positioned( - left: offset.dx + 500, - top: offset.dy + renderBox.size.height + 100, - child: Material( - elevation: 8, - borderRadius: BorderRadius.circular(12), - child: ConstrainedBox( - constraints: const BoxConstraints( - maxWidth: 400, - maxHeight: 500, - ), - child: Column( - children: [ - _buildHeader(), - const Divider(height: 1), - Expanded( - child: ListView( - children: _buildMenuItem(), + 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(), + ), ), - ), - ], + ], + ), ), ), ), ), - ) ], ), ); @@ -273,17 +270,25 @@ class AugmentClasses { } // Add missing widget builder methods - static Widget _buildHeader() { - return const Padding( - padding: EdgeInsets.all(16.0), - child: Text( - 'Thread Attachments', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ); + static Widget _buildHeader(BuildContext context) { + return Padding( + padding: EdgeInsets.all(16.0), + child: + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Text( + 'Thread Attachments', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + CloseButton( + onPressed: () { + _overlayEntry?.remove(); + }, + ), + ] + )); } static List _buildMenuItem() { @@ -293,7 +298,9 @@ class AugmentClasses { leading: Icon(Icons.file_present), title: Text(file.name.toString()), onTap: () { - _overlayEntry?.remove(); + print("rick rolled"); + html.window + .open("https://www.youtube.com/watch?v=xvFZjo5PgG0", "testing"); })); } return listOfFiles;