viewspecs, hiding right purple number
This commit is contained in:
		
							parent
							
								
									7a6eea64e1
								
							
						
					
					
						commit
						37c7e6a935
					
				
					 1 changed files with 64 additions and 40 deletions
				
			
		| 
						 | 
					@ -27,13 +27,14 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
  List heightOfViewTypes = []; //the height of each viewtype
 | 
					  List heightOfViewTypes = []; //the height of each viewtype
 | 
				
			||||||
  List<SerializableMessage> emailsInThread = [];
 | 
					  List<SerializableMessage> emailsInThread = [];
 | 
				
			||||||
  bool _isLoaded = false;
 | 
					  bool _isLoaded = false;
 | 
				
			||||||
 | 
					  static bool _isListenerRegistered = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  void initState() {
 | 
					  void initState() {
 | 
				
			||||||
    // TODO: implement initState
 | 
					 | 
				
			||||||
    super.initState();
 | 
					    super.initState();
 | 
				
			||||||
    _registerViewFactory(widget.threadHTML);
 | 
					    _registerViewFactory(widget.threadHTML);
 | 
				
			||||||
    _serializableData(widget.threadIDs);
 | 
					    _serializableData(widget.threadIDs); // this
 | 
				
			||||||
 | 
					    _keyListener();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void _registerViewFactory(List<String> currentContent) async {
 | 
					  void _registerViewFactory(List<String> currentContent) async {
 | 
				
			||||||
| 
						 | 
					@ -88,16 +89,40 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void _keyListener() {
 | 
				
			||||||
 | 
					    if (_isListenerRegistered) return;
 | 
				
			||||||
 | 
					    _isListenerRegistered = true;
 | 
				
			||||||
 | 
					    web.window.document.addEventListener(
 | 
				
			||||||
 | 
					      'keydown',
 | 
				
			||||||
 | 
					      ((web.Event event) {
 | 
				
			||||||
 | 
					        final keyEvent = event as web.KeyboardEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (keyEvent.key.toLowerCase() == 'k') {
 | 
				
			||||||
 | 
					          print('You pressed the "k" key!');
 | 
				
			||||||
 | 
					          final leftPurpleNums = web.document.getElementsByClassName("right");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          for (int i = 0; i < leftPurpleNums.length; i++) {
 | 
				
			||||||
 | 
					            final currentElement = leftPurpleNums.item(i) as web.HTMLElement;
 | 
				
			||||||
 | 
					            final opacity = web.window.getComputedStyle(currentElement).opacity;
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            currentElement.style.opacity =
 | 
				
			||||||
 | 
					                (opacity == '0') ? '1.0' : '0.0'; // works mostly
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }).toJS,
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    return _isLoaded
 | 
					    return _isLoaded
 | 
				
			||||||
      ?Column(children: [
 | 
					        ? Column(children: [
 | 
				
			||||||
            Expanded(
 | 
					            Expanded(
 | 
				
			||||||
              child: ListView.builder(
 | 
					              child: ListView.builder(
 | 
				
			||||||
                itemCount: widget.thread.length,
 | 
					                itemCount: widget.thread.length,
 | 
				
			||||||
                itemBuilder: (context, index) {
 | 
					                itemBuilder: (context, index) {
 | 
				
			||||||
              final isExpanded =
 | 
					                  final isExpanded = _expandedEmails
 | 
				
			||||||
                  _expandedEmails.contains(index); //check if email is expanded
 | 
					                      .contains(index); //check if email is expanded
 | 
				
			||||||
                  return Column(
 | 
					                  return Column(
 | 
				
			||||||
                    children: [
 | 
					                    children: [
 | 
				
			||||||
                      ListTile(
 | 
					                      ListTile(
 | 
				
			||||||
| 
						 | 
					@ -114,8 +139,6 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                      ),
 | 
					                      ),
 | 
				
			||||||
                      if (isExpanded)
 | 
					                      if (isExpanded)
 | 
				
			||||||
                    // if(viewtypeIDs[index] == null || heightOfViewTypes[index] == null)
 | 
					 | 
				
			||||||
                    //   const SizedBox(height: 100, child: Center(child: CircularProgressIndicator())),
 | 
					 | 
				
			||||||
                        SizedBox(
 | 
					                        SizedBox(
 | 
				
			||||||
                          height: heightOfViewTypes[index].toDouble(),
 | 
					                          height: heightOfViewTypes[index].toDouble(),
 | 
				
			||||||
                          child: HtmlElementView(
 | 
					                          child: HtmlElementView(
 | 
				
			||||||
| 
						 | 
					@ -127,6 +150,7 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              ),
 | 
					              ),
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
    ]): const Center(child:CircularProgressIndicator());
 | 
					          ])
 | 
				
			||||||
 | 
					        : const Center(child: CircularProgressIndicator());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue