The argument type 'TextDirection' can't be assigned to the parameter type 'TextDirection?'

Viewed 2016

there is a simple TextField and I want to give it TextDirection the problem is that it i encounter the error i said

TextField(
   textDirection: TextDirection.RTL,
)
3 Answers

found the problem as it said above the problem is with the easy_localization package won't allow to use rtl in text direction. it is usable by this way

import 'package:easy_localization/easy_localization.dart' as localized;

and before every use of this package just adding localized.

The text direction class you are supposed to use has a constant value of rtl.

Whichever class you use there, that has a constant of RTL is the wrong one.

Try below code use TextDirection.rtl insted of TextDirection.RTL go documentation here

   TextField(
            textDirection: TextDirection.rtl,
            textCapitalization: TextCapitalization.sentences,
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Name',
              hintText: 'Card Holder Name',
            ),
          ),

your result enter image description here

Related