Home > Software engineering >  How can i achieve this half bold text in flutter
How can i achieve this half bold text in flutter

Time:08-05

Does anyone know how I can get this half-bolded effect using Flutter?

enter image description here

CodePudding user response:

You can use RichText widget like below.

RichText(
   textAlign: TextAlign.center,
   text: TextSpan(children: [
   TextSpan(text: "Are you sure you want to delete ", style: black16w700),
   TextSpan(text: "Broker Account?", style: black16w500)
]))

CodePudding user response:

    var text = RichText(
  text: TextSpan(
   
    style: const TextStyle(
      fontSize: 14.0,
      color: Colors.black,
    ),
    children: <TextSpan>[
      TextSpan(text: 'NonBOld'),
      TextSpan(text: 'Bold', style: TextStyle(fontWeight: FontWeight.bold)),
    ],
  ),
);

Try TextSpan widget having children.

CodePudding user response:

use the richtext widget property as follows

Text.rich(
    TextSpan(
      style: TextStyle(
        fontFamily: 'Roboto',
        fontSize: 52,
        color: const Color(0xff7a7a7a),
      ),
      children: [
        TextSpan(
          text: 'arch',
          style: TextStyle(
            fontWeight: FontWeight.w700,
          ),
        ),
        TextSpan(
          text: 'Incubator',
        ),
      ],
    ),
     )

CodePudding user response:

You should use RichText

RichText(
  text: TextSpan(
    text: 'Hello ',
    style: // style text,
    children: const <TextSpan>[
      TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
      TextSpan(text: ' world!'),
    ],
  ),
)

Read this doc and check this answer

  • Related