From 99625e1d1c6c80e2f4b5a3c22c7221d6d2c7737c Mon Sep 17 00:00:00 2001 From: Chandra Abdul Fattah Date: Wed, 31 Aug 2022 16:49:23 +0700 Subject: [PATCH 1/3] Merged fix keyboard with latest main --- CHANGELOG.md | 3 +++ example/lib/main.dart | 4 ++-- lib/src/text_cursor.dart | 4 ++-- pubspec.yaml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 823f48a0..e6d1d6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [2.0.1] - 31-August-2022 +* Fix keyboard issue + ## [2.0.0] - 16-May-2022 * Flutter 3 compatibility diff --git a/example/lib/main.dart b/example/lib/main.dart index 21d35277..492a6062 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -24,10 +24,10 @@ class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override - _MyHomePageState createState() => _MyHomePageState(); + MyHomePageState createState() => MyHomePageState(); } -class _MyHomePageState extends State { +class MyHomePageState extends State { final _chipKey = GlobalKey(); @override diff --git a/lib/src/text_cursor.dart b/lib/src/text_cursor.dart index e00da661..2d604588 100644 --- a/lib/src/text_cursor.dart +++ b/lib/src/text_cursor.dart @@ -13,10 +13,10 @@ class TextCursor extends StatefulWidget { final bool resumed; @override - _TextCursorState createState() => _TextCursorState(); + TextCursorState createState() => TextCursorState(); } -class _TextCursorState extends State +class TextCursorState extends State with SingleTickerProviderStateMixin { bool _displayed = false; late Timer _timer; diff --git a/pubspec.yaml b/pubspec.yaml index b33d3aa6..b84066db 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_chips_input description: Flutter library for building input fields with InputChips as input options. -version: 2.0.0 +version: 2.0.1 homepage: https://github.com/danvick/flutter_chips_input environment: From c2faa980b102f437bfd481d90893eb6a41116aa0 Mon Sep 17 00:00:00 2001 From: Chandra Abdul Fattah Date: Wed, 31 Aug 2022 16:57:02 +0700 Subject: [PATCH 2/3] Keyboard show --- lib/src/chips_input.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/chips_input.dart b/lib/src/chips_input.dart index 3c10a20d..f0632a34 100644 --- a/lib/src/chips_input.dart +++ b/lib/src/chips_input.dart @@ -355,6 +355,7 @@ class ChipsInputState extends State> _closeInputConnectionIfNeeded(); //Hack for #34 (https://github.com/danvick/flutter_chips_input/issues/34#issuecomment-684505282). TODO: Find permanent fix _textInputConnection ??= TextInput.attach(this, textInputConfiguration); _textInputConnection?.setEditingState(_value); + _textInputConnection?.show(); } @override From fcbfeba11d83d7d1ec1fc6000d6f6575a88dac53 Mon Sep 17 00:00:00 2001 From: Chandra Abdul Fattah Date: Thu, 8 Jun 2023 14:27:43 +0700 Subject: [PATCH 3/3] Fix conflict --- example/lib/main.dart | 4 ++-- lib/src/chips_input.dart | 14 ++++++++++++-- lib/src/suggestions_box_controller.dart | 2 +- lib/src/text_cursor.dart | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 21d35277..492a6062 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -24,10 +24,10 @@ class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override - _MyHomePageState createState() => _MyHomePageState(); + MyHomePageState createState() => MyHomePageState(); } -class _MyHomePageState extends State { +class MyHomePageState extends State { final _chipKey = GlobalKey(); @override diff --git a/lib/src/chips_input.dart b/lib/src/chips_input.dart index 3c10a20d..260b2a99 100644 --- a/lib/src/chips_input.dart +++ b/lib/src/chips_input.dart @@ -288,7 +288,7 @@ class ChipsInputState extends State> Future.delayed(const Duration(milliseconds: 300), () { WidgetsBinding.instance.addPostFrameCallback((_) async { final renderBox = context.findRenderObject() as RenderBox; - await Scrollable.of(context)?.position.ensureVisible(renderBox); + await Scrollable.of(context).position.ensureVisible(renderBox); }); }); } @@ -435,7 +435,7 @@ class ChipsInputState extends State> maxLines: 1, overflow: widget.textOverflow, style: widget.textStyle ?? - theme.textTheme.subtitle1!.copyWith(height: 1.5), + theme.textTheme.titleMedium!.copyWith(height: 1.5), ), ), Flexible( @@ -492,4 +492,14 @@ class ChipsInputState extends State> @override void removeTextPlaceholder() {} + + @override + void didChangeInputControl( + TextInputControl? oldControl, TextInputControl? newControl) {} + + @override + void insertContent(KeyboardInsertedContent content) {} + + @override + void performSelector(String selectorName) {} } diff --git a/lib/src/suggestions_box_controller.dart b/lib/src/suggestions_box_controller.dart index 127c7452..157d55eb 100644 --- a/lib/src/suggestions_box_controller.dart +++ b/lib/src/suggestions_box_controller.dart @@ -14,7 +14,7 @@ class SuggestionsBoxController { void open() { if (_isOpened) return; assert(overlayEntry != null); - Overlay.of(context)!.insert(overlayEntry!); + Overlay.of(context).insert(overlayEntry!); _isOpened = true; } diff --git a/lib/src/text_cursor.dart b/lib/src/text_cursor.dart index e00da661..2d604588 100644 --- a/lib/src/text_cursor.dart +++ b/lib/src/text_cursor.dart @@ -13,10 +13,10 @@ class TextCursor extends StatefulWidget { final bool resumed; @override - _TextCursorState createState() => _TextCursorState(); + TextCursorState createState() => TextCursorState(); } -class _TextCursorState extends State +class TextCursorState extends State with SingleTickerProviderStateMixin { bool _displayed = false; late Timer _timer;