replace for ... in with mapIndexed where possible
This commit is contained in:
parent
67a31eb1fd
commit
08cf09ecc2
1 changed files with 95 additions and 89 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import "dart:async";
|
||||
|
||||
import "package:collection/collection.dart";
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
|
|
@ -126,9 +127,9 @@ class EmojiPicker extends HookConsumerWidget {
|
|||
padding: .only(bottom: 12),
|
||||
scrollDirection: .horizontal,
|
||||
controller: categoryScrollController,
|
||||
children: [
|
||||
for (final (index, category) in combined.indexed)
|
||||
Padding(
|
||||
children: combined
|
||||
.mapIndexed(
|
||||
(index, category) => Padding(
|
||||
key: chipKeys[index],
|
||||
padding: .symmetric(horizontal: 4),
|
||||
child: FilterChip(
|
||||
|
|
@ -151,7 +152,8 @@ class EmojiPicker extends HookConsumerWidget {
|
|||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -159,9 +161,9 @@ class EmojiPicker extends HookConsumerWidget {
|
|||
child: CustomScrollView(
|
||||
key: scrollViewKey,
|
||||
controller: scrollController,
|
||||
slivers: [
|
||||
for (final (index, category) in combined.indexed)
|
||||
Builder(
|
||||
slivers: combined
|
||||
.mapIndexed(
|
||||
(index, category) => Builder(
|
||||
builder: (context) {
|
||||
final headerKey = headerKeys[index];
|
||||
final emojis = search.value.isEmpty
|
||||
|
|
@ -210,7 +212,8 @@ class EmojiPicker extends HookConsumerWidget {
|
|||
|
||||
return IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () => onSelection(emoji.value),
|
||||
onPressed: () =>
|
||||
onSelection(emoji.value),
|
||||
icon: SizedBox.square(
|
||||
dimension: 36,
|
||||
child: FittedBox(child: emoji.widget),
|
||||
|
|
@ -218,12 +221,15 @@ class EmojiPicker extends HookConsumerWidget {
|
|||
);
|
||||
},
|
||||
),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 4)),
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(height: 4),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue