How can I change the cursor to pointer when a user hovers over the link on web? I have tried MouseRegion and it's not working:
import 'package:url_launcher/link.dart';
class UserAgreementText extends StatelessWidget {
const UserAgreementText({super.key});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Wrap(
children: [
RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: 'By continuing, you accept our ',
style: Theme.of(context).textTheme.bodySmall,
children: <InlineSpan>[
WidgetSpan(
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: MouseRegion(
onEnter: (_) => SystemMouseCursors.click,
onExit: (_) => SystemMouseCursors.basic,
child: Link(
target: LinkTarget.blank,
builder: (context, follow) => Text(
"tos".tr(),
style: theme.textTheme.bodyMedium?.copyWith(
fontSize: 12,
color: theme.colorScheme.primary,
),
),
uri: Uri.parse(Constants.legals.tos),
),
),
),
const TextSpan(text: ' and '),
WidgetSpan(
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: Link(
target: LinkTarget.blank,
builder: (context, follow) => Text(
"pp".tr(),
style: theme.textTheme.bodyMedium?.copyWith(
fontSize: 12,
color: theme.colorScheme.primary,
),
),
uri: Uri.parse(Constants.legals.pp),
),
),
],
),
),
],
);
}
}
onEnter
and onExit
are void method. in order to change the cursor, you can put
MouseRegion(
cursor: SystemMouseCursors.click,//
child:
)