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

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

71 lines
1.8 KiB
Dart
Raw 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 CipherScreen extends StatefulWidget {
const CipherScreen({
Key? key,
required this.cipher,
required this.onSave,
}) : super(key: key);
2020-07-27 20:43:58 +00:00
final String cipher;
final ValueChanged<String> onSave;
@override
_CipherScreenState createState() => _CipherScreenState();
}
class _CipherScreenState extends State<CipherScreen> {
late String cipher;
2020-07-27 20:43:58 +00:00
bool changed = false;
@override
void initState() {
cipher = widget.cipher;
super.initState();
}
@override
Widget build(BuildContext context) {
return FormPage(
title: 'Cipher Selection',
changed: changed,
onSave: () {
Navigator.pop(context);
widget.onSave(cipher);
2020-07-27 20:43:58 +00:00
},
child: Column(
children: <Widget>[
ConfigSection(children: [
ConfigCheckboxItem(
label: Text("aes"),
labelWidth: 150,
checked: cipher == "aes",
onChanged: () {
setState(() {
changed = true;
cipher = "aes";
});
},
),
ConfigCheckboxItem(
label: Text("chachapoly"),
labelWidth: 150,
checked: cipher == "chachapoly",
onChanged: () {
setState(() {
changed = true;
cipher = "chachapoly";
});
},
)
])
],
));
}
}