before

localhost_60108_(iPhone SE).png

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

Future viewWebsite(String recvUrl) async {
  final url = Uri.parse(recvUrl);
  launchUrl(url);
}

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('リンク飛ぶ')),
        body: Center(
          child: RichText(
            text: TextSpan(
              style: TextStyle(color: Colors.black, height: 1),
              children: [
                TextSpan(text: '詳しくは', style: TextStyle(fontSize: 30)),
                WidgetSpan(
                  child: GestureDetector(
                    onTap: () {viewWebsite('<https://www.google.com/>');},
                    child: Text(
                      ' こちら',
                      style: TextStyle(
                        color: Colors.indigo[500],
                        fontWeight: FontWeight.w500,
                        fontSize: 30
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

after

localhost_60108_(iPhone SE).png

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

Future viewWebsite(String recvUrl) async {
  final url = Uri.parse(recvUrl);
  launchUrl(url);
}

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('リンク飛ぶ')),
        body: Center(
          child: RichText(
            text: TextSpan(
              style: TextStyle(color: Colors.black, height: 1),
              children: [
                TextSpan(text: '詳しくは', style: TextStyle(fontSize: 30)),
                WidgetSpan(
                  alignment: PlaceholderAlignment.baseline,
                  baseline: TextBaseline.alphabetic,
                  child: GestureDetector(
                    onTap: () {viewWebsite('<https://www.google.com/>');},
                    child: Text(
                      ' こちら',
                      style: TextStyle(
                        color: Colors.indigo[500],
                        fontWeight: FontWeight.w500,
                        fontSize: 30
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

追加箇所

WidgetSpan内に、alignmentとbaselineを追加する

WidgetSpan(
	alignment: PlaceholderAlignment.baseline,
	baseline: TextBaseline.alphabetic,
                  

<aside> <img src="/icons/info-alternate_lightgray.svg" alt="/icons/info-alternate_lightgray.svg" width="40px" />