Implementation
@override
ui.Tool get statusTool {
return ui.TextButtonTool.statusbar(
toolValue: _orgQuotaNotifier,
icon: (param) {
if (param!.isNotNull) {
final quota = param.value!;
if (quota.used >= quota.limit) {
if (quota.softLimit) {
return const Icon(
Icons.warning,
color: Colors.red,
size: 16,
);
} else {
return const Icon(
Icons.block,
color: Colors.red,
size: 16,
);
}
} else if (quota.used > quota.limit * 0.8) {
return const Icon(
Icons.warning,
color: Colors.amber,
size: 16,
);
} else {
return const Icon(
Icons.check,
color: Colors.green,
size: 16,
);
}
} else {
return null;
}
},
text: (param) {
if (param!.isNotNull) {
final quota = param.value!;
return '${quota.description}: ${quota.used}/${quota.limit}';
} else {
return '< --quota-- >';
}
},
tooltip: (param) {
if (param!.isNotNull) {
final quota = param.value!;
if (quota.used >= quota.limit) {
if (quota.softLimit) {
return 'quota limit has been exceeded for the organization, overage charges may be applied';
} else {
return 'quota limit has been reached for the organization, no further resources can be allocated';
}
} else if (quota.used > quota.limit * 0.8) {
return 'quota usage is approaching the limit for the organization';
}
}
return null;
},
onInit: () => _sub = _orgService.stream.listen(
(state) {
_updateQuotaStatus();
},
),
onDispose: () => _sub?.cancel(),
);
}