WIP: android/ios-adaption feature, markdown, and augment #6
@ -148,16 +148,6 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
builder: (context) =>SonicEmailView(
|
||||
email: email,
|
||||
emailHTML: emailContent[0])
|
||||
// builder: (context) => EmailView(
|
||||
// emailContent: emailContent,
|
||||
// from: email.from,
|
||||
// name: email.name,
|
||||
// to: email.to.toString(),
|
||||
// subject: email.subject,
|
||||
// date: email.date.toString(),
|
||||
// id: email.id.toString(),
|
||||
// messages: [email.id],
|
||||
// ),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -165,28 +155,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
},
|
||||
separatorBuilder: (context, index) => Divider(),
|
||||
),
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text("Results for: $query", style: TextStyle(fontSize: 24)),
|
||||
// // Display the actual data
|
||||
// Text(result[0].name), // Accessing the first result safely
|
||||
// Text(result[0].from), // Displaying the 'from' field as an example
|
||||
// Text(result[0].hash),
|
||||
// Text(result[0].subject),
|
||||
// Text(result[0].uid.toString()),
|
||||
// Text(result[0].list),
|
||||
// Text(result[0].id),
|
||||
|
||||
// // Add more fields or customize the display
|
||||
// // SerializableEmailListScreen(emails: result, getEmailContent: getEmailContent)
|
||||
// // Expanded(
|
||||
|
||||
// // child:
|
||||
// // ),
|
||||
// ],
|
||||
|
||||
);
|
||||
// );
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -200,271 +170,248 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
drawer: FolderDrawer(
|
||||
apiService: apiService,
|
||||
onFolderTap: (folder) {
|
||||
_emailPageKey.currentState?.updateSelectedFolder(folder);
|
||||
},
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Row(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 20, 0 , 20),
|
||||
child: Scaffold(
|
||||
key: _scaffoldKey,
|
||||
drawer: FolderDrawer(
|
||||
apiService: apiService,
|
||||
onFolderTap: (folder) {
|
||||
_emailPageKey.currentState?.updateSelectedFolder(folder);
|
||||
},
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 20, 0, 0),
|
||||
child: Stack(
|
||||
children: [
|
||||
// Sidebar
|
||||
if (_isSidebarOpen)
|
||||
Container(
|
||||
width: 70,
|
||||
color: Color.fromARGB(17, 96, 122, 135),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(Icons.home),
|
||||
onTap: () {
|
||||
// Navigate to Home
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.settings),
|
||||
onTap: () {
|
||||
// Navigate to Settings
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.email),
|
||||
onTap: () {
|
||||
_scaffoldKey.currentState?.openDrawer();
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isSidebarOpen = false;
|
||||
});
|
||||
Row(
|
||||
children: [
|
||||
// Sidebar
|
||||
if (_isSidebarOpen)
|
||||
Container(
|
||||
width: 70,
|
||||
color: Color.fromARGB(17, 96, 122, 135),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(Icons.home),
|
||||
onTap: () {
|
||||
// Navigate to Home
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Main content
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 4.0),
|
||||
color: Color.fromARGB(42, 36, 102, 132),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: 800,
|
||||
ListTile(
|
||||
leading: Icon(Icons.settings),
|
||||
onTap: () {
|
||||
// Navigate to Settings
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.email),
|
||||
onTap: () {
|
||||
_scaffoldKey.currentState?.openDrawer();
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isSidebarOpen = false;
|
||||
});
|
||||
},
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search...',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.search),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Main content
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 4.0),
|
||||
color: Color.fromARGB(42, 36, 102, 132),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: 800,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search...',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.search),
|
||||
),
|
||||
onSubmitted: (value) {
|
||||
if (value.isNotEmpty) {
|
||||
_performSearch(value, _selectedOption);
|
||||
}
|
||||
//this is the input box i mentioned
|
||||
// if (value == '') {
|
||||
// setState(() {
|
||||
// querySearches = false;
|
||||
// });
|
||||
// }
|
||||
// Future<List<String>> results = apiService
|
||||
// .sonicSearch('INBOX', 20, 0, value);
|
||||
// // print(value);
|
||||
// print(results);
|
||||
// setState(() {
|
||||
// querySearches = true;
|
||||
// });
|
||||
},
|
||||
),
|
||||
),
|
||||
onSubmitted: (value) {
|
||||
if (value.isNotEmpty) {
|
||||
_performSearch(value, _selectedOption);
|
||||
}
|
||||
//this is the input box i mentioned
|
||||
// if (value == '') {
|
||||
// setState(() {
|
||||
// querySearches = false;
|
||||
// });
|
||||
// }
|
||||
// Future<List<String>> results = apiService
|
||||
// .sonicSearch('INBOX', 20, 0, value);
|
||||
// // print(value);
|
||||
// print(results);
|
||||
// setState(() {
|
||||
// querySearches = true;
|
||||
// });
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Container(
|
||||
height: 40,
|
||||
child: ElevatedButton(
|
||||
onPressed: _showOptionsSearchDialog,
|
||||
child: Icon(Icons.manage_search),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
color: Color.fromARGB(42, 36, 102, 132),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 2,
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 40,
|
||||
child: ElevatedButton(
|
||||
onPressed: _showOptionsSearchDialog,
|
||||
child: Icon(Icons.manage_search),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
color: Color.fromARGB(42, 36, 102, 132),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 2,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Color.fromARGB(255, 131, 110, 143),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
tabs: _tabs
|
||||
.asMap()
|
||||
.entries
|
||||
.map((entry) => Tab(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(entry.value),
|
||||
if (entry.value != 'Emails')
|
||||
GestureDetector(
|
||||
onTap: () => _removeTab(entry.key),
|
||||
child: Icon(Icons.close, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
labelColor: Colors.white,
|
||||
indicatorColor: Colors.white,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_emailPageKey.currentState!.isBackDisabled ? null: _emailPageKey.currentState
|
||||
?.updatePagenation('back');
|
||||
},
|
||||
child: Icon(Icons.navigate_before),
|
||||
),
|
||||
Container(
|
||||
color: Color.fromARGB(255, 131, 110, 143),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
tabs: _tabs
|
||||
.asMap()
|
||||
.entries
|
||||
.map((entry) => Tab(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(entry.value),
|
||||
if (entry.value != 'Emails')
|
||||
GestureDetector(
|
||||
onTap: () => _removeTab(entry.key),
|
||||
child: Icon(Icons.close, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
labelColor: Colors.white,
|
||||
indicatorColor: Colors.white,
|
||||
),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final emailState = _emailPageKey.currentState;
|
||||
if (emailState == null) {
|
||||
// Schedule a rebuild once the state is available
|
||||
Future.microtask(() => setState(() {}));
|
||||
return Text('Loading...');
|
||||
}
|
||||
|
||||
return ValueListenableBuilder<int>(
|
||||
valueListenable: emailState.currentPageNotifier,
|
||||
builder: (context, value, _) => Text('$value'),
|
||||
);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_emailPageKey.currentState!.isBackDisabled ? null: _emailPageKey.currentState
|
||||
?.updatePagenation('back');
|
||||
},
|
||||
child: Icon(Icons.navigate_before),
|
||||
),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final emailState = _emailPageKey.currentState;
|
||||
if (emailState == null) {
|
||||
// Schedule a rebuild once the state is available
|
||||
Future.microtask(() => setState(() {}));
|
||||
return Text('Loading...');
|
||||
}
|
||||
|
||||
return ValueListenableBuilder<int>(
|
||||
valueListenable: emailState.currentPageNotifier,
|
||||
builder: (context, value, _) => Text('$value'),
|
||||
);
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_emailPageKey.currentState
|
||||
?.updatePagenation('next');
|
||||
},
|
||||
child: Icon(Icons.navigate_next),
|
||||
),
|
||||
],
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_emailPageKey.currentState
|
||||
?.updatePagenation('next');
|
||||
},
|
||||
child: Icon(Icons.navigate_next),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _tabs.map((tab) {
|
||||
return _tabWidgets[tab] ??
|
||||
Center(child: Text("No content found"));
|
||||
// return Center(
|
||||
// child: EmailPage(
|
||||
// key: _emailPageKey,
|
||||
// ));
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// if (_tabs.isEmpty)
|
||||
// Expanded(
|
||||
// child: EmailPage(key: _emailPageKey),
|
||||
// ),
|
||||
// if (_tabs.isNotEmpty)
|
||||
// Expanded(
|
||||
// // child: Text('supposed to be mails'),
|
||||
// child: TabBarView(
|
||||
// controller: _tabController,
|
||||
// children: _tabs
|
||||
// .map((tab) => Center(child: Text('Results for $tab')))
|
||||
// .toList(),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _tabs.map((tab) {
|
||||
return _tabWidgets[tab] ??
|
||||
Center(child: Text("No content found"));
|
||||
// return Center(
|
||||
// child: EmailPage(
|
||||
// key: _emailPageKey,
|
||||
// ));
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
|
||||
// if (_tabs.isEmpty)
|
||||
// Expanded(
|
||||
// child: EmailPage(key: _emailPageKey),
|
||||
// ),
|
||||
// if (_tabs.isNotEmpty)
|
||||
// Expanded(
|
||||
// // child: Text('supposed to be mails'),
|
||||
// child: TabBarView(
|
||||
// controller: _tabController,
|
||||
// children: _tabs
|
||||
// .map((tab) => Center(child: Text('Results for $tab')))
|
||||
// .toList(),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!_isSidebarOpen)
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
child: FloatingActionButton(
|
||||
child: Icon(Icons.menu),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isSidebarOpen = true;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!_isSidebarOpen)
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
child: FloatingActionButton(
|
||||
child: Icon(Icons.menu),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isSidebarOpen = true;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// void _showPopupMenu(BuildContext context, Offset position) async {
|
||||
// final RenderBox overlay =
|
||||
// Overlay.of(context).context.findRenderObject() as RenderBox;
|
||||
|
||||
// await showMenu<String>(
|
||||
// context: context,
|
||||
// position: RelativeRect.fromLTRB(
|
||||
// position.dx,
|
||||
// position.dy,
|
||||
// overlay.size.width - position.dx,
|
||||
// overlay.size.height - position.dy,
|
||||
// ),
|
||||
// items: <PopupMenuEntry<String>>[
|
||||
// PopupMenuItem<String>(
|
||||
// value: 'Open',
|
||||
// child: Text('Open'),
|
||||
// ),
|
||||
// PopupMenuItem<String>(
|
||||
// value: 'Reply',
|
||||
// child: Text('Reply'),
|
||||
// ),
|
||||
// PopupMenuItem<String>(
|
||||
// value: 'Delete',
|
||||
// child: Text('Delete'),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user