generate method

  1. @override
Widget? generate(
  1. Context context
)
override

Implementation

@override
Widget? generate(Context context) {
  switch (type) {
    case BossbarType.add:
      return Command('bossbar add $id {"text":"$name"}');
    case BossbarType.remove:
      return Command('bossbar remove $id');
    case BossbarType.get:
      return Command('bossbar get $id ${option!.name}');
    case BossbarType.set:
      {
        var widgets = <Widget>[];
        if (nameTexts != null) {
          widgets.add(Command('bossbar set $id name ${_getNameJson()}'));
        }
        modifiers.forEach((key, value) {
          widgets.add(Command('bossbar set $id $key $value'));
        });
        return For.of(widgets);
      }
    default:
      return null;
  }
}