TF-4171 Display tag in mailbox list

This commit is contained in:
dab246
2025-11-25 14:02:50 +07:00
committed by Dat H. Pham
parent f4302e06e8
commit 31ed2feae4
19 changed files with 1865 additions and 38 deletions
+33
View File
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
class WidgetUtils {
WidgetUtils._();
static double measureTextWidth({
required String text,
double fallbackWidth = 0,
TextStyle? style,
Locale? locale,
double? horizontalPadding,
}) {
try {
final textPainter = TextPainter(
text: TextSpan(
text: text,
style: style,
locale: locale,
),
maxLines: 1,
textDirection: TextDirection.ltr,
)..layout();
if (horizontalPadding != null) {
return textPainter.width + horizontalPadding * 2;
} else {
return textPainter.width;
}
} catch (e) {
return fallbackWidth;
}
}
}