File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,8 @@ mixin SpinBoxMixin<T extends BaseSpinBox> on State<T> {
141141 _controller.value = _controller.value.copyWith (
142142 text: text,
143143 selection: selection.copyWith (
144- baseOffset: selection.baseOffset - oldOffset + newOffset,
145- extentOffset: selection.extentOffset - oldOffset + newOffset,
144+ baseOffset: ( selection.baseOffset - oldOffset + newOffset). clamp ( 0 , text.length) ,
145+ extentOffset: ( selection.extentOffset - oldOffset + newOffset). clamp ( 0 , text.length) ,
146146 ),
147147 );
148148 }
Original file line number Diff line number Diff line change @@ -231,6 +231,14 @@ void testInput<S>(TestBuilder builder) {
231231 expect (tester.state (find.byType (S )), hasValue (21 ));
232232 expect (find.editableText, hasNoSelection);
233233 expect (find.editableText, hasText ('21' ));
234+
235+ tester.testTextInput.enterText ('000' );
236+ await tester.idle ();
237+ await tester.tap (find.byIcon (TestIcons .increment));
238+ await tester.pumpAndSettle ();
239+ expect (tester.state (find.byType (S )), hasValue (1 ));
240+ expect (find.editableText, hasNoSelection);
241+ expect (find.editableText, hasText ('1' ));
234242 });
235243
236244 testWidgets ('submit' , (tester) async {
You can’t perform that action at this time.
0 commit comments