TF-3643 Thread Detail get emails meta data method

TF-3643 Thread Detail cache email with thread id

TF-3643 Thread Detail view thread detail

TF-3643 Thread Detail [Part 2 fixup] remove ThreadDetailController dependency from MailboxDashboardController

TF-3643 Thread Detail [Part 2 fixup] remove EmailSupervisorController dependency from ThreadDetailController

TF-3643 Thread Detail [Part 2 fixup] move isSearchRunning check into ThreadDetailController

TF-3643 Thread Detail [Part 2 fixup] ensure GetEmailsByIdsInteractor performance

TF-3643 Thread Detail [Part 2 fixup] unit test loadMoreThreadDetailEmails

TF-3643 Thread Detail [Part 2 fixup] unit test getEmailIdsToLoad

TF-3643 Thread Detail [Part 2 fixup] optimize ThreadDetailBinding bindingsDataSource

TF-3643 Thread Detail [Part 2 fixup] optimize getThreadDetailLoadingView

TF-3643 Thread Detail [Part 2 fixup] readd unique ValueKey for HtmlContentViewerOnWebWidget

TF-3643 Thread Detail [Part 2 fixup] unit test initializeThreadDetailEmails

TF-3643 Thread Detail [Part 3 fixup] Update private action button methods

TF-3643 Thread Detail [Part 4 fixup] Collapsed email preview 65 characters max

TF-3643 Thread Detail [Part 4 fixup] Remove personal scripts

TF-3643 Thread Detail move EmailInThreadStatus into PresentationEmail

TF-3643 Thread Detail refactor toggle collapse expand

TF-3643 Thread Detail EmailViewAppBarWidget required parameters

TF-3643 Thread Detail tap avatar toggle expansion

TF-3643 Thread Detail fix cannot open single email

TF-3643 Thread Detail fix open thread first time blank view

TF-3643 Thread Detail fix thread detail UI

TF-3643 Thread Detail fix round bottom view

TF-3643 Thread Detail fix round bottom view

TF-3643 Thread Detail bottom actions depend on current expanded email

TF-3643 Thread Detail hide next previous actions

TF-3643 Thread Detail fix load more show initial loading view

TF-3643 Thread Detail fix cannot view single email

TF-3643 Thread Detail fix bottom place holder not aligned

TF-3643 Thread Detail fix back to search view

TF-3643 Thread Detail fix display 65 character preview collapsed email

TF-3643 Thread Detail fix search not work

TF-3643 Thread Detail fix bottom place holder UI

TF-3643 Thread Detail fix expand view

TF-3643 Thread Detail jump to top of last email view

TF-3643 Thread Detail remove toMe condition of filtering thread

TF-3643 Thread Detail fix sort thread detail

TF-3643 Thread Detail fix assert not work in release

TF-3643 Thread Detail add load more test case <20

TF-3643 Thread Detail remove the use of currentThreadId

TF-3643 Thread Detail remove the use of selectedEmail in SingleEmailController

TF-3643 Thread Detail fix unit test SingleEmailController calendar

TF-3643 Thread Detail disable 2 way scroll control

TF-3643 Thread Detail allow thread to load sent email incase thread only contains 1 email

TF-3643 Thread Detail disable single email page view

TF-3643 Thread Detail update emailsNotLoadedCount name

TF-3643 Thread Detail remove collapsed email char limit

TF-3643 Thread Detail fix CI

TF-3643 Thread Detail unit test handleGetEmailIdsByThreadIdSuccess

TF-3643 Thread Detail make _currentEmailId private

TF-3643 Thread Detail fix search click users

TF-3643 Thread Detail fix scroll jump

TF-3643 Thread Detail fix scroll jump

TF-3643 Thread Detail fix web back action

TF-3643 Thread Detail round bottom actions

TF-3643 Thread Detail fix tablet large empty email

TF-3643 Thread Detail fix email subject selectable

TF-3643 Thread Detail fix email single view with top divider

TF-3643 Thread Detail fix email cache threadId missing

TF-3643 Thread Detail fix filter sent email in thread details

