3
0
Fork 0
trifid_mobile/lib/screens/siteConfig/LogVerbosityScreen.dart

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
1.7 KiB
Dart
Raw Permalink Normal View History

2020-07-27 20:43:58 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:mobile_nebula/components/FormPage.dart';
import 'package:mobile_nebula/components/config/ConfigCheckboxItem.dart';
import 'package:mobile_nebula/components/config/ConfigSection.dart';
class LogVerbosityScreen extends StatefulWidget {
const LogVerbosityScreen({
Key? key,
required this.verbosity,
required this.onSave,
}) : super(key: key);
2020-07-27 20:43:58 +00:00
final String verbosity;
final ValueChanged<String> onSave;
@override
_LogVerbosityScreenState createState() => _LogVerbosityScreenState();
}
class _LogVerbosityScreenState extends State<LogVerbosityScreen> {
late String verbosity;
2020-07-27 20:43:58 +00:00
bool changed = false;
@override
void initState() {
verbosity = widget.verbosity;
super.initState();
}
@override
Widget build(BuildContext context) {
return FormPage(
title: 'Log Verbosity',
changed: changed,
onSave: () {
Navigator.pop(context);
widget.onSave(verbosity);
2020-07-27 20:43:58 +00:00
},
child: Column(
children: <Widget>[
ConfigSection(children: [
_buildEntry('debug'),
_buildEntry('info'),
_buildEntry('warning'),
_buildEntry('error'),
_buildEntry('fatal'),
_buildEntry('panic'),
])
],
));
}
Widget _buildEntry(String title) {
return ConfigCheckboxItem(
label: Text(title),
labelWidth: 150,
checked: verbosity == title,
onChanged: () {
setState(() {
changed = true;
verbosity = title;
});
},
);
}
}