Skip to content

Commit

Permalink
feat: Add reveal highlight to the search screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Nov 27, 2024
1 parent cf4d1fe commit 917f748
Showing 1 changed file with 39 additions and 30 deletions.
69 changes: 39 additions & 30 deletions lib/screens/search/widgets/search_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:fluent_ui/fluent_ui.dart';

import '../../../widgets/ax_pressure.dart';
import '../../../widgets/hover_opacity.dart';
import '../../../widgets/collection_item.dart';
import '../../../widgets/ax_reveal/ax_reveal.dart';
import '../../../widgets/context_menu_wrapper.dart';
import '../../../providers/responsive_providers.dart';

Expand Down Expand Up @@ -38,6 +40,8 @@ abstract class SearchCardState<T extends SearchCard> extends State<T> {

@override
Widget build(BuildContext context) {
final brightness = FluentTheme.of(context).brightness;

return ContextMenuWrapper(
contextAttachKey: contextAttachKey,
contextController: contextController,
Expand Down Expand Up @@ -110,38 +114,43 @@ abstract class SearchCardState<T extends SearchCard> extends State<T> {
);
}

return Button(
style: const ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
),
onPressed: () => onPressed(context),
child: ClipRRect(
borderRadius: BorderRadius.circular(3),
child: LayoutBuilder(
builder: (context, constraints) {
final size =
min(constraints.maxWidth, constraints.maxHeight);
return Row(
children: [
buildLeadingWidget(size),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
getItemTitle(),
overflow: TextOverflow.ellipsis,
),
],
return AxReveal(
config: brightness == Brightness.dark
? defaultLightRevealConfig
: defaultDarkRevealConfig,
child: Button(
style: const ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
),
onPressed: () => onPressed(context),
child: ClipRRect(
borderRadius: BorderRadius.circular(3),
child: LayoutBuilder(
builder: (context, constraints) {
final size =
min(constraints.maxWidth, constraints.maxHeight);
return Row(
children: [
buildLeadingWidget(size),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
getItemTitle(),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
),
],
);
},
],
);
},
),
),
),
);
Expand Down

0 comments on commit 917f748

Please sign in to comment.