Search code examples
flutterwebviewandroid-webviewflutter-dependenciesflutter-inappwebview

Why does DatePicker in Flutter InAppWebView look old?


I am creating a Flutter application that consists of displaying a simple webview using the InAppWebView 6.0.0 dependency with the latest stable version of Flutter. It's happening to me that when I go to enter data of type "date" on the website, a date selection interface that is quite ugly and obsolete opens up.

screenshot

I have also tested it using the normal webview and there yes is visible the modern date selection interface. I have made sure that the style is configured correctly and nothing is either. I have also been able to see that on iPhone with the same configuration it looks good.

I would like to know if anyone else has had this problem and found the solution without having to touch the side of the web page :)

I have made sure that the style is correctly configured and the dependencies are in the latest version.


Solution

  • The flutter_inappwebview package uses PlatformViews, which requires you to add Android's Material dependency if you want to enable Material Design.

    In android/app/build.gradle, add this implementation to the dependencies block:

    dependencies {
        // ...
        implementation 'com.google.android.material:material:<version>'
        // ...
    }
    

    Replace <version> with the latest version of the plugin, which you can find here.


    See also: