Abhilash-Chandran / number_inc_dec

A flutter widget to accept numeric inputs with button to increment and decrement.

Home Page:https://pub.dev/packages/number_inc_dec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to style the TextFormField inside this widget?

abulka opened this issue · comments

There doesn't seem to be a way of styling the TextFormField inside the widget.

Normally I can pass in a style to a TextFormField

TextFormField(
                          initialValue: 'initial',
                          style: TextStyle(
                            color: Colors.green,
                            fontSize: 28,
                          ))

however in the NumberInput widget there is no parameter which passes in the style? Quoting from the source code .../number_inc_dec-0.6.0+3/lib/src/number_increment_decrement.dart I cannot see a style:

TextFormField(
                validator: widget.validator ?? _minMaxValidator,
                textAlign: TextAlign.center,
                autovalidate: widget.autovalidate,
                decoration: widget.numberFieldDecoration ??
                    InputDecoration(
                      border: OutlineInputBorder(
                        borderRadius: BorderRadius.circular(5.0),
                      ),
                    ),
                controller: _controller,
                keyboardType: TextInputType.numberWithOptions(
                  decimal: !widget.isInt,
                  signed: true,
                ),
                inputFormatters: <TextInputFormatter>[
                  widget.isInt
                      ? WhitelistingTextInputFormatter.digitsOnly
                      : WhitelistingTextInputFormatter(
                          RegExp("[0-9.]"),
                        )
                ],
              )

I want to make a big bold counter number textfield - am I missing something?

You are right. This is currently not possible, because I haven't exposed all the TextFormField attributes. For example even the key attribute is missing.However, I am planning to expose more attributes in next minor release 0.6.5. I am sure then this will be possible as you expect.

I kind of assumed this should be possible via InputDecoration attribute, but looks like its not. I have to separately expose it based on my current analysis.

A new style attribute is added in the latest release.