|
@@ -1,8 +1,9 @@
|
|
// import 'package:crab_ui/email.dart';
|
|
// import 'package:crab_ui/email.dart';
|
|
|
|
+import 'package:crab_ui/folder_drawer.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 'api_service.dart';
|
|
|
|
import 'dart:html' as html;
|
|
import 'dart:html' as html;
|
|
import 'dart:ui_web' as ui;
|
|
import 'dart:ui_web' as ui;
|
|
|
|
|
|
@@ -13,8 +14,9 @@ class HomeScreen extends StatefulWidget {
|
|
|
|
|
|
//TODO: ADD ALL THE DIFF FOLDERS TO THE SIDEBAR
|
|
//TODO: ADD ALL THE DIFF FOLDERS TO THE SIDEBAR
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
- final _emailPageState = EmailPageState();
|
|
|
|
|
|
+ // final _emailPageState = EmailPageState();
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
+ ApiService apiService = ApiService();
|
|
|
|
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
@@ -26,6 +28,16 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
// List<Widget> drawerItems = await EmailPageState.getDrawerItems(context);
|
|
// List<Widget> drawerItems = await EmailPageState.getDrawerItems(context);
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
+ // Method to handle what happens when a folder is tapped
|
|
|
|
+ void _onFolderSelected(String folder) async {
|
|
|
|
+ // Fetch emails from the selected folder using the ApiService
|
|
|
|
+ // List fetchedEmails = await apiService.fetchEmailsFromFolder(folder);
|
|
|
|
+ // setState(() {
|
|
|
|
+ // emails = fetchedEmails; // Update the email list
|
|
|
|
+ // });
|
|
|
|
+ print(folder);
|
|
|
|
+ }
|
|
|
|
+
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
final List<String> emails = [
|
|
final List<String> emails = [
|
|
@@ -37,16 +49,11 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
];
|
|
];
|
|
return Scaffold(
|
|
return Scaffold(
|
|
key: _scaffoldKey,
|
|
key: _scaffoldKey,
|
|
- drawer: Drawer(
|
|
|
|
- child: Scaffold(
|
|
|
|
- appBar: AppBar(
|
|
|
|
- title: Text('somet'),
|
|
|
|
- ),
|
|
|
|
- body: Center(
|
|
|
|
- child: Text('center'),
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
|
|
+ drawer: FolderDrawer(
|
|
|
|
+ apiService: apiService,
|
|
|
|
+ onFolderTap: _onFolderSelected,
|
|
),
|
|
),
|
|
|
|
+
|
|
body: Stack(
|
|
body: Stack(
|
|
children: [
|
|
children: [
|
|
Row(
|
|
Row(
|
|
@@ -71,6 +78,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
// Navigate to Settings
|
|
// Navigate to Settings
|
|
},
|
|
},
|
|
),
|
|
),
|
|
|
|
+ // EmailPage(),
|
|
// GestureDetector(
|
|
// GestureDetector(
|
|
|
|
|
|
// // onTapDown: (TapDownDetails details) {
|
|
// // onTapDown: (TapDownDetails details) {
|
|
@@ -111,20 +119,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
leading: Icon(Icons.email),
|
|
leading: Icon(Icons.email),
|
|
onTap: () {
|
|
onTap: () {
|
|
_scaffoldKey.currentState?.openDrawer();
|
|
_scaffoldKey.currentState?.openDrawer();
|
|
- // showModalBottomSheet(
|
|
|
|
- // context: context,
|
|
|
|
- // builder: (context) {
|
|
|
|
- // return Scaffold(
|
|
|
|
- // appBar: AppBar(
|
|
|
|
- // title: Text('AppBar-Like Modal'),
|
|
|
|
- // backgroundColor: Colors.purple,
|
|
|
|
- // ),
|
|
|
|
- // body: Center(
|
|
|
|
- // child: Text('This is the content inside the AppBar-like modal'),
|
|
|
|
- // ),
|
|
|
|
- // );
|
|
|
|
- // },
|
|
|
|
- // );
|
|
|
|
},
|
|
},
|
|
),
|
|
),
|
|
|
|
|
|
@@ -257,13 +251,12 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
Container(
|
|
Container(
|
|
child: Text('hiiiiiii'),
|
|
child: Text('hiiiiiii'),
|
|
),
|
|
),
|
|
|
|
+
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
Expanded(
|
|
- child: Center(
|
|
|
|
- child: EmailPage(),
|
|
|
|
- ),
|
|
|
|
|
|
+ child: EmailPage(selectedFolder: "INBOX",),
|
|
)
|
|
)
|
|
],
|
|
],
|
|
),
|
|
),
|