Dmitry Sergienko
Dmitry Sergienko

Reputation: 115

(pinput 4.0.0) Flutter pinput widget how to change the error alert text parameters like text color,size and font?

Flutter pinput widget how to change the error alert text parameters like text color,size and font? I can not to change the error alert text style at all. My code inside the Pinput() is

 errorPinTheme: defaultPinTheme.copyWith(
                      decoration: BoxDecoration(
                        color: AppColors.secondary.redLight,
                        borderRadius: BorderRadius.circular(5),
                        border: Border.all(color: Colors.redAccent),

                      ),
                      textStyle: const TextStyle(

                        fontSize: 22,
                        fontWeight: FontWeight.w400,
                        color: Color(0xFFE0193D),
                      ),
                    ),

Upvotes: 0

Views: 151

Answers (1)

Dmitry Sergienko
Dmitry Sergienko

Reputation: 115

There is no option to change TextStyle. Only I found a variant add cast text on the bottom of the otp widget. The errorPinTheme make invisible and almost no size:

      final errorPinTheme = PinTheme(
          width: 0,
          height: 0,
          textStyle: const TextStyle(
            fontSize: 0,
            color: Colors.transparent,
          ),
          decoration: BoxDecoration(
            color: fillColor,
            borderRadius: BorderRadius.circular(5),
            border: Border.all(color: borderColor),
          ),
        );

and in the Column(
        children: [ ... //


 errorPinTheme: errorPinTheme,
                        submittedPinTheme: defaultPinTheme.copyWith(
                          decoration: defaultPinTheme.decoration!.copyWith(
                            color: fillColor,
                            borderRadius: BorderRadius.circular(5),
                            border: Border.all(color: focusedBorderColor),
                          ),
                        ),
                      ),
                    ),
                  ),
                  if (currentErrorMessage != null)
                    Padding(
                      padding: const EdgeInsets.only(top: 8.0),
                      child: Text(
                        currentErrorMessage!,
                        style: const TextStyle(
                          fontSize: 14,
                          fontWeight: FontWeight.w400,
                          color: Color(0xFFE0193D),
                        ),
                        textAlign: TextAlign.left,
                      ),
                    ),

Upvotes: 0

Related Questions