TF-3643 Thread Detail fix select text

TF-3643 Thread Detail fix subject alignment

TF-3643 Thread Detail fix subject alignment

TF-3643 Thread Detail fix tablet large empty email

TF-3643 Thread Detail add nullcheck for _jumpScrollViewToTopOfEmail

TF-3643 Thread Detail decouple ThreadDetailController from SingleEmailController

TF-3643 Thread Detail combine emailIds to emailIdsPresentation

TF-3643 Thread Detail remove currentEmailLoaded obx listener of SingleEmailController

TF-3643 Thread Detail replace threadAction with an email ui action

TF-3643 Thread Detail fix top and bottom bar delay displaying

TF-3643 Thread Detail update ReplyForwardBottomBarAction to PerformEmailActionInThreadDetailAction

TF-3643 Thread Detail use getOwnEmailAddress in ThreadDetailAppBar

TF-3643 Thread Detail add TextOverflow.ellipsis to EmailSubjectWidget

TF-3643 Thread Detail fix round border threadDetailLoadingView
This commit is contained in:
DatDang
2025-05-12 15:22:29 +07:00
committed by Dat H. Pham
parent 7c3af832e4
commit 58a576adeb
84 changed files with 2845 additions and 558 deletions
@@ -245,6 +245,7 @@ extension AppColor on Color {
static const blue400 = Color(0xFF80BDFF);
static const blue900 = Color(0xFF0F76E7);
static const m3Tertiary = Color(0xFF8C9CAF);
static const lightIconTertiary = Color(0xFFB8C1CC);
static const m3Neutral70 = Color(0xFFAEAAAE);
static const m3Neutral90 = Color(0xFFE6E1E5);
static const grayBackgroundColor = Color(0xFFF3F6F9);
@@ -20,4 +20,21 @@ extension ListExtensions<T> on List<T> {
int countOccurrences(T value) {
return where((element) => element == value).length;
}
List<List<T>> chunks(int chunkSize) {
if (chunkSize <= 0) {
throw ArgumentError('Chunk size must be greater than 0', 'chunkSize');
}
if (isEmpty) {
return [];
}
final result = <List<T>>[];
final totalChunks = (length / chunkSize).ceil();
for (var i = 0; i < totalChunks; i++) {
final start = i * chunkSize;
final end = (start + chunkSize).clamp(0, length);
result.add(sublist(start, end));
}
return result;
}
}
@@ -236,6 +236,7 @@ class ImagePaths {
String get icTwakeWorkplace => _getIconPath('icon_twp.png');
String get animLottieTmail => _getAnimationPath('lottie-tmail.json');
String get icExpandArrows => _getImagePath('ic_expand_arrows.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
@@ -193,6 +193,11 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
}
}
}
const resizeObserver = new ResizeObserver((entries) => {
var height = document.body.scrollHeight;
window.parent.postMessage(JSON.stringify({"view": "$_createdViewId", "type": "toDart: htmlHeight", "height": height}), "*");
});
${widget.mailtoDelegate != null
? '''
@@ -238,6 +243,8 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
}
'''
: ''}
resizeObserver.observe(document.body);
}
</script>
''';
@@ -303,7 +310,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraint) {
minHeight = math.max(constraint.maxHeight, minHeight);
minHeight = math.min(constraint.maxHeight, minHeight);
final child = Stack(
children: [
if (_htmlData?.isNotEmpty == false)
@@ -317,7 +324,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
height: _actualHeight,
width: _actualWidth,
child: HtmlElementView(
key: ValueKey(_htmlData),
key: ValueKey('$_htmlData-${widget.key}'),
viewType: _createdViewId,
),
);
@@ -32,6 +32,7 @@ class HtmlContentViewer extends StatefulWidget {
final double? maxHtmlContentHeight;
final double minHtmlContentHeight;
final double offsetHtmlContentHeight;
final bool keepAlive;
final OnLoadWidthHtmlViewerAction? onLoadWidthHtmlViewer;
final OnMailtoDelegateAction? onMailtoDelegateAction;
@@ -47,6 +48,7 @@ class HtmlContentViewer extends StatefulWidget {
this.direction,
this.minHtmlContentHeight = ConstantsUI.htmlContentMinHeight,
this.offsetHtmlContentHeight = ConstantsUI.htmlContentOffsetHeight,
this.keepAlive = false,
this.keepWidthWhileLoading = false,
this.contentPadding,
this.useDefaultFont = false,
@@ -63,7 +65,7 @@ class HtmlContentViewer extends StatefulWidget {
State<StatefulWidget> createState() => HtmlContentViewState();
}
class HtmlContentViewState extends State<HtmlContentViewer> {
class HtmlContentViewState extends State<HtmlContentViewer> with AutomaticKeepAliveClientMixin {
late InAppWebViewController _webViewController;
late double _actualHeight;
@@ -130,6 +132,7 @@ class HtmlContentViewState extends State<HtmlContentViewer> {
@override
Widget build(BuildContext context) {
super.build(context);
final child = Stack(children: [
if (_htmlData == null)
const SizedBox.shrink()
@@ -352,4 +355,7 @@ class HtmlContentViewState extends State<HtmlContentViewer> {
_htmlData = null;
super.dispose();
}
@override
bool get wantKeepAlive => widget.keepAlive;
}
@@ -0,0 +1,137 @@
import 'package:core/presentation/extensions/list_extensions.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('list extensions test:', () {
group('chunks test:', () {
test('should return evenly sized chunks when length is divisible by chunkSize', () {
// Arrange
final sourceList = [1, 2, 3, 4, 5, 6];
const chunkSize = 3;
final expectedOutput = [
[1, 2, 3],
[4, 5, 6]
];
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, equals(expectedOutput));
});
test('should return chunks with the last chunk smaller when length is not divisible', () {
// Arrange
final sourceList = [1, 2, 3, 4, 5];
const chunkSize = 3;
final expectedOutput = [
[1, 2, 3],
[4, 5]
];
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, equals(expectedOutput));
});
test('should return chunks of size 1 when chunkSize is 1', () {
// Arrange
final sourceList = [1, 2, 3];
const chunkSize = 1;
final expectedOutput = [
[1],
[2],
[3]
];
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, equals(expectedOutput));
});
test('should return a single chunk when chunkSize equals list length', () {
// Arrange
final sourceList = [1, 2, 3, 4];
const chunkSize = 4;
final expectedOutput = [
[1, 2, 3, 4]
];
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, equals(expectedOutput));
});
test('should return a single chunk when chunkSize is greater than list length', () {
// Arrange
final sourceList = [1, 2, 3];
const chunkSize = 5;
final expectedOutput = [
[1, 2, 3]
];
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, equals(expectedOutput));
});
test('should return an empty list when the source list is empty', () {
// Arrange
final sourceList = <int>[]; // Explicitly typed empty list
const chunkSize = 3;
final expectedOutput = <List<int>>[]; // Expected empty list of lists
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, isEmpty); // Check if it's empty
expect(result, equals(expectedOutput)); // Also check for structural equality
});
test('should work with different list types (e.g., String)', () {
// Arrange
final sourceList = ['a', 'b', 'c', 'd', 'e'];
const chunkSize = 2;
final expectedOutput = [
['a', 'b'],
['c', 'd'],
['e']
];
// Act
final result = sourceList.chunks(chunkSize);
// Assert
expect(result, equals(expectedOutput));
});
test('should throw ArgumentError when chunkSize is 0', () {
// Arrange
final sourceList = [1, 2, 3];
const chunkSize = 0;
// Act & Assert
// We wrap the call that is expected to throw in a zero-argument function.
expect(() => sourceList.chunks(chunkSize), throwsArgumentError);
});
test('should throw ArgumentError when chunkSize is negative', () {
// Arrange
final sourceList = [1, 2, 3];
const chunkSize = -1;
// Act & Assert
expect(() => sourceList.chunks(chunkSize), throwsArgumentError);
});
});
});
}