Skip to content

Instantly share code, notes, and snippets.

@tirth-aubergine
Last active December 12, 2019 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tirth-aubergine/beee39887554c1fc906a0ee282219ab5 to your computer and use it in GitHub Desktop.
Save tirth-aubergine/beee39887554c1fc906a0ee282219ab5 to your computer and use it in GitHub Desktop.
Platypus - export config Utils
Future exportCurrentPlatypusConfig(HomeProvider homeProvider) async {
final Directory downloadPath = await getApplicationDocumentsDirectory();
final File configFile = File(
'${downloadPath.path}/platypus-config-${DateTime.now().toString()}.json');
final Map<String, dynamic> config = {
'horizontal_padding':
homeProvider.horizontalPaddingBetweenCodeAndBackground,
'vertical_padding': homeProvider.verticalPaddingBetweenCodeAndBackground,
'font_size': homeProvider.codeFontSize,
'window_circles_style': homeProvider.windowThreeCirclesStyle,
'window_circles_position': homeProvider.windowThreeCirclesPosition,
'highlight_theme': homeProvider.codeHighlightTheme,
'line_height': homeProvider.codeLineHeight,
'show_shadow': homeProvider.showShadow,
'programming_language': homeProvider.codeProgrammingLanguage,
'source_code': homeProvider.codeTextEditingController.text,
'background_color': homeProvider.codeBackgroundColor.value,
};
final generatedConfigFile =
await configFile.writeAsString(jsonEncode(config));
return generatedConfigFile;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment