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> {
141
141
_controller.value = _controller.value.copyWith(
142
142
text: text,
143
143
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) ,
146
146
),
147
147
);
148
148
}
Original file line number Diff line number Diff line change @@ -231,6 +231,14 @@ void testInput<S>(TestBuilder builder) {
231
231
expect(tester.state(find.byType(S)), hasValue(21));
232
232
expect(find.editableText, hasNoSelection);
233
233
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'));
234
242
});
235
243
236
244
testWidgets('submit', (tester) async {
You can’t perform that action at this time.
0 commit comments