DartBlockSettings.fromBrightness constructor

DartBlockSettings.fromBrightness({
  1. bool canChange = true,
  2. bool canDelete = true,
  3. bool canReorder = true,
  4. List<DartBlockNativeFunctionCategory> allowedNativeFunctionCategories = DartBlockNativeFunctionCategory.values,
  5. List<DartBlockNativeFunctionType> allowedNativeFunctionTypes = DartBlockNativeFunctionType.values,
  6. DartBlockColors? colors,
  7. required Brightness brightness,
})

Convenience factory that automatically resolves colors based on brightness.

Implementation

factory DartBlockSettings.fromBrightness({
  bool canChange = true,
  bool canDelete = true,
  bool canReorder = true,
  List<DartBlockNativeFunctionCategory> allowedNativeFunctionCategories =
      DartBlockNativeFunctionCategory.values,
  List<DartBlockNativeFunctionType> allowedNativeFunctionTypes =
      DartBlockNativeFunctionType.values,
  DartBlockColors? colors,
  required Brightness brightness,
}) {
  final resolvedColors = colors ?? DartBlockColors.native();
  return DartBlockSettings(
    canChange: canChange,
    canDelete: canDelete,
    canReorder: canReorder,
    allowedNativeFunctionCategories: allowedNativeFunctionCategories,
    allowedNativeFunctionTypes: allowedNativeFunctionTypes,
    colors: resolvedColors,
    colorFamily: DartBlockColorFamily.fromColors(resolvedColors, brightness),
  );
}