Browse Source

Caption: increase counter threshold

Neeraj Gupta 2 năm trước cách đây
mục cha
commit
1a8a48567b

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

@@ -14,6 +14,9 @@ class FileCaptionWidget extends StatefulWidget {
 
 
 class _FileCaptionWidgetState extends State<FileCaptionWidget> {
 class _FileCaptionWidgetState extends State<FileCaptionWidget> {
   static const int maxLength = 5000;
   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;
   int currentLength = 0;
   final _textController = TextEditingController();
   final _textController = TextEditingController();
   final _focusNode = FocusNode();
   final _focusNode = FocusNode();
@@ -60,7 +63,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
       focusNode: _focusNode,
       focusNode: _focusNode,
       decoration: InputDecoration(
       decoration: InputDecoration(
         counterStyle: textTheme.mini.copyWith(color: colorScheme.textMuted),
         counterStyle: textTheme.mini.copyWith(color: colorScheme.textMuted),
-        counterText: currentLength > 99
+        counterText: currentLength >= counterThreshold
             ? currentLength.toString() + " / " + maxLength.toString()
             ? currentLength.toString() + " / " + maxLength.toString()
             : "",
             : "",
         contentPadding: const EdgeInsets.all(16),
         contentPadding: const EdgeInsets.all(16),