mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
f62f658be8
* added system overlays for iPhone 8 Plus & iPhone 13 Pro * add device frame (wip) * scale device frame (wip) * add text to screenshots (wip) * added screenshots config json * reorganized screenshot models * cleanup * added fonts for dark screenshots * typo * store raw screenshots * added standalone script to update screenshots * wip * refined screenshots naming * skip metering layout dialog screenshot * parse ipad name * added assets for Pixel 6 * typo * added text for incident light metering * reorganized store script * typo * wip * synced outlined icons * added timer screen to screenshot generator * constrained timer screen timeline for tablets * added timer screenshot title * typo * revised scripts * track release screenshots * Update README.md * iphone 6.5" -> iphone 6.7" * Update google_play_resources.md * softened screenshot font colors * cleanup
60 lines
2 KiB
Dart
60 lines
2 KiB
Dart
import 'dart:convert';
|
|
|
|
class ScreenshotArgs {
|
|
final String name;
|
|
final String deviceName;
|
|
final String platformFolder;
|
|
final String backgroundColor;
|
|
final bool isDark;
|
|
|
|
static const _pathArgsDelimited = '_';
|
|
|
|
ScreenshotArgs({
|
|
required this.name,
|
|
required String deviceName,
|
|
required this.platformFolder,
|
|
required this.backgroundColor,
|
|
required this.isDark,
|
|
}) : deviceName = deviceName.replaceAll(' ', _pathArgsDelimited).replaceAll(RegExp('[(|)]'), '').toLowerCase();
|
|
|
|
ScreenshotArgs.fromRawName({
|
|
required String name,
|
|
required String deviceName,
|
|
required this.platformFolder,
|
|
}) : name = name.split(_pathArgsDelimited)[1],
|
|
deviceName = deviceName.replaceAll(' ', _pathArgsDelimited).replaceAll(RegExp('[(|)]'), '').toLowerCase(),
|
|
backgroundColor = name.split(_pathArgsDelimited)[2],
|
|
isDark = name.contains('dark');
|
|
|
|
static const _folderPrefix = 'screenshots/generated';
|
|
String get nameWithTheme => '${isDark ? 'dark' : 'light'}$_pathArgsDelimited$name';
|
|
|
|
String toPathRaw() =>
|
|
'$_folderPrefix/raw/$platformFolder/$deviceName/$nameWithTheme$_pathArgsDelimited$backgroundColor.png';
|
|
String toPath(String layoutName) => '$_folderPrefix/$platformFolder/$layoutName/$nameWithTheme.png';
|
|
|
|
@override
|
|
String toString() => jsonEncode(_toJson());
|
|
|
|
factory ScreenshotArgs.fromString(String data) => ScreenshotArgs._fromJson(jsonDecode(data) as Map<String, dynamic>);
|
|
|
|
factory ScreenshotArgs._fromJson(Map<String, dynamic> data) {
|
|
return ScreenshotArgs(
|
|
name: data['name'] as String,
|
|
deviceName: data['deviceName'] as String,
|
|
platformFolder: data['platformFolder'] as String,
|
|
backgroundColor: data['backgroundColor'] as String,
|
|
isDark: data['isDark'] as bool,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> _toJson() {
|
|
return {
|
|
"name": name,
|
|
"deviceName": deviceName,
|
|
"platformFolder": platformFolder,
|
|
"backgroundColor": backgroundColor,
|
|
"isDark": isDark,
|
|
};
|
|
}
|
|
}
|