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/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';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class EmailToolbar extends StatefulWidget {
|
||||
final Function(String) onJumpToNumbering;
|
||||
final Function(String) onViewspecs;
|
||||
final VoidCallback onButtonPressed;
|
||||
final Function(String) onFiltering;
|
||||
final List<String> emails;
|
||||
final String subject;
|
||||
|
||||
EmailToolbar({
|
||||
Key? key,
|
||||
@ -17,6 +21,8 @@ class EmailToolbar extends StatefulWidget {
|
||||
required this.onJumpToNumbering,
|
||||
required this.onViewspecs,
|
||||
required this.onFiltering,
|
||||
required this.emails,
|
||||
required this.subject,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -27,6 +33,8 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
String selectedClass = 'Class 1';
|
||||
TextEditingController _jumpController = TextEditingController();
|
||||
TextEditingController _viewspecsController = TextEditingController();
|
||||
AugmentClasses? localAugment;
|
||||
List<SerializableMessage>? emailsInThread;
|
||||
|
||||
// late final FocusNode _JumpItemfocusNode;
|
||||
// late final FocusNode _viewSpecsfocusNode;
|
||||
@ -47,6 +55,17 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
// _viewSpecsfocusNode.addListener(() {
|
||||
// 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
|
||||
@ -201,7 +220,8 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => AugmentClasses().filterButton(context, widget.onFiltering),
|
||||
onPressed: () =>
|
||||
AugmentClasses().filterButton(context, widget.onFiltering),
|
||||
child: Text('Filter'),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
@ -211,7 +231,8 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
),
|
||||
// SizedBox(width: 8),
|
||||
ElevatedButton(
|
||||
onPressed: AugmentClasses.handleFind,
|
||||
onPressed: () => AugmentClasses()
|
||||
.handleCreateLink(context, widget.emails, widget.subject),
|
||||
child: Text('Create Link'),
|
||||
),
|
||||
ElevatedButton(
|
||||
@ -226,6 +247,13 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
}
|
||||
|
||||
class AugmentClasses {
|
||||
CollapsableEmails? localCollapsable;
|
||||
String? nameOfDocument;
|
||||
|
||||
// AugmentClasses(CollapsableEmails localCollapsable) {
|
||||
// localCollapsable = localCollapsable;
|
||||
// }
|
||||
|
||||
static OverlayEntry? _overlayEntry;
|
||||
static String? selectedFolder; // Manage selected folder at the class level
|
||||
|
||||
@ -491,6 +519,131 @@ class AugmentClasses {
|
||||
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() {
|
||||
print("Stop button pressed");
|
||||
}
|
||||
@ -728,7 +881,8 @@ class AugmentClasses {
|
||||
return [];
|
||||
}
|
||||
|
||||
Future<void> filterButton(context, Function(String) onFilteringCallback) async {
|
||||
Future<void> filterButton(
|
||||
context, Function(String) onFilteringCallback) 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
|
||||
@ -756,6 +910,7 @@ class AugmentClasses {
|
||||
SizedBox(
|
||||
width: 175,
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
maxLines: 1,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
|
Loading…
Reference in New Issue
Block a user