|
@@ -22,40 +22,40 @@ class EmailToolbar extends StatefulWidget {
|
|
|
|
|
|
class _DynamicClassesAugment extends State<EmailToolbar> {
|
|
|
String selectedClass = 'Class 1';
|
|
|
- TextEditingController _jumpController = TextEditingController();
|
|
|
+ // TextEditingController _jumpController = TextEditingController();
|
|
|
|
|
|
- late final FocusNode _JumpItemfocusNode;
|
|
|
- late final FocusNode _viewSpecsfocusNode;
|
|
|
+ // late final FocusNode _JumpItemfocusNode;
|
|
|
+ // late final FocusNode _viewSpecsfocusNode;
|
|
|
|
|
|
- bool _jumpItemHasFocus = false;
|
|
|
- bool _viewSpecsHasFocus = false;
|
|
|
+ // bool _jumpItemHasFocus = false;
|
|
|
+ // bool _viewSpecsHasFocus = false;
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- _JumpItemfocusNode = FocusNode();
|
|
|
- _viewSpecsfocusNode = FocusNode();
|
|
|
+ // _JumpItemfocusNode = FocusNode();
|
|
|
+ // _viewSpecsfocusNode = FocusNode();
|
|
|
|
|
|
- _JumpItemfocusNode.addListener(() {
|
|
|
- setState(() => _jumpItemHasFocus = _JumpItemfocusNode.hasFocus);
|
|
|
- });
|
|
|
+ // _JumpItemfocusNode.addListener(() {
|
|
|
+ // setState(() => _jumpItemHasFocus = _JumpItemfocusNode.hasFocus);
|
|
|
+ // });
|
|
|
|
|
|
- _viewSpecsfocusNode.addListener(() {
|
|
|
- setState(() => _viewSpecsHasFocus = _viewSpecsfocusNode.hasFocus);
|
|
|
- });
|
|
|
+ // _viewSpecsfocusNode.addListener(() {
|
|
|
+ // setState(() => _viewSpecsHasFocus = _viewSpecsfocusNode.hasFocus);
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
// _JumpItemfocusNode.dispose();
|
|
|
// _viewSpecsfocusNode.dispose();
|
|
|
- _jumpController.dispose();
|
|
|
+ // _jumpController.dispose();
|
|
|
super.dispose();
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- const animationDuration = Duration(milliseconds: 250);
|
|
|
+ // const animationDuration = Duration(milliseconds: 250);
|
|
|
|
|
|
return Column(children: [
|
|
|
Row(
|
|
@@ -128,14 +128,14 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|
|
// width: 8,
|
|
|
// ),
|
|
|
Container(
|
|
|
- width: 150,
|
|
|
+ width: 50,
|
|
|
height: 30,
|
|
|
child: TextField(
|
|
|
- controller: _jumpController,
|
|
|
+ // controller: _jumpController,
|
|
|
decoration: InputDecoration(
|
|
|
- labelText: 'Jump Item',
|
|
|
- border: OutlineInputBorder(),
|
|
|
- suffixIcon: Icon(Icons.search)),
|
|
|
+ border: OutlineInputBorder(),
|
|
|
+ // suffixIcon: Icon(Icons.search)
|
|
|
+ ),
|
|
|
onSubmitted: (value) {
|
|
|
print("onSubmitted");
|
|
|
if (value.isNotEmpty) {
|
|
@@ -172,14 +172,18 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|
|
// ),
|
|
|
// ),
|
|
|
SizedBox(width: 8),
|
|
|
+ ElevatedButton(
|
|
|
+ onPressed: () => AugmentClasses.ViewSpecsButton(context),
|
|
|
+ child: Text('ViewSpecs:')),
|
|
|
Container(
|
|
|
- width: 150,
|
|
|
+ width: 50,
|
|
|
height: 30,
|
|
|
child: TextField(
|
|
|
decoration: InputDecoration(
|
|
|
- labelText: 'viewSpecs',
|
|
|
- border: OutlineInputBorder(),
|
|
|
- suffixIcon: Icon(Icons.style_rounded)),
|
|
|
+ labelText: '',
|
|
|
+ border: OutlineInputBorder(),
|
|
|
+ // suffixIcon: Icon(Icons.style_rounded)
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
ElevatedButton(
|
|
@@ -259,30 +263,209 @@ class AugmentClasses {
|
|
|
}
|
|
|
|
|
|
static void invisibility(String htmlClass) {}
|
|
|
- static JumpButton(context) {
|
|
|
- showDialog(
|
|
|
+
|
|
|
+ static Future<void> JumpButton(BuildContext context) async {
|
|
|
+ // FocusNode textFieldFocusNode = FocusNode();
|
|
|
+
|
|
|
+ AugmentClasses.disableIframePointerEvents();
|
|
|
+ await showDialog(
|
|
|
+ barrierDismissible: true,
|
|
|
+ // barrierColor: Colors.yellow,
|
|
|
context: context,
|
|
|
builder: (context) => AlertDialog(
|
|
|
title: Text('Jump Item:'),
|
|
|
- content: Column(
|
|
|
- children: [
|
|
|
- Text('Jump (to) Item (at)'),
|
|
|
- TextField(),
|
|
|
- // ElevatedButton(
|
|
|
- // onPressed: AugmentClasses.ViewSpecsButton(context),
|
|
|
- // child: Text('ViewSpecs'),
|
|
|
- // ),
|
|
|
- ]
|
|
|
+ content: Container(
|
|
|
+ width: 200,
|
|
|
+ height: 120,
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: [
|
|
|
+ Text('Jump (to) Item (at)'),
|
|
|
+ SizedBox(height: 10),
|
|
|
+ TextField(
|
|
|
+ autofocus: true,
|
|
|
+ decoration: InputDecoration(
|
|
|
+ labelText: '...',
|
|
|
+ border: OutlineInputBorder(),
|
|
|
+ suffixIcon: Icon(Icons.search)),
|
|
|
+ onSubmitted: (value) {
|
|
|
+ print("onSubmitted: $value");
|
|
|
+ if (value.isNotEmpty) {
|
|
|
+ handleJump(value);
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- )
|
|
|
- );
|
|
|
+ actions: [
|
|
|
+ TextButton(
|
|
|
+ onPressed: () {
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ // print('close pressed');
|
|
|
+ },
|
|
|
+ child: Text('close'),
|
|
|
+ ),
|
|
|
+ ElevatedButton(
|
|
|
+ onPressed: () => ViewSpecsButton(context),
|
|
|
+ child: Text('viewspecs'))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).then((_) {
|
|
|
+ AugmentClasses.enableIframePointerEvents();
|
|
|
+ });
|
|
|
}
|
|
|
- static ViewSpecsButton(context) {
|
|
|
- showDialog(
|
|
|
- context: context,
|
|
|
- builder:(context) => AlertDialog(
|
|
|
- title: Text('Viewspecs(short)') ,
|
|
|
- )
|
|
|
- );
|
|
|
+
|
|
|
+ static Future<void> ViewSpecsButton(context) async {
|
|
|
+ //TODO: finish it
|
|
|
+
|
|
|
+ bool blankLines = false;
|
|
|
+ bool numbering = false;
|
|
|
+ bool statementSignatures = false;
|
|
|
+ AugmentClasses.disableIframePointerEvents();
|
|
|
+ await showDialog(
|
|
|
+ context: context,
|
|
|
+ builder: (context) => Container(
|
|
|
+ height: 150,
|
|
|
+ width: 300,
|
|
|
+ child: AlertDialog(
|
|
|
+ title: Text('Viewspecs(short)'),
|
|
|
+ content: Container(
|
|
|
+ width: 400, // Set the width to simulate the Windows style
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ // First section: Checkboxes for "Show"
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text('Show'),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text("y z"),
|
|
|
+ Checkbox(
|
|
|
+ value: blankLines,
|
|
|
+ onChanged: (bool? value) {
|
|
|
+ blankLines = value!;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Text('Blank lines'),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text('m n'),
|
|
|
+ Checkbox(
|
|
|
+ value: numbering,
|
|
|
+ onChanged: (bool? value) {
|
|
|
+ numbering = value!;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Text('Numbering'),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text('K L'),
|
|
|
+ Checkbox(
|
|
|
+ value: statementSignatures,
|
|
|
+ onChanged: (bool? value) {
|
|
|
+ statementSignatures = value!;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Text('Statement signatures'),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // Second section: Numeric input for Outline, Levels, and Lines
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text('Outline'),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text('Levels'),
|
|
|
+ SizedBox(width: 10),
|
|
|
+ Container(
|
|
|
+ width: 40,
|
|
|
+ child: TextField(
|
|
|
+ decoration: InputDecoration(
|
|
|
+ isDense: true,
|
|
|
+ border: OutlineInputBorder(),
|
|
|
+ ),
|
|
|
+ keyboardType: TextInputType.number,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text('Lines'),
|
|
|
+ SizedBox(width: 10),
|
|
|
+ Container(
|
|
|
+ width: 40,
|
|
|
+ child: TextField(
|
|
|
+ decoration: InputDecoration(
|
|
|
+ isDense: true,
|
|
|
+ border: OutlineInputBorder(),
|
|
|
+ ),
|
|
|
+ keyboardType: TextInputType.number,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 20),
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ ElevatedButton(onPressed: () {}, child: Text('OK')),
|
|
|
+ ElevatedButton(
|
|
|
+ onPressed: () {
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ },
|
|
|
+ child: Text('Cancel')),
|
|
|
+ ElevatedButton(
|
|
|
+ onPressed: () {}, child: Text('Reset')),
|
|
|
+ ElevatedButton(onPressed: () {}, child: Text('Help')),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )).then((_) {
|
|
|
+ AugmentClasses.enableIframePointerEvents();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ static void disableIframePointerEvents() {
|
|
|
+ final iframes = html.document.getElementsByTagName('iframe');
|
|
|
+ for (var iframe in iframes) {
|
|
|
+ if (iframe is html.Element) {
|
|
|
+ iframe.style.pointerEvents = 'none'; // Disable pointer events
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static void enableIframePointerEvents() {
|
|
|
+ final iframes = html.document.getElementsByTagName('iframe');
|
|
|
+ for (var iframe in iframes) {
|
|
|
+ if (iframe is html.Element) {
|
|
|
+ iframe.style.pointerEvents = 'auto'; // Re-enable pointer events
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|