#flutter
#трепетать
Вопрос:
Я хочу создать TextFormField
, только значение градиента.
префикс, суффикс и проверочное сообщение я хотел, чтобы они оставались своего собственного цвета. Я пробовал использовать ShaderMask
, но это сделает весь текст градиентным.
ShaderMask( blendMode: BlendMode.srcIn, shaderCallback: (bounds) =gt; LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0xFF2577BC), Color(0xFF66BFEB)] ).createShader( Rect.fromLTWH(0, 0, bounds.width, bounds.height), ), child: TextFormField( keyboardType: TextInputType.numberWithOptions(decimal: true), autovalidateMode: AutovalidateMode.onUserInteraction, validator: (value){ if(value.isNullOrEmpty){ return "message.required_field"; } }, inputFormatters: [ DecimalTextInputFormatter(decimalRange: 2) ], textAlign: TextAlign.center, style: theme.textTheme.bodyText1!.copyWith( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 20.sp ), decoration: InputDecoration( contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, enabledBorder: InputBorder.none, errorBorder: InputBorder.none, disabledBorder: InputBorder.none, hintText: "0.00", hintStyle: theme.textTheme.bodyText1!.copyWith( color: Color(0xFFBDBDBD), fontWeight: FontWeight.bold, fontSize: 20.sp ), prefix: Text("$",) ), ), ),