Selaa lähdekoodia

Caption: increase counter threshold

Neeraj Gupta 2 vuotta sitten
vanhempi
commit
1a8a48567b
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      lib/ui/viewer/file/file_caption_widget.dart

+ 4 - 1
lib/ui/viewer/file/file_caption_widget.dart

@@ -14,6 +14,9 @@ class FileCaptionWidget extends StatefulWidget {
 
 class _FileCaptionWidgetState extends State<FileCaptionWidget> {
   static const int maxLength = 5000;
+  // counterThreshold represents the nun of char after which
+  // currentLength/maxLength will show up
+  static const int counterThreshold = 1000;
   int currentLength = 0;
   final _textController = TextEditingController();
   final _focusNode = FocusNode();
@@ -60,7 +63,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
       focusNode: _focusNode,
       decoration: InputDecoration(
         counterStyle: textTheme.mini.copyWith(color: colorScheme.textMuted),
-        counterText: currentLength > 99
+        counterText: currentLength >= counterThreshold
             ? currentLength.toString() + " / " + maxLength.toString()
             : "",
         contentPadding: const EdgeInsets.all(16),