Coder Social home page Coder Social logo

Comments (6)

hamishjohnson avatar hamishjohnson commented on May 24, 2024 1

Ok, thanks!

I think there might be something I misunderstand about this package, or the flutter sdk. It just creates a more customised ThemeData at the end of the day, right?

But then it confuses me why a border: InputBorder.none on the InputDecoration doesn't work. Is that just part of the flutter sdk, that if InputDecorationTheme has a border, InputBorder.none no longer works?

from flex_color_scheme.

rydmike avatar rydmike commented on May 24, 2024

Hi @hamishjohnson, thanks for the issue report.

It is a correct observation, to not have any border when an input is focused is something the current does not include.

Also changing border width to 0 does not help because of how the Flutter framework handles border width 0, which actually draws a border with physical pixel 1, when you set it to 0.

https://github.com/flutter/flutter/blob/68dd63d66ba6359b377a48c3bb4b028ab5ef5140/packages/flutter/lib/src/painting/borders.dart#L116

Funky right :)

For the existing unfocused border case, it is handled as a separate case to just not include any border in theme when the flag is set. But alas there is no, noFocusedBorder flag or case in FCS's current features.

Your timing is actually very good, since I am in the process of adding better M3 support and more features for FCS to the InputDecoratorTheme. I had not actually thought about this particular theming use-case, but it makes perfect sense to add it as well.

In FlexColorScheme docs I mention that its intention is not to offer everything you can do with ThemeData and its component sub-themes. The intent is to make common use cases quicker and easier to configure, and on the color themes side to also do things the framework simply cannot do out of the box.

That being said, configuring the InputDecorationTheme is silly complex and tedious and including this makes sense while anyway reworking it.

Meanwhile, if you urgently need themed support for this, you can always amend and modify the ThemeData that FlexColorScheme outputs to do it already now using copyWith on the ThemeData and the InputDecorationTheme it produces.

If you are not familiar with this, there are a few related examples in the discussion, for example this one #92

In any case, thanks bringing up this feature gap and need. I plan to land support for this in next feature release that will be out shortly after Flutter Forward on Jan 25th. Might be a few days later since I will actually be physically at the event in Nairobi 😄

from flex_color_scheme.

rydmike avatar rydmike commented on May 24, 2024

Just to be clear @hamishjohnson, as soon as you make a global InputDecorationTheme theme in ThemeData that has a border, also a TextField using InputDecoration.collapsed will have same borders.

If you want borders otherwise on regular text fields, as a part of the theme, but automatically not when using InputDecoration.collapsed that is not possible. You will have to wrap the part of your tree / widget, where you are using InputDecoration.collapsed with an InputDecorationTheme that does not include any borders.

What the new feature I'm adding will do, is let you create a global InputDecorationTheme without any borders.

Screenshot 2023-01-16 at 17 12 11

from flex_color_scheme.

rydmike avatar rydmike commented on May 24, 2024

There is a separate input border property for every state (enabled, focused, hover, error, focusedError, disabled) in InputDecoration, and the theme uses them all, it does not even use border at all if I recall correctly. To get rid of it, and override what the theme has defined you need to set InputBorder.none on all of them on widget level.

The InputDecorator has a bit mixed bag legacy API. It uses MaterialState property for newer parts, but older parts still sport the old style with a property per state.

I actually tried to get it to work by using only border and MaterialState, in the theme in my new wip version, it should work, but it did not work correctly. So I had to revert and still use all the individual properties. I made a note to revisit it later and make an issue report of it, if I can repeat and demonstrate the problem in isolation.

TextField and InputDecoration is quite involved and tricky. The Flutter code behind them is quite fascinating and really deep rabbit holes to study 😀

from flex_color_scheme.

rydmike avatar rydmike commented on May 24, 2024

Still same milestone target, but the release will be called 7.0.0, since I am introducing a few minor default style breaking changes. There are no breaking API changes though. There is a beta of it available on pub if you are feeling experimental, it includes this new property.
https://pub.dev/packages/flex_color_scheme/versions/7.0.0-dev.2

from flex_color_scheme.

rydmike avatar rydmike commented on May 24, 2024

Final beta of version 7 is out. There will be no additional features or API changes in the stable release. More info in this tweet thread:

https://twitter.com/RydMike/status/1637228788139302914?s=20

Feel free to try it.

Closing this feature request as delivered in version7 final beta. Well to the degree it can be supported by current InputDecorator theme in Flutter anyway.

from flex_color_scheme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.