Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.0.2

- fix: freeze when you type just white space into the input field when categories are visible
- fix: infinite loading when you type just white space into emoji/stickers
- fix: cursor jumping to the end of the input if you type anywhere but the end

[All Code Changes](https://github.com/Flyclops/klipy_flutter/compare/0.0.1...0.0.2)

## 0.0.1

- refactor: [tenor_flutter](https://pub.dev/packages/tenor_flutter) so that it supports the KLIPY API via their [migration docs](https://docs.klipy.com/migrate-from-tenor).
Expand Down
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ analyzer:
linter:
rules:
require_trailing_commas: true

formatter:
trailing_commas: preserve
18 changes: 14 additions & 4 deletions lib/src/components/media_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@ import 'package:flutter/widgets.dart';

class KlipyMediaWidget extends StatelessWidget {
final Widget media;
final double watermarkXOffset;
final double watermarkYOffset;
final double watermarkHeight;

const KlipyMediaWidget({required this.media, super.key});
const KlipyMediaWidget({
required this.media,
this.watermarkHeight = 10,
this.watermarkXOffset = 4,
this.watermarkYOffset = 4,
super.key,
});

@override
Widget build(BuildContext context) {
return Stack(
children: [
media,
Positioned(
bottom: 2,
left: 2,
bottom: watermarkYOffset,
left: watermarkXOffset,
child: Image.asset(
'assets/media_watermark.png',
height: watermarkHeight,
package: 'klipy_flutter',
height: 10,
semanticLabel: 'KLIPY',
),
),
],
Expand Down
4 changes: 4 additions & 0 deletions lib/src/components/search_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ class _KlipySearchFieldState extends State<KlipySearchField> {

// listener query
void _listenerQuery() {
// Update only when the text is different. For instance if you tap
// on a category. Without this check the cursor will jump to the end.
if (_textEditingController.text == _appBarProvider.queryText) return;

_textEditingController.text = _appBarProvider.queryText;
}
}
10 changes: 8 additions & 2 deletions lib/src/components/tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class _KlipyTabViewState extends State<KlipyTabView>
return const Center(child: CircularProgressIndicator());
}

if (_appBarProvider.queryText.isEmpty &&
if (_appBarProvider.queryText.trim().isEmpty &&
_appBarProvider.selectedCategory == null &&
widget.showCategories) {
return Padding(
Expand Down Expand Up @@ -327,7 +327,7 @@ class _KlipyTabViewState extends State<KlipyTabView>

if (widget.onLoad != null) {
final response = await widget.onLoad?.call(
_appBarProvider.queryText,
_appBarProvider.queryText.trim(),
offset,
requestLimit,
_appBarProvider.selectedCategory,
Expand Down Expand Up @@ -395,6 +395,12 @@ class _KlipyTabViewState extends State<KlipyTabView>

// When the text in the search input changes
void _appBarProviderListener() {
// Prevent searches with only spaces
if (_appBarProvider.queryText.isNotEmpty &&
_appBarProvider.queryText.trim().isEmpty) {
return;
}

setState(() {
_list = [];
_collection = null;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: klipy_flutter
version: 0.0.1
version: 0.0.2
description: An opinionated yet customizable Flutter package for searching and selecting from a list of GIFs/Stickers from the KLIPY GIF search API.
homepage: https://github.com/flyclops
repository: https://github.com/flyclops/klipy_flutter
Expand Down