mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 02:01:36 +03:00
Merge PR #32.
This commit is contained in:
commit
cde3b14ef1
@ -35,7 +35,9 @@ class AboutPage extends ConsumerWidget {
|
||||
children: [Level.INFO, Level.CONFIG, Level.FINE]
|
||||
.map((level) => TextButton(
|
||||
onPressed: () {
|
||||
ref.read(logLevelProvider.notifier).state = level;
|
||||
ref
|
||||
.read(logLevelProvider.notifier)
|
||||
.setLogLevel(level);
|
||||
log.info(
|
||||
'Log level changed to ${level.name.toUpperCase()}');
|
||||
},
|
||||
|
@ -9,6 +9,16 @@ final prefProvider = Provider<SharedPreferences>((ref) {
|
||||
throw UnimplementedError();
|
||||
});
|
||||
|
||||
final logLevelProvider = StateProvider<Level>((ref) => Logger.root.level);
|
||||
final logLevelProvider = StateNotifierProvider<LogLevelNotifier, Level>(
|
||||
(ref) => LogLevelNotifier(Logger.root.level));
|
||||
|
||||
class LogLevelNotifier extends StateNotifier<Level> {
|
||||
LogLevelNotifier(Level level) : super(level);
|
||||
|
||||
void setLogLevel(Level level) {
|
||||
Logger.root.level = level;
|
||||
state = level;
|
||||
}
|
||||
}
|
||||
|
||||
final isDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
||||
|
Loading…
Reference in New Issue
Block a user