flutter_carplay
flutter_carplay copied to clipboard
FCPListItem does not support imageUrl
Current implementation to set an image to a listItem is using an asset
if image != nil {
listItem.setImage(UIImage().fromFlutterAsset(name: image!))
}
It should be possible to also use a HTTPs link to an image so we don't need to ship every image in assets
Hi @vanlooverenkoen I was able to load list items with image url by doing the following.
-
Open the flutter iOS project in XCODE
-
Open the PODS->Development Pods->flutter_carplay
-
Open the preceding .. unto the last directory, you will find flutter_carplay->Classes->Models -> Lists
-
Navigate to FCPListItem.
-
Find the codes:
-
if image != nil { ...
7.Replace with : ` if image != nil { if image!.starts(with: "http"){let url = URL(string: image!) let stationImage = try? UIImage(withURL: url!) listItem.setImage(stationImage) }else{ listItem.setImage(UIImage().fromFlutterAsset(name: image!)) }
}`
-
Inside update, do the same. This will intercept all urls beginning with http with custom loader and those beginning with any other format as asset images. Thank you.
Yes indeed that is why a pull request implementing this feature a month ago. #24
flutter: Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction , After loading images from ulr i got this error and the mobile app ui freezes .