Selaa lähdekoodia

Viewspecs button WIP

juan 1 päivä sitten
vanhempi
commit
04129f6da0
1 muutettua tiedostoa jossa 78 lisäystä ja 7 poistoa
  1. 78 7
      lib/augment.dart

+ 78 - 7
lib/augment.dart

@@ -187,7 +187,7 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
                 ),
               ),
               ElevatedButton(
-                onPressed: AugmentClasses.handleImages,
+                onPressed: () => AugmentClasses.FilterButton(context),
                 child: Text('Filter'),
               ),
               SizedBox(width: 8),
@@ -275,8 +275,8 @@ class AugmentClasses {
       builder: (context) => AlertDialog(
         title: Text('Jump Item:'),
         content: Container(
-          width: 200,
-          height: 120,
+          width: 300,
+          height: 170,
           child: Column(
             mainAxisSize: MainAxisSize.min,
             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: [
+          ElevatedButton(
+              onPressed: () {
+                //TODO: Grab both textfields and call both of the functions handles
+              },
+              child: Text('OK')),
           TextButton(
             onPressed: () {
               Navigator.of(context).pop();
               // print('close pressed');
             },
-            child: Text('close'),
+            child: Text('Cancel'),
           ),
           ElevatedButton(
-              onPressed: () => ViewSpecsButton(context),
-              child: Text('viewspecs'))
+              onPressed: () {
+                //TODO: in the ui demo didn't see it
+              },
+              child: Text('Help'))
         ],
       ),
     ).then((_) {
@@ -434,6 +470,7 @@ class AugmentClasses {
                           ElevatedButton(onPressed: () {}, child: Text('OK')),
                           ElevatedButton(
                               onPressed: () {
+                                AugmentClasses.disableIframePointerEvents();
                                 Navigator.of(context).pop();
                               },
                               child: Text('Cancel')),
@@ -447,10 +484,44 @@ class AugmentClasses {
                 ),
               ),
             )).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() {
     final iframes = html.document.getElementsByTagName('iframe');
     for (var iframe in iframes) {