I have Flutter app that is using Cupertino UI components. I want to show the the Material design date_picker instead of IOS style date picker. Is there any way I can do this?
In short I want to keep the same Material style date picker for both Android and IOS app. But whenever I use the date picker under Cupertino it throws an exception "The specific widget that could not find a Material ancestor".
Thank you for your time
According to this medium post you can create an abstract class extending a
StatelessWidget
and using thedart.io
package to determine the platform type. In your case you can test whether the underlying platform isIOS
and use the material date picker using this :you can find the full code in the aforementioned post and it'll be easy to follow it.