fix: адаптивная иконка для Minimal
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_minimal_background"/>
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_launcher_minimal_foreground"
|
||||
android:inset="16%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#000000</color>
|
||||
<color name="ic_launcher_minimal_background">#000000</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'dart:io';
|
||||
import 'package:image/image.dart' as img;
|
||||
|
||||
const _densities = {
|
||||
'mdpi': 108,
|
||||
'hdpi': 162,
|
||||
'xhdpi': 216,
|
||||
'xxhdpi': 324,
|
||||
'xxxhdpi': 432,
|
||||
};
|
||||
|
||||
void main() {
|
||||
final src = img.decodePng(File('assets/meteor.png').readAsBytesSync())!;
|
||||
for (final entry in _densities.entries) {
|
||||
final canvas =
|
||||
img.Image(width: entry.value, height: entry.value, numChannels: 4);
|
||||
final scaled = img.copyResize(src,
|
||||
width: entry.value,
|
||||
height: entry.value,
|
||||
interpolation: img.Interpolation.cubic);
|
||||
img.compositeImage(canvas, scaled);
|
||||
final file = File(
|
||||
'android/app/src/main/res/drawable-${entry.key}/ic_launcher_minimal_foreground.png');
|
||||
file.writeAsBytesSync(img.encodePng(canvas));
|
||||
stdout.writeln('wrote ${file.path} (${entry.value}x${entry.value})');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user