android/ios-adaption feature, markdown, and augment #6
					 1 changed files with 11 additions and 117 deletions
				
			
		| 
						 | 
					@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
 | 
				
			||||||
import 'dart:ui_web' as ui;
 | 
					import 'dart:ui_web' as ui;
 | 
				
			||||||
import 'augment.dart';
 | 
					import 'augment.dart';
 | 
				
			||||||
// import 'dart:js_interop' as js; //eventually for manipulating css
 | 
					// import 'dart:js_interop' as js; //eventually for manipulating css
 | 
				
			||||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
 | 
					 | 
				
			||||||
import 'collapsableEmails.dart';
 | 
					import 'collapsableEmails.dart';
 | 
				
			||||||
import 'api_service.dart';
 | 
					import 'api_service.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +43,7 @@ class _EmailViewState extends State<EmailView> {
 | 
				
			||||||
    {'id': 'marker2', 'x': 150, 'y': 200},
 | 
					    {'id': 'marker2', 'x': 150, 'y': 200},
 | 
				
			||||||
    {'id': 'marker3', 'x': 250, 'y': 300},
 | 
					    {'id': 'marker3', 'x': 250, 'y': 300},
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					  String? _targetJumpNumbering;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  void initState() {
 | 
					  void initState() {
 | 
				
			||||||
| 
						 | 
					@ -55,39 +55,19 @@ class _EmailViewState extends State<EmailView> {
 | 
				
			||||||
    // _registerViewFactory(currentContent);
 | 
					    // _registerViewFactory(currentContent);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // void _registerViewFactory(List<String> currentContent) { // i think this doesnt work anymore
 | 
					 | 
				
			||||||
  //   setState(() { //update to do item per item
 | 
					 | 
				
			||||||
  //   // each item to have itsviewtype ID
 | 
					 | 
				
			||||||
  // // is this necessarey here??
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // //could just move to collapsable
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //     viewTypeId = 'iframe-${DateTime.now().millisecondsSinceEpoch}';
 | 
					 | 
				
			||||||
  //     final emailHTML = web.document.createElement('div') as web.HTMLDivElement
 | 
					 | 
				
			||||||
  //       ..id = viewTypeId
 | 
					 | 
				
			||||||
  //       ..innerHTML = currentContent[0].toJS; // temporarily index because it has to do all of them
 | 
					 | 
				
			||||||
  //     emailHTML.style
 | 
					 | 
				
			||||||
  //       ..width = '100%'
 | 
					 | 
				
			||||||
  //       ..height = '100%'
 | 
					 | 
				
			||||||
  //       ..overflow = 'auto'
 | 
					 | 
				
			||||||
  //       ..scrollBehavior = 'smooth';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //     ui.platformViewRegistry.registerViewFactory(
 | 
					 | 
				
			||||||
  //       viewTypeId,
 | 
					 | 
				
			||||||
  //       (int viewId) => emailHTML,
 | 
					 | 
				
			||||||
  //     );
 | 
					 | 
				
			||||||
  //   });
 | 
					 | 
				
			||||||
  // }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void _scrollToNumber(String spanId) {
 | 
					  void _scrollToNumber(String spanId) {
 | 
				
			||||||
    AugmentClasses.handleJump(spanId);
 | 
					    AugmentClasses.handleJump(spanId);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  void _handleJumpRequest(String numbering) {
 | 
				
			||||||
 | 
					    setState(() {
 | 
				
			||||||
 | 
					      _targetJumpNumbering = numbering;
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: void _invisibility(String )  //to make purple numbers not visible
 | 
					  // TODO: void _invisibility(String )  //to make purple numbers not visible
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    // print("thread id ${widget.id}");
 | 
					 | 
				
			||||||
    ApiService.currThreadID = widget.id;
 | 
					    ApiService.currThreadID = widget.id;
 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
        appBar: AppBar(
 | 
					        appBar: AppBar(
 | 
				
			||||||
| 
						 | 
					@ -98,28 +78,10 @@ class _EmailViewState extends State<EmailView> {
 | 
				
			||||||
            Column(
 | 
					            Column(
 | 
				
			||||||
              children: [
 | 
					              children: [
 | 
				
			||||||
                EmailToolbar(
 | 
					                EmailToolbar(
 | 
				
			||||||
                  onJumpToSpan: _scrollToNumber,
 | 
					                  onJumpToSpan: _handleJumpRequest,
 | 
				
			||||||
                  onButtonPressed: () => {},
 | 
					                  onButtonPressed: () => {
 | 
				
			||||||
                  // AugmentClasses.handleJump(viewTypeId, '1');
 | 
					                    print("email tool bar pressed")
 | 
				
			||||||
                  // print("button got pressed?");
 | 
					                  },
 | 
				
			||||||
 | 
					 | 
				
			||||||
                  //   _registerViewFactory(r"""
 | 
					 | 
				
			||||||
                  // <h1>Welcome to My Website</h1>
 | 
					 | 
				
			||||||
                  // <p>This is a simple HTML page.</p>
 | 
					 | 
				
			||||||
                  // <h2>What is HTML?</h2>
 | 
					 | 
				
			||||||
                  // <p>HTML (HyperText Markup Language) is the most basic building~ block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (CSS) or functionality/behavior (JavaScript).</p>
 | 
					 | 
				
			||||||
                  // <h3>Here's a simple list:</h3>
 | 
					 | 
				
			||||||
                  // <ul>
 | 
					 | 
				
			||||||
                  //     <li>HTML elements are the building blocks of HTML pages</li>
 | 
					 | 
				
			||||||
                  //     <li>HTML uses tags like <code><tag></code> to organize and format content</li>
 | 
					 | 
				
			||||||
                  //     <li>CSS is used with HTML to style pages</li>
 | 
					 | 
				
			||||||
                  // </ul>
 | 
					 | 
				
			||||||
                  // <p>Copyright © 2023</p>
 | 
					 | 
				
			||||||
                  // """);
 | 
					 | 
				
			||||||
                  //   print("change");
 | 
					 | 
				
			||||||
                  // widget.emailContent = r"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                  //
 | 
					 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
                Row(
 | 
					                Row(
 | 
				
			||||||
                  // title of email
 | 
					                  // title of email
 | 
				
			||||||
| 
						 | 
					@ -162,79 +124,11 @@ class _EmailViewState extends State<EmailView> {
 | 
				
			||||||
                    thread: widget.messages,  //this wont work in serializable
 | 
					                    thread: widget.messages,  //this wont work in serializable
 | 
				
			||||||
                    threadHTML: widget.emailContent,
 | 
					                    threadHTML: widget.emailContent,
 | 
				
			||||||
                    threadIDs: widget.id,
 | 
					                    threadIDs: widget.id,
 | 
				
			||||||
 | 
					                    targetJumpNumbering: _targetJumpNumbering,
 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
                // Expanded(
 | 
					 | 
				
			||||||
                //   child: HtmlElementView(
 | 
					 | 
				
			||||||
                //     key: UniqueKey(),
 | 
					 | 
				
			||||||
                //     viewType: viewTypeId,
 | 
					 | 
				
			||||||
                //   ),
 | 
					 | 
				
			||||||
                // ),
 | 
					 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Overlay widgets dynamically based on marker positions
 | 
					 | 
				
			||||||
            // FutureBuilder<List<Map<String, dynamic>>>(
 | 
					 | 
				
			||||||
            //   future: _markerPositionsFuture,
 | 
					 | 
				
			||||||
            //   builder: (context, snapshot) {
 | 
					 | 
				
			||||||
            //     print("FutureBuilder state: ${snapshot.connectionState}");
 | 
					 | 
				
			||||||
            //     if (snapshot.connectionState == ConnectionState.waiting) {
 | 
					 | 
				
			||||||
            //       return Center(child: CircularProgressIndicator());
 | 
					 | 
				
			||||||
            //     }
 | 
					 | 
				
			||||||
            //     if (snapshot.hasError) {
 | 
					 | 
				
			||||||
            //       print("Error in FutureBuilder: ${snapshot.error}");
 | 
					 | 
				
			||||||
            //       return Center(child: Text('error loading markers'));
 | 
					 | 
				
			||||||
            //     }
 | 
					 | 
				
			||||||
            //     if (snapshot.hasData && snapshot.data != null) {
 | 
					 | 
				
			||||||
            //       final markers = snapshot.data!;
 | 
					 | 
				
			||||||
            //       return Stack(
 | 
					 | 
				
			||||||
            //         children: markers.map((marker) {
 | 
					 | 
				
			||||||
            //           return Positioned(
 | 
					 | 
				
			||||||
            //             left: marker['x'].toDouble(),
 | 
					 | 
				
			||||||
            //             top: marker['y'].toDouble(),
 | 
					 | 
				
			||||||
            //             child: GestureDetector(
 | 
					 | 
				
			||||||
            //               onTap: () {
 | 
					 | 
				
			||||||
            //                 print('Tapped on ${marker['id']}');
 | 
					 | 
				
			||||||
            //               },
 | 
					 | 
				
			||||||
            //               child: Container(
 | 
					 | 
				
			||||||
            //                 width: 50,
 | 
					 | 
				
			||||||
            //                 height: 50,
 | 
					 | 
				
			||||||
            //                 color: Colors.red,
 | 
					 | 
				
			||||||
            //                 child: Center(
 | 
					 | 
				
			||||||
            //                   child: Text(
 | 
					 | 
				
			||||||
            //                     marker['id'],
 | 
					 | 
				
			||||||
            //                     style: TextStyle(color: Colors.white),
 | 
					 | 
				
			||||||
            //                   ),
 | 
					 | 
				
			||||||
            //                 ),
 | 
					 | 
				
			||||||
            //               ),
 | 
					 | 
				
			||||||
            //             ),
 | 
					 | 
				
			||||||
            //           );
 | 
					 | 
				
			||||||
            //         }).toList(),
 | 
					 | 
				
			||||||
            //       );
 | 
					 | 
				
			||||||
            //     }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //     return SizedBox.shrink(); // No markers found
 | 
					 | 
				
			||||||
            //   },
 | 
					 | 
				
			||||||
            // ),
 | 
					 | 
				
			||||||
            // Red widget overlay
 | 
					 | 
				
			||||||
            // Positioned(
 | 
					 | 
				
			||||||
            //   left: 8, // Adjust based on your desired position
 | 
					 | 
				
			||||||
            //   top: 100 + 44 + 5, // Adjust based on your desired position
 | 
					 | 
				
			||||||
            //   child: IgnorePointer(
 | 
					 | 
				
			||||||
            //     ignoring: true, // Ensures the iframe remains interactive
 | 
					 | 
				
			||||||
            //     child: Container(
 | 
					 | 
				
			||||||
            //       color: Colors.red,
 | 
					 | 
				
			||||||
            //       width: 100,
 | 
					 | 
				
			||||||
            //       height: 50,
 | 
					 | 
				
			||||||
            //       child: Center(
 | 
					 | 
				
			||||||
            //         child: Text(
 | 
					 | 
				
			||||||
            //           'Overlay',
 | 
					 | 
				
			||||||
            //           style: TextStyle(color: Colors.white),
 | 
					 | 
				
			||||||
            //         ),
 | 
					 | 
				
			||||||
            //       ),
 | 
					 | 
				
			||||||
            //     ),
 | 
					 | 
				
			||||||
            //   ),
 | 
					 | 
				
			||||||
            // ),
 | 
					 | 
				
			||||||
          ],
 | 
					          ],
 | 
				
			||||||
        ));
 | 
					        ));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue