Hover card
A hover card offers a quick look at a linked item. Put the full information at the link destination so touch and keyboard readers can reach it as well.
Preview a file owner
#Rest the pointer on Mara Chen to preview her role. Activate her name to read the same detail in the page.
components/hover-card/appliance/preview_owner.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class PreviewOwner extends StatefulWidget {
const PreviewOwner({super.key});
@override
State<PreviewOwner> createState() => _PreviewOwnerState();
}
class _PreviewOwnerState extends State<PreviewOwner> {
bool showProfile = false;
@override
Widget build(BuildContext context) => Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceHoverCard(
card: (_) => const Text('Design lead in Toronto.'),
child: ApplianceLink(
'Mara Chen',
onPressed: () => setState(() => showProfile = !showProfile),
),
),
const SizedBox(height: 12),
if (showProfile) const Text('Mara Chen · Design lead in Toronto.'),
],
);
}
Parameters
ApplianceHoverCard API ↗child- The named link that anchors the preview.
card- Supplies the profile information shown on hover.
width- Maximum width of the preview.
Shared behaviour
- Keyboard and focus. Tab to the name and press Enter to open the profile. Moving the pointer away dismisses the hover preview.
- Screen readers. Read the name, activate it, then read the profile below. Some looks intentionally omit the hover copy from the accessibility tree.
- Direction and type. The profile text follows the page direction and wraps at large type. Check the floating copy at phone width too.