💫 Animated command pattle
This commit is contained in:
@@ -316,15 +316,15 @@ class CommandPattleWidget extends HookConsumerWidget {
|
|||||||
onTap: onDismiss,
|
onTap: onDismiss,
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||||
|
child: Container(
|
||||||
|
color: Colors.black.withOpacity(0.5),
|
||||||
|
child: Center(
|
||||||
child: AnimatedBuilder(
|
child: AnimatedBuilder(
|
||||||
animation: animationController,
|
animation: animationController,
|
||||||
builder: (context, child) => Opacity(
|
builder: (context, child) => Opacity(
|
||||||
opacity: opacityAnimation,
|
opacity: opacityAnimation,
|
||||||
child: Transform.scale(scale: scaleAnimation, child: child),
|
child: Transform.scale(scale: scaleAnimation, child: child),
|
||||||
),
|
),
|
||||||
child: Container(
|
|
||||||
color: Colors.black.withOpacity(0.5),
|
|
||||||
child: Center(
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap:
|
onTap:
|
||||||
() {}, // Prevent tap from dismissing when tapping inside
|
() {}, // Prevent tap from dismissing when tapping inside
|
||||||
@@ -355,8 +355,8 @@ class CommandPattleWidget extends HookConsumerWidget {
|
|||||||
controller: textController,
|
controller: textController,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
hintText: 'Search chats and pages...',
|
hintText: 'Search chats and pages...',
|
||||||
leading: const Icon(
|
leading: CircleAvatar(
|
||||||
Symbols.keyboard_command_key,
|
child: const Icon(Symbols.keyboard_command_key),
|
||||||
).padding(horizontal: 8),
|
).padding(horizontal: 8),
|
||||||
onSubmitted: (_) {
|
onSubmitted: (_) {
|
||||||
if (allResults.isNotEmpty) {
|
if (allResults.isNotEmpty) {
|
||||||
@@ -369,8 +369,14 @@ class CommandPattleWidget extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (allResults.isNotEmpty)
|
AnimatedSize(
|
||||||
Flexible(
|
duration: const Duration(milliseconds: 200),
|
||||||
|
curve: Curves.easeOut,
|
||||||
|
child: allResults.isNotEmpty
|
||||||
|
? ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
maxHeight: 300,
|
||||||
|
),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: allResults.length,
|
itemCount: allResults.length,
|
||||||
@@ -379,21 +385,31 @@ class CommandPattleWidget extends HookConsumerWidget {
|
|||||||
if (item is SnChatRoom) {
|
if (item is SnChatRoom) {
|
||||||
return _ChatRoomSearchResult(
|
return _ChatRoomSearchResult(
|
||||||
room: item,
|
room: item,
|
||||||
isFocused: index == focusedIndex.value,
|
isFocused:
|
||||||
onTap: () =>
|
index == focusedIndex.value,
|
||||||
_navigateToChat(context, ref, item),
|
onTap: () => _navigateToChat(
|
||||||
|
context,
|
||||||
|
ref,
|
||||||
|
item,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else if (item is RouteItem) {
|
} else if (item is RouteItem) {
|
||||||
return _RouteSearchResult(
|
return _RouteSearchResult(
|
||||||
route: item,
|
route: item,
|
||||||
isFocused: index == focusedIndex.value,
|
isFocused:
|
||||||
onTap: () =>
|
index == focusedIndex.value,
|
||||||
_navigateToRoute(context, ref, item),
|
onTap: () => _navigateToRoute(
|
||||||
|
context,
|
||||||
|
ref,
|
||||||
|
item,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user