Skip to content
Snippets Groups Projects
Select Git revision
  • 1f3741b4fe1d805eb05103ea5506876005ed072f
  • master default protected
  • 21-add-onlongpress-with-popup-on-parameters
  • 23-center-vertically-buttons
  • 30-highlight-bin-when-selecting-disabled-item
  • 1.0.7 protected
  • 1.0.6 protected
  • 1.0.5 protected
  • 1.0.4 protected
  • 1.0.3 protected
  • 1.0.2 protected
  • 1.0.0 protected
  • 0.9.1 protected
  • 0.9.0 protected
  • 0.8.4 protected
  • 0.8.3 protected
  • 0.8.2 protected
  • 0.8.1 protected
  • 0.8.0 protected
  • 0.7.0 protected
  • 0.6.1 protected
  • 0.6.0 protected
  • 0.5.0 protected
  • 0.4.0 protected
  • 0.3.0 protected
25 results

pubspec.yaml

Blame
  • default_game_settings.dart 1.32 KiB
    import 'package:sortgame/data/fetch_data_helper.dart';
    import 'package:sortgame/utils/tools.dart';
    
    class DefaultGameSettings {
      // available game parameters codes
      static const String parameterCodeItemsCount = 'itemsCount';
      static const String parameterCodeThemeIndex = 'theme';
      static const List<String> availableParameters = [
        parameterCodeItemsCount,
        parameterCodeThemeIndex,
      ];
    
      // items count: available values
      static const int itemsCountValueLow = 5;
      static const int itemsCountValueMedium = 10;
      static const int itemsCountValueHigh = 15;
      static const int itemsCountValueVeryHigh = 20;
      static const List<int> allowedItemsCountValues = [
        itemsCountValueLow,
        itemsCountValueMedium,
        itemsCountValueHigh,
        itemsCountValueVeryHigh,
      ];
      // items count: default value
      static const int defaultItemsCountValue = itemsCountValueMedium;
    
      static const int defaultThemeValue = 0;
    
      static List<int> getAvailableValues(String parameterCode) {
        switch (parameterCode) {
          case 'itemsCount':
            return DefaultGameSettings.allowedItemsCountValues;
          case 'theme':
            final int count = FetchDataHelper().getThemes().length;
            return List<int>.generate(count, (i) => i);
        }
    
        printlog('Did not find any available value for game parameter "$parameterCode".');
        return [];
      }
    }