Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit e99d54b

Browse files
authored
Merge pull request #21 from Flyclops/issues/20
End of life bug fixes
2 parents 9f432f3 + 4913497 commit e99d54b

6 files changed

Lines changed: 53 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.0.2
2+
3+
- fix: freeze when you type just white space into the input field when categories are visible
4+
- fix: infinite loading when you type just white space into emoji/stickers
5+
- fix: cursor jumping to the end of the input if you type anywhere but the end
6+
7+
[All Code Changes](https://github.com/Flyclops/tenor_flutter/compare/1.0.1...1.0.2)
8+
19
## 1.0.1
210

311
- chore: Add discontinued notice

analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ analyzer:
77
linter:
88
rules:
99
require_trailing_commas: true
10+
11+
formatter:
12+
trailing_commas: preserve

lib/src/components/search_field.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ class _TenorSearchFieldState extends State<TenorSearchField> {
100100
_appBarProvider.addListener(_listenerQuery);
101101

102102
// Set Texfield Controller
103-
_textEditingController = widget.searchFieldController ??
103+
_textEditingController =
104+
widget.searchFieldController ??
104105
TextEditingController(
105106
text: _appBarProvider.queryText,
106107
);
@@ -202,8 +203,7 @@ class _TenorSearchFieldState extends State<TenorSearchField> {
202203
left: 4,
203204
child: Icon(
204205
Icons.search,
205-
color:
206-
widget.style.hintStyle.color ?? const Color(0xFF8A8A86),
206+
color: widget.style.hintStyle.color ?? const Color(0xFF8A8A86),
207207
size: 22,
208208
),
209209
),
@@ -218,8 +218,7 @@ class _TenorSearchFieldState extends State<TenorSearchField> {
218218
padding: const EdgeInsets.all(8),
219219
child: Icon(
220220
Icons.clear,
221-
color: widget.style.hintStyle.color ??
222-
const Color(0xFF8A8A86),
221+
color: widget.style.hintStyle.color ?? const Color(0xFF8A8A86),
223222
size: 20,
224223
),
225224
),
@@ -240,15 +239,17 @@ class _TenorSearchFieldState extends State<TenorSearchField> {
240239
// when they focus the input, maximize viewing space
241240
_sheetProvider.scrollController.animateTo(
242241
_sheetProvider.maxExtent,
243-
duration:
244-
animationStyle?.duration ?? tenorDefaultAnimationStyle.duration!,
242+
duration: animationStyle?.duration ?? tenorDefaultAnimationStyle.duration!,
245243
curve: animationStyle?.curve ?? Curves.linear,
246244
);
247245
}
248246
}
249247

250248
// listener query
251249
void _listenerQuery() {
250+
// Update only when it's different. IE you tap on a category. Otherwise the cursor will jump to the end.
251+
if (_textEditingController.text == _appBarProvider.queryText) return;
252+
252253
_textEditingController.text = _appBarProvider.queryText;
253254
}
254255
}

lib/src/components/tab_view.dart

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class TenorTabView extends StatefulWidget {
3131
String? pos,
3232
int limit,
3333
TenorCategory? category,
34-
)? onLoad;
34+
)?
35+
onLoad;
3536
final Function(TenorResult? gif)? onSelected;
3637
final bool showCategories;
3738
final TenorTabViewStyle style;
@@ -48,8 +49,8 @@ class TenorTabView extends StatefulWidget {
4849
this.showCategories = false,
4950
this.style = const TenorTabViewStyle(),
5051
super.key,
51-
}) : featuredCategory = featuredCategory ?? '📈 Featured',
52-
gifsPerRow = gifsPerRow ?? 3;
52+
}) : featuredCategory = featuredCategory ?? '📈 Featured',
53+
gifsPerRow = gifsPerRow ?? 3;
5354

5455
@override
5556
State<TenorTabView> createState() => _TenorTabViewState();
@@ -151,7 +152,7 @@ class _TenorTabViewState extends State<TenorTabView>
151152
);
152153
}
153154

