Skip to content

Commit

Permalink
Accessibility of the website card improved (#5414)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jun 20, 2024
1 parent f6ec9df commit 65dece6
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions packages/smooth_app/lib/pages/product/website_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,53 @@ class WebsiteCard extends StatelessWidget {

@override
Widget build(BuildContext context) {
final AppLocalizations localizations = AppLocalizations.of(context);
final String website = _getWebsite();

return buildProductSmoothCard(
body: InkWell(
onTap: () async => LaunchUrlHelper.launchURL(website),
borderRadius: ROUNDED_BORDER_RADIUS,
child: Container(
width: double.infinity,
padding: const EdgeInsetsDirectional.only(
start: LARGE_SPACE,
top: LARGE_SPACE,
bottom: LARGE_SPACE,
// To be perfectly aligned with arrows
end: 21.0,
),
child: Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
AppLocalizations.of(context).product_field_website_title,
style: Theme.of(context).textTheme.displaySmall,
),
const SizedBox(height: SMALL_SPACE),
Text(
website,
overflow: TextOverflow.ellipsis,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(color: Colors.blue),
),
],
body: Semantics(
label: localizations.product_field_website_title,
value: Uri.parse(website).host,
link: true,
excludeSemantics: true,
child: InkWell(
onTap: () async => LaunchUrlHelper.launchURL(website),
borderRadius: ROUNDED_BORDER_RADIUS,
child: Container(
width: double.infinity,
padding: const EdgeInsetsDirectional.only(
start: LARGE_SPACE,
top: LARGE_SPACE,
bottom: LARGE_SPACE,
// To be perfectly aligned with arrows
end: 21.0,
),
child: Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
localizations.product_field_website_title,
style: Theme.of(context).textTheme.displaySmall,
),
const SizedBox(height: SMALL_SPACE),
Text(
website,
overflow: TextOverflow.ellipsis,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(color: Colors.blue),
),
],
),
),
),
const Icon(Icons.open_in_new),
],
const Icon(Icons.open_in_new),
],
),
),
),
),
Expand Down

0 comments on commit 65dece6

Please sign in to comment.