dwyl / learn-flutter

🦋 Learn how to use Flutter to Build Cross-platform Native Mobile Apps
https://flutter.dev
GNU General Public License v2.0
87 stars 8 forks source link

Research: How to create a Progressive Web App (PWA) using `Flutter` #80

Closed nelsonic closed 1 year ago

nelsonic commented 1 year ago

At present I am using the MVP in Safari Desktop and Mobile on my Mac and iPhone respectively.

image

It's an "OK" experience during MVP ... but we can do much better even in the short-term.

As we recently saw with Hoppscotch: /dwyl/mvp/hoppscotch.md#hoppscotch-setup The recommended approach to running their App is to "Install" it as a "Chrome" App:

image

Which is exactly how I run it on my localhost:

image

It means that it runs full-screen and you can command | alt+tab and immediately find it:

image

6 Second Demo: https://user-images.githubusercontent.com/194400/219318400-e5a14779-ccb3-479f-a8fc-73700323016a.mov

Todo

nelsonic commented 1 year ago

@LuchoTurtle do you want to take a look at this today?

LuchoTurtle commented 1 year ago

Sure 👍

nelsonic commented 1 year ago

@LuchoTurtle to answer your question regarding which of our Flutter Demo Apps should be enhanced with PWA capability, it would be cool to add it to one that demos something useful like https://github.com/dwyl/flutter-todo-list-tutorial but that appears to not be deployed anywhere so that's why I was suggesting the https://github.com/dwyl/flutter-phoenix-channels-demo which is on Fly.io: https://flutter-phoenix-channels-frontend.fly.dev/#/

Which I just checked: has a PWA option

image

"Installed" the same as Hoppscotch:

image

When I "install" it I get a full-screen:

image

Demo screen recording: https://user-images.githubusercontent.com/194400/219611430-5363cd72-1516-484f-8f60-08b2fdab9a2e.mov

But the App Logo is just the Flutter one:

image

So it appears as though just the act of deploying the Flutter App to Fly.io ("Web") automagically added some basic PWA support!! 🎉

So "all" we need to do is document how to update the icon and we can already start adding PWA support to our App !! 🚀

nelsonic commented 1 year ago

So ... some of the work for getting PWA support for our App is already done for us! 🙌 We now need to figure out if there is extra work to enable it for a subdomain e.g: app.dwyl.com And what format the icon/logo has to be to appear on macOS and iOS when the Flutter app is "installed".

Do you mind picking this up and documenting it in a pwa.md here in learn-flutter? 🙏

nelsonic commented 1 year ago

Given that the "Channels Demo" has been deployed Fly.io, it's the one that has the most progress. Please enhance the Channels Demo with a Logo and document it in pwa.md and shift the contents of https://github.com/dwyl/flutter-phoenix-channels-demo/tree/main/app#deploying to a new file called deployment.md in learn-flutter so that it's easier to find. Thanks. 👌

LuchoTurtle commented 1 year ago

This issue is addressed by these two PRs:

https://github.com/dwyl/learn-flutter/pull/81 https://github.com/dwyl/flutter-phoenix-channels-demo/pull/3

nelsonic commented 1 year ago

Remove the old version:

uninstall-remove-app

New version has updated logo:

image image

PWA working:

image