added fonts for dark screenshots

This commit is contained in:
Vadim 2024-05-14 14:52:58 +02:00
parent d2a953e1f5
commit c7d0d8a7f1
4 changed files with 9 additions and 4 deletions

Binary file not shown.

View file

@ -17,7 +17,6 @@ extension ScreenshotImage on Image {
if (_configs[args.name] == null) { if (_configs[args.name] == null) {
return this; return this;
} }
print(args.deviceName);
return _addSystemOverlay( return _addSystemOverlay(
screenshotDevices[args.deviceName]!, screenshotDevices[args.deviceName]!,
isDark: args.isDark, isDark: args.isDark,
@ -36,6 +35,7 @@ extension ScreenshotImage on Image {
layout, layout,
_configs[args.name]!.title, _configs[args.name]!.title,
_configs[args.name]!.subtitle, _configs[args.name]!.subtitle,
isDark: args.isDark,
); );
} }
@ -96,9 +96,11 @@ extension ScreenshotImage on Image {
); );
} }
Image _addText(ScreenshotLayout layout, String title, String subtitle) { Image _addText(ScreenshotLayout layout, String title, String subtitle, {required bool isDark}) {
final titleFont = BitmapFont.fromZip(File(layout.titleFontPath).readAsBytesSync()); final titleFont =
final subtitleFont = BitmapFont.fromZip(File(layout.subtitleFontPath).readAsBytesSync()); BitmapFont.fromZip(File(isDark ? layout.titleFontDarkPath : layout.titleFontPath).readAsBytesSync());
final subtitleFont =
BitmapFont.fromZip(File(isDark ? layout.subtitleFontDarkPath : layout.subtitleFontPath).readAsBytesSync());
final textImage = fill( final textImage = fill(
Image( Image(
height: titleFont.lineHeight + 36 + subtitleFont.lineHeight * 2, height: titleFont.lineHeight + 36 + subtitleFont.lineHeight * 2,

View file

@ -17,6 +17,9 @@ enum ScreenshotLayout {
final String titleFontPath; final String titleFontPath;
final String subtitleFontPath; final String subtitleFontPath;
String get titleFontDarkPath => '${titleFontPath.split('.').first}-dark.zip';
String get subtitleFontDarkPath => '${subtitleFontPath.split('.').first}-dark.zip';
const ScreenshotLayout({ const ScreenshotLayout({
required this.size, required this.size,
required this.contentPadding, required this.contentPadding,