diff --git a/lib/src/answer_format/scale_answer_format.dart b/lib/src/answer_format/scale_answer_format.dart index eff60f38..df532537 100644 --- a/lib/src/answer_format/scale_answer_format.dart +++ b/lib/src/answer_format/scale_answer_format.dart @@ -11,6 +11,7 @@ class ScaleAnswerFormat implements AnswerFormat { final double step; final String maximumValueDescription; final String minimumValueDescription; + final bool showValue; const ScaleAnswerFormat({ required this.maximumValue, @@ -19,6 +20,7 @@ class ScaleAnswerFormat implements AnswerFormat { required this.step, this.maximumValueDescription = '', this.minimumValueDescription = '', + this.showValue = true, }) : super(); factory ScaleAnswerFormat.fromJson(Map json) => diff --git a/lib/src/answer_format/scale_answer_format.g.dart b/lib/src/answer_format/scale_answer_format.g.dart index 7a2e1c99..8d19ef33 100644 --- a/lib/src/answer_format/scale_answer_format.g.dart +++ b/lib/src/answer_format/scale_answer_format.g.dart @@ -14,6 +14,7 @@ ScaleAnswerFormat _$ScaleAnswerFormatFromJson(Map json) => step: (json['step'] as num).toDouble(), maximumValueDescription: json['maximumValueDescription'] as String? ?? '', minimumValueDescription: json['minimumValueDescription'] as String? ?? '', + showValue: json['showValue'] as bool? ?? true, ); Map _$ScaleAnswerFormatToJson(ScaleAnswerFormat instance) => @@ -24,4 +25,5 @@ Map _$ScaleAnswerFormatToJson(ScaleAnswerFormat instance) => 'step': instance.step, 'maximumValueDescription': instance.maximumValueDescription, 'minimumValueDescription': instance.minimumValueDescription, + 'showValue': instance.showValue, }; diff --git a/lib/src/views/scale_answer_view.dart b/lib/src/views/scale_answer_view.dart index 0e1ce8f2..701b94da 100644 --- a/lib/src/views/scale_answer_view.dart +++ b/lib/src/views/scale_answer_view.dart @@ -66,30 +66,47 @@ class _ScaleAnswerViewState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.all(14.0), - child: Text( - _sliderValue.toInt().toString(), - style: Theme.of(context).textTheme.headlineSmall, + if (_scaleAnswerFormat.showValue) + Padding( + padding: const EdgeInsets.all(14.0), + child: Text( + _sliderValue.toInt().toString(), + style: Theme.of(context).textTheme.headlineSmall, + ), ), - ), Column( children: [ Padding( - padding: const EdgeInsets.symmetric(horizontal: 32.0), + padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( - _scaleAnswerFormat.minimumValueDescription, - style: TextStyle( - fontSize: 16.0, + Expanded( + child: Text( + _scaleAnswerFormat.minimumValueDescription, + style: TextStyle( + fontSize: 16.0, + ), + maxLines: 6, + overflow: TextOverflow.ellipsis, + textDirection: TextDirection.ltr, + textAlign: TextAlign.start, ), ), - Text( - _scaleAnswerFormat.maximumValueDescription, - style: TextStyle( - fontSize: 16.0, + SizedBox( + width: 32.0, + ), + Expanded( + child: Text( + _scaleAnswerFormat.maximumValueDescription, + style: TextStyle( + fontSize: 16.0, + ), + maxLines: 6, + overflow: TextOverflow.ellipsis, + textDirection: TextDirection.ltr, + textAlign: TextAlign.end, ), ), ],