154-
if (_appBarProvider.queryText.isEmpty &&
155+
if (_appBarProvider.queryText.trim().isEmpty &&
155156
_appBarProvider.selectedCategory == null &&
156157
widget.showCategories) {
157158
return Padding(
@@ -188,10 +189,10 @@ class _TenorTabViewState extends State<TenorTabView>
188189
// Add safe area padding if `TenorAttributionType.poweredBy` is disabled
189190
padding:
190191
_tabProvider.attributionType == TenorAttributionType.poweredBy
191-
? null
192+
? EdgeInsets.zero
192193
: EdgeInsets.only(
193-
bottom: MediaQuery.of(context).padding.bottom,
194-
),
194+
bottom: MediaQuery.of(context).padding.bottom,
195+
),
195196
scrollDirection: _scrollDirection,
196197
),
197198
),
@@ -206,24 +207,24 @@ class _TenorTabViewState extends State<TenorTabView>
206207
crossAxisCount: widget.gifsPerRow,
207208
crossAxisSpacing: 8,
208209
keyboardDismissBehavior: _appBarProvider.keyboardDismissBehavior,
209-
itemBuilder: (ctx, idx) => ClipRRect(
210-
borderRadius: BorderRadius.circular(8),
211-
child: TenorSelectableGif(
212-
backgroundColor: widget.style.mediaBackgroundColor,
213-
onTap: (selectedResult) => _selectedGif(
214-
selectedResult,
210+
itemBuilder:
211+
(ctx, idx) => ClipRRect(
212+
borderRadius: BorderRadius.circular(8),
213+
child: TenorSelectableGif(
214+
backgroundColor: widget.style.mediaBackgroundColor,
215+
onTap: (selectedResult) => _selectedGif(selectedResult),
216+
result: _list[idx],
217+
),
215218
),
216-
result: _list[idx],
217-
),
218-
),
219219
itemCount: _list.length,
220220
mainAxisSpacing: 8,
221221
// Add safe area padding if `TenorAttributionType.poweredBy` is disabled
222-
padding: _tabProvider.attributionType == TenorAttributionType.poweredBy
223-
? null
224-
: EdgeInsets.only(
225-
bottom: MediaQuery.of(context).padding.bottom,
226-
),
222+
padding:
223+
_tabProvider.attributionType == TenorAttributionType.poweredBy
224+
? null
225+
: EdgeInsets.only(
226+
bottom: MediaQuery.of(context).padding.bottom,
227+
),
227228
scrollDirection: _scrollDirection,
228229
),
229230
);
@@ -332,7 +333,7 @@ class _TenorTabViewState extends State<TenorTabView>
332333

333334
if (widget.onLoad != null) {
334335
final response = await widget.onLoad?.call(
335-
_appBarProvider.queryText,
336+
_appBarProvider.queryText.trim(),
336337
offset,
337338
requestLimit,
338339
_appBarProvider.selectedCategory,
@@ -389,7 +390,8 @@ class _TenorTabViewState extends State<TenorTabView>
389390
// if you scroll within a threshhold of the bottom of the screen, load more gifs
390391
void _scrollControllerListener() {
391392
// trending-gifs, etc
392-
final customCategorySelected = _appBarProvider.selectedCategory != null &&
393+
final customCategorySelected =
394+
_appBarProvider.selectedCategory != null &&
393395
_appBarProvider.queryText == '';
394396

395397
if (customCategorySelected ||
@@ -404,6 +406,12 @@ class _TenorTabViewState extends State<TenorTabView>
404406

405407
// When the text in the search input changes
406408
void _appBarProviderListener() {
409+
// Prevent searches with only spaces
410+
if (_appBarProvider.queryText.isNotEmpty &&
411+
_appBarProvider.queryText.trim().isEmpty) {
412+
return;
413+
}
414+
407415
setState(() {
408416
_list = [];
409417
_collection = null;

lib/src/providers/app_bar_provider.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class TenorAppBarProvider with ChangeNotifier {
2525
Duration debounce, {
2626
required this.keyboardDismissBehavior,
2727
TenorCategory? selectedCategory,
28-
}) : _selectedCategory = selectedCategory,
29-
super() {
28+
}) : _selectedCategory = selectedCategory,
29+
super() {
3030
_queryText = queryText;
3131
_debounce = debounce;
3232
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: tenor_flutter
2-
version: 1.0.1
2+
version: 1.0.2
33
description: An opinionated yet customizable Flutter package for searching and selecting from a list of GIFs/Stickers from the Tenor GIF search API.
44
homepage: https://github.com/flyclops
55
repository: https://github.com/flyclops/tenor_flutter

0 commit comments

Comments
 (0)