refactored the emailView
This commit is contained in:
		
							parent
							
								
									ceadc0b73d
								
							
						
					
					
						commit
						6feb357a39
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
					@ -5,7 +5,7 @@ import 'structs.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class EmailListScreen extends StatelessWidget {
 | 
					class EmailListScreen extends StatelessWidget {
 | 
				
			||||||
  final List<GetThreadResponse> emails;
 | 
					  final List<GetThreadResponse> emails;
 | 
				
			||||||
  final Future<String> Function(List<String>, String) getEmailContent;
 | 
					  final Future<List<String>> Function(List<String>, String) getEmailContent;
 | 
				
			||||||
  final String folder;
 | 
					  final String folder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  EmailListScreen(
 | 
					  EmailListScreen(
 | 
				
			||||||
| 
						 | 
					@ -29,11 +29,14 @@ class EmailListScreen extends StatelessWidget {
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            trailing: Text(email.date.toString()),
 | 
					            trailing: Text(email.date.toString()),
 | 
				
			||||||
            onTap: () async {
 | 
					            onTap: () async {
 | 
				
			||||||
              String emailContent =
 | 
					              List<String> emailContent = //  list of the html
 | 
				
			||||||
                  await getEmailContent(email.messages, folder);
 | 
					                  await getEmailContent(email.messages, folder);
 | 
				
			||||||
 | 
					              List<String> emailIds = email.messages;
 | 
				
			||||||
 | 
					              
 | 
				
			||||||
 | 
					              print(email.messages);  //email ids of the thread
 | 
				
			||||||
              Navigator.push(
 | 
					              Navigator.push(
 | 
				
			||||||
                context,
 | 
					                context,
 | 
				
			||||||
                MaterialPageRoute(
 | 
					                MaterialPageRoute(  // could call collapsable and inside collable each calls email view?
 | 
				
			||||||
                  builder: (context) => EmailView(
 | 
					                  builder: (context) => EmailView(
 | 
				
			||||||
                    emailContent: emailContent,
 | 
					                    emailContent: emailContent,
 | 
				
			||||||
                    from: email.from_address,
 | 
					                    from: email.from_address,
 | 
				
			||||||
| 
						 | 
					@ -42,6 +45,7 @@ class EmailListScreen extends StatelessWidget {
 | 
				
			||||||
                    subject: email.subject,
 | 
					                    subject: email.subject,
 | 
				
			||||||
                    date: email.date.toString(),
 | 
					                    date: email.date.toString(),
 | 
				
			||||||
                    id: email.id.toString(), //i think this is thread id?
 | 
					                    id: email.id.toString(), //i think this is thread id?
 | 
				
			||||||
 | 
					                    messages: email.messages,
 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
              );
 | 
					              );
 | 
				
			||||||
| 
						 | 
					@ -91,8 +95,6 @@ class EmailPageState extends State<EmailPage> {
 | 
				
			||||||
    _fetchEmails();
 | 
					    _fetchEmails();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // String getPage() =>  widget.page.toString();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  void updatePagenation(String option) {
 | 
					  void updatePagenation(String option) {
 | 
				
			||||||
    if (option == "next") {
 | 
					    if (option == "next") {
 | 
				
			||||||
      setState(() {
 | 
					      setState(() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue