mobile_nebula/lib/screens/siteConfig/CipherScreen.dart
Caleb Jasik 2b844d27dd
Add Flutter lint (#253)
* Enable `flutter_lints` linting

* Fix unmarked deps, we aren't on web so we don't need a URL strategy

* ` dart fix --apply --code=use_super_parameters`

* `dart fix --apply --code=use_key_in_widget_constructors`

* `dart fix --apply --code=use_function_type_syntax_for_parameters`

* Ignore code-generated `lib/services/theme.dart` file

* `dart fix --apply --code=unnecessary_this`

* `dart fix --apply --code=unnecessary_null_in_if_null_operators`

* `dart fix --apply --code=unnecessary_new`

* `dart fix --apply --code=sort_child_properties_last`

* `dart fix --apply --code=sized_box_for_whitespace`

* `dart fix --apply --code=prefer_typing_uninitialized_variables`

* `dart fix --apply --code=prefer_is_empty`

* `dart fix --apply --code=prefer_interpolation_to_compose_strings`

* `dart fix --apply --code=prefer_final_fields`

* `dart fix --apply --code=prefer_const_constructors_in_immutables`

* `dart fix --apply --code=prefer_collection_literals`

* `dart fix --apply --code=no_leading_underscores_for_local_identifiers`

* `dart fix --apply --code=curly_braces_in_flow_control_structures`

* `dart fix --apply --code=avoid_function_literals_in_foreach_calls`

* `dart fix --apply --code=annotate_overrides`

* Add CI for dart linting

* `dart format lib/`

* Re-enable the `usePathUrlStrategy` call, with proper deps

https://docs.flutter.dev/ui/navigation/url-strategies#configuring-the-url-strategy
2025-03-04 11:29:23 -06:00

69 lines
1.8 KiB
Dart

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({super.key, required this.cipher, required this.onSave});
final String cipher;
final ValueChanged<String> onSave;
@override
_CipherScreenState createState() => _CipherScreenState();
}
class _CipherScreenState extends State<CipherScreen> {
late String cipher;
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);
},
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";
});
},
),
],
),
],
),
);
}
}