The methid for creating the platform widgets is as follows
- Generally each platform widget is a wrapper to the underlying Material or Cupertino widget.
- Generally they do not include any specific styles or logic. Except Navbar and Appbar
- Each platform widget should expose in the constructor as named arguments the same fields each Material and Cupertino underlying widgets share
- All constructor arguments will take the same defaults from the underlying widgets and set on the platform widget being created
- Only mark as @required if both underlying widgets also have them marked as @required
- Each platform widget will provide a platform specifc builder to provide extra arguments targeting that platform. The name will match the platform control being created. i.e MaterialTextFieldData and CupertinoTextFieldData for PlatformTextField
- Each data class will have all the constructor arguments of the underlying widget.
- If the argunent already exists on the base platform widget then the default value for the arguemnt will be removed
- If the argument does not exist on the base platform widget then the default value (if it has one) for the argument will be set
- In constructing the underlying widget each argument will be of the following syntax:
value = data?.value ?? value
for arguments shared between platformsvalue = data?.value
for arguments not shared between platforms and only exists on that one platform without a default argumentvalue = data?.value ?? _kDefaultArg
for arguments not shared between platforms and only exists on that one platform with a default argument on the underlying widget
- If underlying widgets share the same argument but the default values are differnet than that will need to be set as part of the platform constructor. See PlatformTextField fo example
style = style ?? (isMaterial ? null : _kDefaultTextStyle),