viewspecs and jump textfield controller
This commit is contained in:
parent
34989d8213
commit
edec45669d
@ -1,16 +1,18 @@
|
||||
import 'package:crab_ui/api_service.dart';
|
||||
import 'package:crab_ui/attachmentDownload.dart';
|
||||
import 'package:crab_ui/collapsableEmails.dart';
|
||||
import 'package:crab_ui/structs.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||
import 'attachmentWidget.dart';
|
||||
|
||||
class EmailToolbar extends StatefulWidget {
|
||||
final Function(String) onJumpToSpan;
|
||||
final Function(String) onJumpToNumbering;
|
||||
final Function(String) onViewspecs;
|
||||
final VoidCallback onButtonPressed;
|
||||
|
||||
EmailToolbar(
|
||||
{Key? key, required this.onButtonPressed, required this.onJumpToSpan})
|
||||
{Key? key, required this.onButtonPressed, required this.onJumpToNumbering, required this.onViewspecs})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -19,7 +21,8 @@ class EmailToolbar extends StatefulWidget {
|
||||
|
||||
class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
String selectedClass = 'Class 1';
|
||||
// TextEditingController _jumpController = TextEditingController();
|
||||
TextEditingController _jumpController = TextEditingController();
|
||||
TextEditingController _viewspecsController = TextEditingController();
|
||||
|
||||
// late final FocusNode _JumpItemfocusNode;
|
||||
// late final FocusNode _viewSpecsfocusNode;
|
||||
@ -46,7 +49,7 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
void dispose() {
|
||||
// _JumpItemfocusNode.dispose();
|
||||
// _viewSpecsfocusNode.dispose();
|
||||
// _jumpController.dispose();
|
||||
_jumpController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -71,20 +74,20 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
child: Text('Attachments'),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
ElevatedButton(
|
||||
onPressed: AugmentClasses.handleOpen,
|
||||
child: Text('Open'),
|
||||
),
|
||||
// ElevatedButton(
|
||||
// onPressed: AugmentClasses.handleOpen,
|
||||
// child: Text('Open'),
|
||||
// ),
|
||||
// SizedBox(width: 8),
|
||||
ElevatedButton(
|
||||
onPressed: AugmentClasses.handleFind,
|
||||
child: Text('Find'),
|
||||
),
|
||||
// SizedBox(width: 8),
|
||||
ElevatedButton(
|
||||
onPressed: AugmentClasses.handleStop,
|
||||
child: Text('Stop'),
|
||||
),
|
||||
// ElevatedButton(
|
||||
// onPressed: AugmentClasses.handleStop,
|
||||
// child: Text('Stop'),
|
||||
// ),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
AugmentClasses.handleMove(context);
|
||||
@ -131,10 +134,10 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
// width: 8,
|
||||
// ),
|
||||
Container(
|
||||
width: 50,
|
||||
width: 100,
|
||||
height: 30,
|
||||
child: TextField(
|
||||
// controller: _jumpController,
|
||||
controller: _jumpController,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
// suffixIcon: Icon(Icons.search)
|
||||
@ -142,7 +145,7 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
onSubmitted: (value) {
|
||||
print("onSubmitted");
|
||||
if (value.isNotEmpty) {
|
||||
widget.onJumpToSpan(value);
|
||||
widget.onJumpToNumbering(value);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -179,14 +182,18 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
onPressed: () => AugmentClasses.ViewSpecsButton(context),
|
||||
child: Text('ViewSpecs:')),
|
||||
Container(
|
||||
width: 50,
|
||||
width: 100,
|
||||
height: 30,
|
||||
child: TextField(
|
||||
controller: _viewspecsController,
|
||||
decoration: InputDecoration(
|
||||
labelText: '',
|
||||
border: OutlineInputBorder(),
|
||||
// suffixIcon: Icon(Icons.style_rounded)
|
||||
),
|
||||
onSubmitted: (value) {
|
||||
widget.onViewspecs(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
@ -484,30 +491,8 @@ class AugmentClasses {
|
||||
print("Stop button pressed");
|
||||
}
|
||||
|
||||
static void handleJump(String spanId) {
|
||||
String js_code = '''
|
||||
var iframe = document.getElementsByTagName('iframe')[0]; // 0 for the first iframe, 1 for the second, etc.
|
||||
|
||||
// Check if the iframe is loaded and has content
|
||||
if (iframe && iframe.contentDocument) {
|
||||
// Access the document inside the iframe
|
||||
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
||||
|
||||
// Find the element with the specific id inside the iframe
|
||||
var targetElement = iframeDoc.getElementById("$spanId"); // Replace '36 ' with the actual id of the target element
|
||||
|
||||
// If the element exists, scroll to it
|
||||
if (targetElement) {
|
||||
targetElement.scrollIntoView();
|
||||
console.log('Scrolled to element with id "$spanId" inside the iframe.');
|
||||
} else {
|
||||
console.log('Element with id "$spanId" not found inside the iframe.');
|
||||
}
|
||||
} else {
|
||||
console.log('Iframe not found or not loaded.');
|
||||
}
|
||||
''';
|
||||
// js.context.callMethod('eval', [js_code]);
|
||||
static void handleJump(String value) {
|
||||
print(value);
|
||||
}
|
||||
|
||||
static void invisibility(String htmlClass) {}
|
||||
|
Loading…
Reference in New Issue
Block a user