Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ class GalleryTypographyPage extends StatelessWidget {
onPressed: () =>
showToast(context, message: 'High contrast activated'),
),
// Two spellings of the same state: a null callback disables the
// link exactly as `enabled: false` does.
FortalLink('Disabled', enabled: false, onPressed: () {}),
const FortalLink('Inert'),
const FortalLink('Disabled (no callback)'),
FortalLink(
'Documentation',
linkUrl: Uri.parse('https://docs.page/btwld/remix/fortal'),
Expand Down
10 changes: 5 additions & 5 deletions apps/dashboard/test/app_smoke_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,12 @@ void main() {
for (final underline in FortalLinkUnderline.values) {
expect(find.text(enumLabel(underline)), findsOneWidget);
}
expect(find.text('Inert'), findsOneWidget);
expect(find.text('Disabled'), findsOneWidget);
expect(find.text('Disabled (no callback)'), findsOneWidget);
expect(tester.takeException(), isNull);
});

testWidgets('an actionable gallery link activates, an inert one does not', (
testWidgets('an actionable gallery link activates, a disabled one does not', (
tester,
) async {
tester.view.physicalSize = const Size(1440, 900);
Expand All @@ -668,9 +668,9 @@ void main() {
await tester.pump();
expect(find.text('Always link activated'), findsOneWidget);

final inert = find.text('Inert');
await tester.ensureVisible(inert);
await tester.tap(inert, warnIfMissed: false);
final disabled = find.text('Disabled (no callback)');
await tester.ensureVisible(disabled);
await tester.tap(disabled, warnIfMissed: false);
await tester.pump();
expect(tester.takeException(), isNull);

Expand Down
16 changes: 10 additions & 6 deletions apps/playground/lib/registry/entries/typography_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,30 @@ Widget buildTypographyExample() {
underline: FortalLinkUnderline.none,
onPressed: () {},
),
// Two spellings of the same state: a null callback disables the
// link exactly as `enabled: false` does.
FortalLink('Disabled', enabled: false, onPressed: () {}),
const FortalLink('Inert'),
const FortalLink('Disabled (no callback)'),
],
),
const SizedBox(height: 24),
const _SectionLabel('Accent and high contrast'),
const SizedBox(height: 12),
const Wrap(
Wrap(
spacing: 18,
runSpacing: 12,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
FortalText('Accent text', accent: true),
FortalText(
const FortalText('Accent text', accent: true),
const FortalText(
'Accent high contrast',
accent: true,
highContrast: true,
),
FortalCode.soft('accent code', highContrast: true),
FortalLink('Accent link', highContrast: true),
const FortalCode.soft('accent code', highContrast: true),
// Actionable on purpose: this row is about accent colour, and a
// callback-less link would show the disabled treatment instead.
FortalLink('Accent link', highContrast: true, onPressed: () {}),
],
),
const SizedBox(height: 24),
Expand Down
4 changes: 4 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
"title": "IconButton",
"href": "/components/icon_button"
},
{
"title": "Link",
"href": "/components/link"
},
{
"title": "Menu",
"href": "/components/menu"
Expand Down
Loading
Loading