WIP: android/ios-adaption feature, markdown, and augment #6

Draft
Juan wants to merge 35 commits from android-adaption into main
Showing only changes of commit 072f8274c0 - Show all commits

View File

@ -229,6 +229,7 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
if (!_isLoaded) { if (!_isLoaded) {
return const Center(child: CircularProgressIndicator()); // loading screen return const Center(child: CircularProgressIndicator()); // loading screen
} }
// final List<AugmentTree> nodesToDisplay;
final AugmentTree final AugmentTree
currentZoomNodeForThisEmail = //each index is an email in the thread currentZoomNodeForThisEmail = //each index is an email in the thread
@ -237,77 +238,75 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
print(currentZoomNodeForThisEmail.children); print(currentZoomNodeForThisEmail.children);
print(currentZoomNodeForThisEmail.parent); print(currentZoomNodeForThisEmail.parent);
// if (_isFilteringActive) {
// nodesToDisplay = queryResults;
// } else {
// nodesToDisplay = currentZoomNodeForThisEmail.children;
// }
final canZoomOut = currentZoomNodeForThisEmail.parent != null; final canZoomOut = currentZoomNodeForThisEmail.parent != null;
if (currentZoomNodeForThisEmail.children.isEmpty) {
if (_isFilteringActive) {
return ListView.builder( return ListView.builder(
itemCount: 1, itemCount: queryResults.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final childNode = currentZoomNodeForThisEmail; AugmentTree childNode = queryResults[index];
// final childNode = currentZoomNodeForThisEmail.children[index]; return Padding(
final canZoomIn = childNode.children.isNotEmpty; padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
// currentZoomNodeForThisEmail.addNumbering(); child: Material(
return Padding( elevation: 1,
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 6.0), borderRadius: BorderRadius.circular(12),
child: Material( color: Theme.of(context).colorScheme.surface,
elevation: 1, surfaceTintColor: Theme.of(context).colorScheme.surfaceBright,
borderRadius: BorderRadius.circular(12), child: Padding(
color: Theme.of(context).colorScheme.surface, padding: const EdgeInsets.all(16.0),
surfaceTintColor: Theme.of(context).colorScheme.surfaceBright, child: Row(
child: Padding( crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsets.all(16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
spacing: 4.0,
children: [ children: [
OutlinedButton( Wrap(
onPressed: spacing: 4.0,
canZoomOut ? () => _goToParent(indexThread) : null, children: [
child: Icon(Icons.north_west_sharp), OutlinedButton(
onPressed: null,
child: Icon(Icons.north_west_sharp),
),
OutlinedButton(
onPressed: null,
child: Icon(Icons.south_east_sharp),
),
],
), ),
OutlinedButton( SizedBox(width: 12.0),
onPressed: canZoomIn if (leftNumbering)
? () => _goToChildren(indexThread, index) Padding(
: null, padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
child: Icon(Icons.south_east_sharp), child: Text(
childNode.numbering,
style:
TextStyle(color: Color(Colors.purple[400]!.value)),
),
),
Expanded(
child: MarkdownBlock(
data: childNode.data,
config: MarkdownConfig
.darkConfig, // or lightConfig depending on theme
),
), ),
if (rightNumbering)
Padding(
padding: const EdgeInsets.fromLTRB(5, 10, 5, 0),
child: Text(
childNode.numbering,
style:
TextStyle(color: Color(Colors.purple[400]!.value)),
),
),
], ],
), ),
SizedBox(width: 12.0), ),
if (leftNumbering)
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
child: Text(
childNode.numbering,
style:
TextStyle(color: Color(Colors.purple[400]!.value)),
),
),
Expanded(
child: MarkdownBlock(
data: childNode.data,
config: MarkdownConfig
.darkConfig, // or lightConfig depending on theme
),
),
if (rightNumbering)
Padding(
padding: const EdgeInsets.fromLTRB(5, 10, 5, 0),
child: Text(
childNode.numbering,
style:
TextStyle(color: Color(Colors.purple[400]!.value)),
),
),
],
), ),
), );
), });
);
},
);
} }
return ListView.builder( return ListView.builder(
@ -315,7 +314,6 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final childNode = currentZoomNodeForThisEmail.children[index]; final childNode = currentZoomNodeForThisEmail.children[index];
final canZoomIn = childNode.children.isNotEmpty; final canZoomIn = childNode.children.isNotEmpty;
// currentZoomNodeForThisEmail.addNumbering();
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 6.0), padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 6.0),
child: Material( child: Material(
@ -479,8 +477,10 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
} }
if (results.isNotEmpty) { if (results.isNotEmpty) {
setState(() { setState(() {
currentZoomTree[targetEmailIndex] = results.first; // Update the state queryResults = results;
// currentZoomTree[targetEmailIndex] = results.first; // Update the state
_isFilteringActive = true; _isFilteringActive = true;
currentZoomTree[targetEmailIndex] = root;
}); });
print(currentZoomTree); print(currentZoomTree);
} }