John Benedict Sabando
John Benedict Sabando

Reputation: 11

'textSelectionColor' is deprecated and shouldn't be used

in flutter , I have defined my custom theme like this the problem is 'textSelectionColor' is deprecated and shouldn't be used. Use TextSelectionThemeData.selectionColor instead.

Text(
          'Your Cat Is Empty',
          style: TextStyle(
              color: Theme.of(context).textSelectionColor, fontSize: 36),
        )

This feature was deprecated after v1.26.0-18.0.pre.. Try replacing the use of the deprecated member with the replacement

Can someone help me?

Upvotes: 1

Views: 1148

Answers (1)

Ravindra S. Patil
Ravindra S. Patil

Reputation: 14885

Try below code hope its help to you. used textSelectionTheme.selectionColor

Refer TextSelectionTheme here

  Text(
      'Your Cat Is Empty',
      style: TextStyle(
        color: Theme.of(context).textSelectionTheme.selectionColor,
        fontSize: 36,
      ),
    ),

Result screen-> enter image description here

Upvotes: 2

Related Questions