Skip to content

Commit

Permalink
resolve issues #108 and duplicate #105 (#109)
Browse files Browse the repository at this point in the history
* resolve issues #986, duplicate #1021, maybe others. TextInputClient added breaking change requiring three new overrides. empty implementation provided here to stop errors. See https://docs.flutter.dev/release/breaking-changes/scribble-text-input-client

* WidgetsBinding.instance is non-nullable in flutter 3
  • Loading branch information
jhaglund authored May 16, 2022
1 parent f674f1c commit 9e16c82
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/src/chips_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ChipsInputState<T> extends State<ChipsInput<T>>
_focusNode.addListener(_handleFocusChanged);
_nodeAttachment = _focusNode.attach(context);

WidgetsBinding.instance?.addPostFrameCallback((_) async {
WidgetsBinding.instance.addPostFrameCallback((_) async {
_initOverlayEntry();
if (mounted && widget.autofocus) {
FocusScope.of(context).autofocus(_focusNode);
Expand Down Expand Up @@ -292,7 +292,7 @@ class ChipsInputState<T> extends State<ChipsInput<T>>

void _scrollToVisible() {
Future.delayed(const Duration(milliseconds: 300), () {
WidgetsBinding.instance?.addPostFrameCallback((_) async {
WidgetsBinding.instance.addPostFrameCallback((_) async {
final renderBox = context.findRenderObject() as RenderBox;
await Scrollable.of(context)?.position.ensureVisible(renderBox);
});
Expand Down Expand Up @@ -451,7 +451,7 @@ class ChipsInputState<T> extends State<ChipsInput<T>>

return NotificationListener<SizeChangedLayoutNotification>(
onNotification: (SizeChangedLayoutNotification val) {
WidgetsBinding.instance?.addPostFrameCallback((_) async {
WidgetsBinding.instance.addPostFrameCallback((_) async {
_suggestionsBoxController.overlayEntry?.markNeedsBuild();
});
return true;
Expand Down Expand Up @@ -485,4 +485,13 @@ class ChipsInputState<T> extends State<ChipsInput<T>>
),
);
}

@override
void showToolbar() {}

@override
void insertTextPlaceholder(Size size) {}

@override
void removeTextPlaceholder() {}
}

0 comments on commit 9e16c82

Please sign in to comment.