toggleDonate method
Adds or removes DonateButton from the panel.
Implementation
void toggleDonate(bool enabled, {double minimum = 1}) {
panel.removeWhere((e) => e is DonatesButton);
if (enabled) {
final List<Price> prices = [
Price.xxx(1),
Price.xxx(2),
Price.xxx(5),
Price.xxx(10),
Price.xxx(25),
Price.xxx(50),
Price.xxx(100),
];
panel.add(
DonatesButton(() {
overlay.addAll([
BuilderButton((context) {
final style = Theme.of(context).style;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
Row(
children: [
const SizedBox(width: 12),
Expanded(
child: Text(
'label_minimum_amount_semicolon'.l10n,
style: style.fonts.small.regular.secondary,
),
),
Text(
Price.xxx(minimum).l10n,
style: style.fonts.small.regular.secondary,
),
const SizedBox(width: 12),
],
),
const SizedBox(height: 8),
const Padding(
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: LineDivider(''),
),
],
);
}),
...prices.map((e) {
return DonateButton(
hint: e.l10n,
onPressed: () => donation.value = e.sum.val,
trailing: SendDonateButton(
() => onSubmit?.call(donateOnly: e.sum.val),
),
);
}),
]);
}),
);
}
}