routing, and link handling
This commit is contained in:
parent
c025fbe07a
commit
b961be3e8b
@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:markdown/markdown.dart' as md;
|
import 'package:markdown/markdown.dart' as md;
|
||||||
import 'package:markdown_widget/markdown_widget.dart';
|
import 'package:markdown_widget/markdown_widget.dart';
|
||||||
import 'api_service.dart';
|
import 'api_service.dart';
|
||||||
|
import 'structs.dart';
|
||||||
|
|
||||||
class Routinghandler extends StatefulWidget {
|
class Routinghandler extends StatefulWidget {
|
||||||
Routinghandler(String link, emailID) {
|
Routinghandler(String link, emailID) {
|
||||||
@ -133,6 +134,7 @@ class Routinghandler extends StatefulWidget {
|
|||||||
class _RoutingHandlerState extends State<Routinghandler> {
|
class _RoutingHandlerState extends State<Routinghandler> {
|
||||||
List<String> markdownContent = [];
|
List<String> markdownContent = [];
|
||||||
bool _isLoaded = false;
|
bool _isLoaded = false;
|
||||||
|
AugmentTree? aug;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -143,13 +145,15 @@ class _RoutingHandlerState extends State<Routinghandler> {
|
|||||||
|
|
||||||
Future<void> _loadMarkdown() async {
|
Future<void> _loadMarkdown() async {
|
||||||
String folder = ApiService.currFolder;
|
String folder = ApiService.currFolder;
|
||||||
// print(folder);
|
|
||||||
print(widget.getEmailID());
|
print(widget.getEmailID());
|
||||||
String emailID = widget.emailID;
|
String emailID = widget.emailID;
|
||||||
print("inside _loadMarkdown in routinghandler $emailID");
|
print("inside _loadMarkdown in routinghandler $emailID");
|
||||||
markdownContent =
|
markdownContent =
|
||||||
await ApiService().fetchMarkdownContent([emailID], "INBOX");
|
await ApiService().fetchMarkdownContent([emailID], folder);
|
||||||
// print(markdownContent);
|
// print(markdownContent);
|
||||||
|
aug = AugmentTree.fromMD(markdownContent[0]);
|
||||||
|
aug!.addNumbering();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoaded = true;
|
_isLoaded = true;
|
||||||
});
|
});
|
||||||
@ -177,29 +181,43 @@ class _RoutingHandlerState extends State<Routinghandler> {
|
|||||||
maxHeight: MediaQuery.of(context).size.height * 0.7,
|
maxHeight: MediaQuery.of(context).size.height * 0.7,
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child:MarkdownBlock(data: markdownContent[0]))),
|
//inside here put the bunch rows
|
||||||
);
|
//make rows of markdownBlocks, but firstly i need to conveert the content into a tree
|
||||||
}
|
// child:MarkdownBlock(data: markdownContent[0])
|
||||||
}
|
|
||||||
|
|
||||||
class LinkViewer extends StatefulWidget {
|
child: Column(children: [
|
||||||
const LinkViewer({super.key});
|
for (int i = 0; i < this.aug!.children![0]!.children.length; i++)
|
||||||
|
Row(
|
||||||
@override
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
State<StatefulWidget> createState() => _LinkViewerState();
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
}
|
children: [
|
||||||
|
// if (leftNumbering)
|
||||||
class _LinkViewerState extends State<LinkViewer> {
|
Padding(
|
||||||
@override
|
padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
|
||||||
Widget build(BuildContext context) {
|
child: Text(
|
||||||
// this should be a class that opens a popup of the email on the view it wants
|
aug!.children![0]!.children![i]!.numbering,
|
||||||
|
style: TextStyle(
|
||||||
return Scaffold(
|
color: Color(Colors.purple[400]!.value)),
|
||||||
appBar: AppBar(
|
|
||||||
title: Text('url viewer'),
|
|
||||||
),
|
),
|
||||||
body: Column(
|
),
|
||||||
children: [],
|
Expanded(
|
||||||
));
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Wrap(children: [
|
||||||
|
MarkdownBlock(
|
||||||
|
data: aug!.children![0]!.children![i]!.data ?? ''),
|
||||||
|
],)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
|
||||||
|
child: Text(
|
||||||
|
aug!.children![0]!.children![i]!.numbering,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(Colors.purple[400]!.value)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
]))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user