[SOLVED] Dynamically Change Icons | No Plugins Needed | Cannot Tree shake icons
Автор: FlutterShipp
Загружено: 2021-07-06
Просмотров: 1671
Описание:
#flutter #flutterShip #android #ios
To dynamically / remotely change your app's icons you need to use codepoints, but when releasing the app, you will get the following error
"This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations".
Solution: You need to add "--no-tree-shake-icons" at the end of the comment.
The full comment will be
"flutter build apk --target-platform android-arm,android-arm64 --split-per-abi --no-tree-shake-icons"
This may increase your app size upto 500KB to 1MB, but it's not a big issue.
To dynamically change your app icons, without updating the app, you need to find the codepoint value of the icon. For that go to https://api.flutter.dev/flutter/mater...
Now search for the flutter material icon you want, and then copy it's codepoint value.
Now you can use that value in your class where you render the icon in client side.
Example code snippet to dynamically change the icon is,
IconData iconData = IconData(1234, fontFamily:'Materialicons');
Icon icon = Icon(iconData,color:Colors.blue);
Conclusion:
We have covered two things in this video, one is "This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations" problem.
Another is changing our app icon widgets via remote.
How to dynamically change icons in flutter?
How to change icon immediately from server?
Flutter remotely change app icon
Flutter dynamically change icon
Flutter change app icon dynamically
Change Icon of Icon-Widget dynamically in Flutter
The Simplest way to create icons dynamically in flutter
Change app bar icon dynamically according to data received
Dynamic Icons in Flutter
Dynamically alter Icons on Flutter iOS and Android
Dynamically edit Icons on Flutter iOS and Android
Dynamically modify Icons on Flutter iOS and Android
Software I Used:
ScreenCopy: https://github.com/Genymobile/scrcpy
DeskPin: https://efotinis.neocities.org/deskpi...
PauseMe: https://github.com/peterbitfly/pause....
MaterialIcons: https://fonts.google.com/icons
To Get CodePoints: https://api.flutter.dev/flutter/mater...
Browser: https://brave.com/download/
Operating System: https://www.microsoft.com/en-in/softw...
Hardware I Used:
Laptop: https://amzn.to/3dCBz8q
RAM: https://amzn.to/3yiZGkp
SSD: https://amzn.to/3hcmooE
Monitor: https://amzn.to/3yhdDiS
Samsung J2 Prime Mobile: https://amzn.to/2SJhfLo
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: