stryder-dev / flutter_platform_widgets

Target the specific design of Material for Android and Cupertino for iOS widgets through a common set of Platform aware widgets
MIT License
1.57k stars 171 forks source link

How can I apply decoration to PlatformTextFormField ? #436

Closed developer82 closed 9 months ago

developer82 commented 11 months ago

I see that most of the TextFormField properties I expect to find are there, but decoration isn't, but I do need to apply my own decoration.

bookshiyi commented 11 months ago

May be you could try it like this:

PlatformTextFormField(
    hintText: 'hint',
    validator: (value) =>
        (value?.length ?? 0) < 3 ? 'Not enough' : null,
    autovalidateMode: AutovalidateMode.always,
+   material: (_, __) => MaterialTextFormFieldData(
+     decoration: 
+     ...
+   ),
+   cupertino: (_, __) => CupertinoTextFormFieldData(
+     decoration: 
+     ...
+   ),
  ),
aqwert commented 9 months ago

As @bookshiyi states you need to use the material and cupertino fields since they use different types. InputDecoration for material and BoxDecoration for cupertino