forked from Nexus/nexus
add power level room settings
This commit is contained in:
parent
fcfe4eed1e
commit
b0dd452926
1 changed files with 944 additions and 179 deletions
20
lib/controllers/power_levels_saving.dart
Normal file
20
lib/controllers/power_levels_saving.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
class PowerLevelsSavingController(final String roomId) extends Notifier<bool> {
|
||||
@override
|
||||
bool build() => false;
|
||||
|
||||
Future<void> run(Future<void> Function() action) async {
|
||||
state = true;
|
||||
try {
|
||||
await action();
|
||||
} finally {
|
||||
if (ref.mounted) state = false;
|
||||
}
|
||||
}
|
||||
|
||||
static final provider = NotifierProvider.autoDispose
|
||||
.family<PowerLevelsSavingController, bool, String>(
|
||||
PowerLevelsSavingController.new,
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue