updateFeatureLevelChangeDialog function

Future<bool> updateFeatureLevelChangeDialog(
  1. dynamic context,
  2. int maxPowerLevel,
  3. int? currentPw,
  4. dynamic space,
  5. dynamic powerLevels,
  6. String levelKey,
  7. String featureName,
)

Implementation

Future<bool> updateFeatureLevelChangeDialog(
  BuildContext context,
  int maxPowerLevel,
  int? currentPw,
  Space space,
  RoomPowerLevels powerLevels,
  String levelKey,
  String featureName,
) async {
  final lang = L10n.of(context);
  final newPowerLevel = await showDialog<int?>(
    context: context,
    builder: (BuildContext context) => _ChangePowerLevelDialog(
      featureName: featureName,
      currentPowerLevelName:
          maxPowerLevel == 100 ? powerLevelName(currentPw) : 'Custom',
      currentPowerLevel: currentPw,
    ),
  );
  if (newPowerLevel == currentPw) return false;
  if (!context.mounted) {
    EasyLoading.dismiss();
    return true;
  }

  return await updateFeatureLevel(
    lang,
    space,
    levelKey,
    featureName,
    newPowerLevel,
  );
}