Viewspecs button WIP

This commit is contained in:
Juan Marulanda De Los Rios 2024-09-20 00:38:10 -04:00
parent 84c50d7b97
commit 04129f6da0

View File

@ -187,7 +187,7 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
), ),
), ),
ElevatedButton( ElevatedButton(
onPressed: AugmentClasses.handleImages, onPressed: () => AugmentClasses.FilterButton(context),
child: Text('Filter'), child: Text('Filter'),
), ),
SizedBox(width: 8), SizedBox(width: 8),
@ -275,8 +275,8 @@ class AugmentClasses {
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: Text('Jump Item:'), title: Text('Jump Item:'),
content: Container( content: Container(
width: 200, width: 300,
height: 120, height: 170,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -296,20 +296,56 @@ class AugmentClasses {
} }
}, },
), ),
Spacer(
flex: 5,
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton(
onPressed: () => AugmentClasses.ViewSpecsButton(context),
child: Text("Viewspecs:"),
),
SizedBox(
width: 150,
child: TextField(
maxLines: 1,
decoration: InputDecoration(
labelText: '',
border: OutlineInputBorder(),
suffixIcon: Icon(Icons.search)),
onSubmitted: (value) {
print("onSubmitted: $value");
if (value.isNotEmpty) {
handleJump(value);
Navigator.of(context).pop();
}
},
),
),
],
),
], ],
), ),
), ),
actions: [ actions: [
ElevatedButton(
onPressed: () {
//TODO: Grab both textfields and call both of the functions handles
},
child: Text('OK')),
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
// print('close pressed'); // print('close pressed');
}, },
child: Text('close'), child: Text('Cancel'),
), ),
ElevatedButton( ElevatedButton(
onPressed: () => ViewSpecsButton(context), onPressed: () {
child: Text('viewspecs')) //TODO: in the ui demo didn't see it
},
child: Text('Help'))
], ],
), ),
).then((_) { ).then((_) {
@ -434,6 +470,7 @@ class AugmentClasses {
ElevatedButton(onPressed: () {}, child: Text('OK')), ElevatedButton(onPressed: () {}, child: Text('OK')),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
AugmentClasses.disableIframePointerEvents();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Text('Cancel')), child: Text('Cancel')),
@ -447,10 +484,44 @@ class AugmentClasses {
), ),
), ),
)).then((_) { )).then((_) {
AugmentClasses.enableIframePointerEvents(); AugmentClasses.enableIframePointerEvents(); // may be useless?
}); });
} }
void handleFilter() {}
static Future<void> FilterButton(context) async {
//this is literally ctrl+F :skull:
//idea is to search in file, extract the <p> tags that contain these
//words and highlight, then when zoom, you just jump to that paragraph
AugmentClasses.disableIframePointerEvents();
await showDialog(
context: context,
builder: (context) => Container(
height: 150,
width: 300,
child: AlertDialog(
title: Text('Filter'),
content: Container(
width: 400, // Set the width to simulate the Windows style
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Set filter:'),
SizedBox(
width: 175,
child: TextField(
maxLines: 1,
decoration: InputDecoration(
border: OutlineInputBorder(),
),
),
)
],
)))));
}
static void disableIframePointerEvents() { static void disableIframePointerEvents() {
final iframes = html.document.getElementsByTagName('iframe'); final iframes = html.document.getElementsByTagName('iframe');
for (var iframe in iframes) { for (var iframe in iframes) {