added copying the link to your device
This commit is contained in:
parent
80a0c96e0f
commit
dcb93a18c6
161
lib/augment.dart
161
lib/augment.dart
@ -1,15 +1,19 @@
|
|||||||
import 'package:crab_ui/api_service.dart';
|
import 'package:crab_ui/api_service.dart';
|
||||||
import 'package:crab_ui/attachmentDownload.dart';
|
import 'package:crab_ui/attachmentDownload.dart';
|
||||||
|
import 'package:crab_ui/collapsableEmails.dart';
|
||||||
import 'package:crab_ui/structs.dart';
|
import 'package:crab_ui/structs.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
import 'attachmentWidget.dart';
|
import 'attachmentWidget.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class EmailToolbar extends StatefulWidget {
|
class EmailToolbar extends StatefulWidget {
|
||||||
final Function(String) onJumpToNumbering;
|
final Function(String) onJumpToNumbering;
|
||||||
final Function(String) onViewspecs;
|
final Function(String) onViewspecs;
|
||||||
final VoidCallback onButtonPressed;
|
final VoidCallback onButtonPressed;
|
||||||
final Function(String) onFiltering;
|
final Function(String) onFiltering;
|
||||||
|
final List<String> emails;
|
||||||
|
final String subject;
|
||||||
|
|
||||||
EmailToolbar({
|
EmailToolbar({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -17,6 +21,8 @@ class EmailToolbar extends StatefulWidget {
|
|||||||
required this.onJumpToNumbering,
|
required this.onJumpToNumbering,
|
||||||
required this.onViewspecs,
|
required this.onViewspecs,
|
||||||
required this.onFiltering,
|
required this.onFiltering,
|
||||||
|
required this.emails,
|
||||||
|
required this.subject,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -27,6 +33,8 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
String selectedClass = 'Class 1';
|
String selectedClass = 'Class 1';
|
||||||
TextEditingController _jumpController = TextEditingController();
|
TextEditingController _jumpController = TextEditingController();
|
||||||
TextEditingController _viewspecsController = TextEditingController();
|
TextEditingController _viewspecsController = TextEditingController();
|
||||||
|
AugmentClasses? localAugment;
|
||||||
|
List<SerializableMessage>? emailsInThread;
|
||||||
|
|
||||||
// late final FocusNode _JumpItemfocusNode;
|
// late final FocusNode _JumpItemfocusNode;
|
||||||
// late final FocusNode _viewSpecsfocusNode;
|
// late final FocusNode _viewSpecsfocusNode;
|
||||||
@ -47,6 +55,17 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
// _viewSpecsfocusNode.addListener(() {
|
// _viewSpecsfocusNode.addListener(() {
|
||||||
// setState(() => _viewSpecsHasFocus = _viewSpecsfocusNode.hasFocus);
|
// setState(() => _viewSpecsHasFocus = _viewSpecsfocusNode.hasFocus);
|
||||||
// });
|
// });
|
||||||
|
_serializableData(widget.emails);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _serializableData(List<String> threadID) async {
|
||||||
|
// emailsInThread = await ApiService().threadsInSerializable();
|
||||||
|
print("done thread serializable");
|
||||||
|
|
||||||
|
if (!mounted) return;
|
||||||
|
// setState(() {
|
||||||
|
// _isLoaded = true;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -201,7 +220,8 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => AugmentClasses().filterButton(context, widget.onFiltering),
|
onPressed: () =>
|
||||||
|
AugmentClasses().filterButton(context, widget.onFiltering),
|
||||||
child: Text('Filter'),
|
child: Text('Filter'),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
@ -211,7 +231,8 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
),
|
),
|
||||||
// SizedBox(width: 8),
|
// SizedBox(width: 8),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: AugmentClasses.handleFind,
|
onPressed: () => AugmentClasses()
|
||||||
|
.handleCreateLink(context, widget.emails, widget.subject),
|
||||||
child: Text('Create Link'),
|
child: Text('Create Link'),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
@ -226,6 +247,13 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AugmentClasses {
|
class AugmentClasses {
|
||||||
|
CollapsableEmails? localCollapsable;
|
||||||
|
String? nameOfDocument;
|
||||||
|
|
||||||
|
// AugmentClasses(CollapsableEmails localCollapsable) {
|
||||||
|
// localCollapsable = localCollapsable;
|
||||||
|
// }
|
||||||
|
|
||||||
static OverlayEntry? _overlayEntry;
|
static OverlayEntry? _overlayEntry;
|
||||||
static String? selectedFolder; // Manage selected folder at the class level
|
static String? selectedFolder; // Manage selected folder at the class level
|
||||||
|
|
||||||
@ -491,6 +519,131 @@ class AugmentClasses {
|
|||||||
print("Find button pressed");
|
print("Find button pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_copyLink(String anchor, String target, String format, String viewspecs,
|
||||||
|
String nameOfDocument) {
|
||||||
|
String form = "$anchor < $nameOfDocument, $target :$viewspecs >";
|
||||||
|
final link = ClipboardData(text: form);
|
||||||
|
Clipboard.setData(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> handleCreateLink(BuildContext context,
|
||||||
|
List<String> emailsInThread, String nameOfDocument) async {
|
||||||
|
print("create link button pressed");
|
||||||
|
final TextEditingController targetController = TextEditingController();
|
||||||
|
final TextEditingController anchorController = TextEditingController();
|
||||||
|
final TextEditingController viewspecsController = TextEditingController();
|
||||||
|
final TextEditingController formatController = TextEditingController();
|
||||||
|
|
||||||
|
// String anchorPhrase = '';
|
||||||
|
String format = 'augment';
|
||||||
|
// String target = '';
|
||||||
|
// String viewspecs = '';
|
||||||
|
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Text('Create URL Link'),
|
||||||
|
content: SizedBox(
|
||||||
|
height: 400,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text("Which email? "),
|
||||||
|
SizedBox(
|
||||||
|
width: 350.0,
|
||||||
|
child: Text(nameOfDocument),
|
||||||
|
// child: ListView.builder(
|
||||||
|
// itemCount: emailsInThread.length,
|
||||||
|
// itemBuilder: (context, index) {
|
||||||
|
// // var item = emailsInThread[index];
|
||||||
|
// // ApiService().
|
||||||
|
// return ListTile(
|
||||||
|
// title: Text(nameOfDocument),
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text("Link to target item at: "),
|
||||||
|
SizedBox(
|
||||||
|
width: 350.0,
|
||||||
|
child: TextField(
|
||||||
|
controller: targetController,
|
||||||
|
autofocus: true,
|
||||||
|
maxLines: 1,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => ViewSpecsButton(context),
|
||||||
|
child: Text("Viewspecs:")),
|
||||||
|
SizedBox(
|
||||||
|
width: 150.0,
|
||||||
|
child: TextField(
|
||||||
|
controller: viewspecsController,
|
||||||
|
maxLines: 1,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text("Using anchor phrase: "),
|
||||||
|
SizedBox(
|
||||||
|
width: 150.0,
|
||||||
|
child: TextField(
|
||||||
|
controller: anchorController,
|
||||||
|
maxLines: 1,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text("Using link format: "),
|
||||||
|
SizedBox(
|
||||||
|
width: 250.0,
|
||||||
|
child: Text("Augment"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => {
|
||||||
|
_copyLink(anchorController.text, targetController.text, format, viewspecsController.text,
|
||||||
|
nameOfDocument),
|
||||||
|
Navigator.of(context).pop()
|
||||||
|
},
|
||||||
|
child: Text("OK")),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text("Cancel")),
|
||||||
|
ElevatedButton(onPressed: null, child: Text("Help")),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
static void handleStop() {
|
static void handleStop() {
|
||||||
print("Stop button pressed");
|
print("Stop button pressed");
|
||||||
}
|
}
|
||||||
@ -728,7 +881,8 @@ class AugmentClasses {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> filterButton(context, Function(String) onFilteringCallback) async {
|
Future<void> filterButton(
|
||||||
|
context, Function(String) onFilteringCallback) async {
|
||||||
//this is literally ctrl+F :skull:
|
//this is literally ctrl+F :skull:
|
||||||
//idea is to search in file, extract the <p> tags that contain these
|
//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
|
//words and highlight, then when zoom, you just jump to that paragraph
|
||||||
@ -756,6 +910,7 @@ class AugmentClasses {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 175,
|
width: 175,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
autofocus: true,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
|
Loading…
Reference in New Issue
Block a user