From 9669d3659c9993b5012d0b89387d0cccdce04c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Ho=C3=A0ng=20Sang?= Date: Fri, 25 Aug 2023 15:50:39 +0700 Subject: [PATCH] Update logic --- lib/src/widgets/text_block.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/src/widgets/text_block.dart b/lib/src/widgets/text_block.dart index c1e623b7..16bebeec 100644 --- a/lib/src/widgets/text_block.dart +++ b/lib/src/widgets/text_block.dart @@ -169,15 +169,16 @@ class EditableTextBlock extends StatelessWidget { } double _numberPointWidth(double fontSize, int count) { - switch ('$count'.length) { + final length = '$count'.length; + switch (length) { + case 1: case 2: return fontSize * 2; - case 3: - return fontSize * 2.5; - case 4: - return fontSize * 3; default: - return fontSize; + // 3 -> 2.5 + // 4 -> 3 + // 5 -> 3.5 + return fontSize * (length - (length - 2) / 2); } }