add the compose widget to sidebar
This commit is contained in:
		
							parent
							
								
									214a60ce1b
								
							
						
					
					
						commit
						c025fbe07a
					
				
					 1 changed files with 75 additions and 61 deletions
				
			
		| 
						 | 
					@ -5,6 +5,7 @@ import 'structs.dart';
 | 
				
			||||||
import 'api_service.dart';
 | 
					import 'api_service.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
import 'email.dart';
 | 
					import 'email.dart';
 | 
				
			||||||
 | 
					import 'Compose.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class HomeScreen extends StatefulWidget {
 | 
					class HomeScreen extends StatefulWidget {
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
| 
						 | 
					@ -65,7 +66,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                      setState(() {
 | 
					                      setState(() {
 | 
				
			||||||
                        _selectedOption = value;
 | 
					                        _selectedOption = value;
 | 
				
			||||||
                      });
 | 
					                      });
 | 
				
			||||||
                    Navigator.of(context).pop(); // Close the dialog on selection
 | 
					                      Navigator.of(context)
 | 
				
			||||||
 | 
					                          .pop(); // Close the dialog on selection
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
| 
						 | 
					@ -84,9 +86,9 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    );}
 | 
					      );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Remove a tab
 | 
					  // Remove a tab
 | 
				
			||||||
  void _removeTab(int index) {
 | 
					  void _removeTab(int index) {
 | 
				
			||||||
| 
						 | 
					@ -135,24 +137,21 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                    //call the foldable
 | 
					                    //call the foldable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    List<String> emailContent = //  list of the html
 | 
					                    List<String> emailContent = //  list of the html
 | 
				
			||||||
                      await apiService.fetchEmailContent([email.id], email.list);
 | 
					                        await apiService
 | 
				
			||||||
 | 
					                            .fetchEmailContent([email.id], email.list);
 | 
				
			||||||
                    // List<String> emailIds = email.messages;
 | 
					                    // List<String> emailIds = email.messages;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    
 | 
					 | 
				
			||||||
                    Navigator.push(
 | 
					                    Navigator.push(
 | 
				
			||||||
                      context,
 | 
					                      context,
 | 
				
			||||||
                      MaterialPageRoute(
 | 
					                      MaterialPageRoute(
 | 
				
			||||||
                          builder: (context) => SonicEmailView(
 | 
					                          builder: (context) => SonicEmailView(
 | 
				
			||||||
                          email: email,
 | 
					                              email: email, emailHTML: emailContent[0])),
 | 
				
			||||||
                          emailHTML: emailContent[0])
 | 
					 | 
				
			||||||
                      ),
 | 
					 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
                  },
 | 
					                  },
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              separatorBuilder: (context, index) => Divider(),
 | 
					              separatorBuilder: (context, index) => Divider(),
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            
 | 
					 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
| 
						 | 
					@ -195,6 +194,12 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                          child: Column(
 | 
					                          child: Column(
 | 
				
			||||||
                            crossAxisAlignment: CrossAxisAlignment.start,
 | 
					                            crossAxisAlignment: CrossAxisAlignment.start,
 | 
				
			||||||
                            children: [
 | 
					                            children: [
 | 
				
			||||||
 | 
					                              ListTile(
 | 
				
			||||||
 | 
					                                  leading: Icon(Icons.edit_note_sharp),
 | 
				
			||||||
 | 
					                                  onTap: () {
 | 
				
			||||||
 | 
					                                    OverlayService()
 | 
				
			||||||
 | 
					                                        .showPersistentWidget(context);
 | 
				
			||||||
 | 
					                                  }),
 | 
				
			||||||
                              ListTile(
 | 
					                              ListTile(
 | 
				
			||||||
                                leading: Icon(Icons.home),
 | 
					                                leading: Icon(Icons.home),
 | 
				
			||||||
                                onTap: () {
 | 
					                                onTap: () {
 | 
				
			||||||
| 
						 | 
					@ -219,7 +224,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                                child: Align(
 | 
					                                child: Align(
 | 
				
			||||||
                                  alignment: Alignment.bottomLeft,
 | 
					                                  alignment: Alignment.bottomLeft,
 | 
				
			||||||
                                  child: IconButton(
 | 
					                                  child: IconButton(
 | 
				
			||||||
                                    icon: Icon(Icons.close, color: Colors.white),
 | 
					                                    icon:
 | 
				
			||||||
 | 
					                                        Icon(Icons.close, color: Colors.white),
 | 
				
			||||||
                                    onPressed: () {
 | 
					                                    onPressed: () {
 | 
				
			||||||
                                      setState(() {
 | 
					                                      setState(() {
 | 
				
			||||||
                                        _isSidebarOpen = false;
 | 
					                                        _isSidebarOpen = false;
 | 
				
			||||||
| 
						 | 
					@ -256,7 +262,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                                          ),
 | 
					                                          ),
 | 
				
			||||||
                                          onSubmitted: (value) {
 | 
					                                          onSubmitted: (value) {
 | 
				
			||||||
                                            if (value.isNotEmpty) {
 | 
					                                            if (value.isNotEmpty) {
 | 
				
			||||||
                                              _performSearch(value, _selectedOption);
 | 
					                                              _performSearch(
 | 
				
			||||||
 | 
					                                                  value, _selectedOption);
 | 
				
			||||||
                                            }
 | 
					                                            }
 | 
				
			||||||
                                            //this is the input box i mentioned
 | 
					                                            //this is the input box i mentioned
 | 
				
			||||||
                                            // if (value == '') {
 | 
					                                            // if (value == '') {
 | 
				
			||||||
| 
						 | 
					@ -314,8 +321,10 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                                              Text(entry.value),
 | 
					                                              Text(entry.value),
 | 
				
			||||||
                                              if (entry.value != 'Emails')
 | 
					                                              if (entry.value != 'Emails')
 | 
				
			||||||
                                                GestureDetector(
 | 
					                                                GestureDetector(
 | 
				
			||||||
                                                  onTap: () => _removeTab(entry.key),
 | 
					                                                  onTap: () =>
 | 
				
			||||||
                                                  child: Icon(Icons.close, size: 16),
 | 
					                                                      _removeTab(entry.key),
 | 
				
			||||||
 | 
					                                                  child: Icon(Icons.close,
 | 
				
			||||||
 | 
					                                                      size: 16),
 | 
				
			||||||
                                                ),
 | 
					                                                ),
 | 
				
			||||||
                                            ],
 | 
					                                            ],
 | 
				
			||||||
                                          ),
 | 
					                                          ),
 | 
				
			||||||
| 
						 | 
					@ -333,14 +342,17 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                                children: [
 | 
					                                children: [
 | 
				
			||||||
                                  ElevatedButton(
 | 
					                                  ElevatedButton(
 | 
				
			||||||
                                    onPressed: () {
 | 
					                                    onPressed: () {
 | 
				
			||||||
                                      _emailPageKey.currentState!.isBackDisabled ? null: _emailPageKey.currentState
 | 
					                                      _emailPageKey.currentState!.isBackDisabled
 | 
				
			||||||
 | 
					                                          ? null
 | 
				
			||||||
 | 
					                                          : _emailPageKey.currentState
 | 
				
			||||||
                                              ?.updatePagenation('back');
 | 
					                                              ?.updatePagenation('back');
 | 
				
			||||||
                                    },
 | 
					                                    },
 | 
				
			||||||
                                    child: Icon(Icons.navigate_before),
 | 
					                                    child: Icon(Icons.navigate_before),
 | 
				
			||||||
                                  ),
 | 
					                                  ),
 | 
				
			||||||
                                  Builder(
 | 
					                                  Builder(
 | 
				
			||||||
                                    builder: (context) {
 | 
					                                    builder: (context) {
 | 
				
			||||||
                                      final emailState = _emailPageKey.currentState;
 | 
					                                      final emailState =
 | 
				
			||||||
 | 
					                                          _emailPageKey.currentState;
 | 
				
			||||||
                                      if (emailState == null) {
 | 
					                                      if (emailState == null) {
 | 
				
			||||||
                                        // Schedule a rebuild once the state is available
 | 
					                                        // Schedule a rebuild once the state is available
 | 
				
			||||||
                                        Future.microtask(() => setState(() {}));
 | 
					                                        Future.microtask(() => setState(() {}));
 | 
				
			||||||
| 
						 | 
					@ -348,8 +360,10 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
 | 
				
			||||||
                                      }
 | 
					                                      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                      return ValueListenableBuilder<int>(
 | 
					                                      return ValueListenableBuilder<int>(
 | 
				
			||||||
                                        valueListenable: emailState.currentPageNotifier,
 | 
					                                        valueListenable:
 | 
				
			||||||
                                        builder: (context, value, _) => Text('$value'),
 | 
					                                            emailState.currentPageNotifier,
 | 
				
			||||||
 | 
					                                        builder: (context, value, _) =>
 | 
				
			||||||
 | 
					                                            Text('$value'),
 | 
				
			||||||
                                      );
 | 
					                                      );
 | 
				
			||||||
                                    },
 | 
					                                    },
 | 
				
			||||||
                                  ),
 | 
					                                  ),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue