瀏覽代碼

[mob][photos] band aid fix for word gettng cut to next line in SelectionActionButton (#1607)

Ashil 1 年之前
父節點
當前提交
b45262c75b
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      mobile/lib/ui/components/bottom_action_bar/selection_action_button_widget.dart

+ 4 - 3
mobile/lib/ui/components/bottom_action_bar/selection_action_button_widget.dart

@@ -132,14 +132,15 @@ class __BodyState extends State<_Body> {
     return maxWidth;
   }
 
+//Todo: this doesn't give the correct width of the word, make it right
   double computeWidthOfWord(String text, TextStyle style) {
     final textPainter = TextPainter(
       text: TextSpan(text: text, style: style),
       maxLines: 1,
       textDirection: TextDirection.ltr,
-      textScaleFactor: MediaQuery.of(context).textScaleFactor,
+      textScaler: MediaQuery.textScalerOf(context),
     )..layout();
-
-    return textPainter.size.width;
+//buffer of 8 added as width is shorter than actual text width
+    return textPainter.size.width + 8;
   }
 }