dart fix --apply --code=use_super_parameters

This commit is contained in:
Caleb Jasik 2025-02-13 11:12:35 -06:00
parent 982236f2c9
commit 54b625acfc
No known key found for this signature in database
40 changed files with 68 additions and 76 deletions

View file

@ -8,7 +8,7 @@ import 'IPField.dart';
//TODO: Support initialValue
class CIDRField extends StatefulWidget {
const CIDRField({
Key? key,
super.key,
this.ipHelp = "ip address",
this.autoFocus = false,
this.focusNode,
@ -17,7 +17,7 @@ class CIDRField extends StatefulWidget {
this.textInputAction,
this.ipController,
this.bitsController,
}) : super(key: key);
});
final String ipHelp;
final bool autoFocus;

View file

@ -6,21 +6,18 @@ import 'package:mobile_nebula/validators/ipValidator.dart';
class CIDRFormField extends FormField<CIDR> {
//TODO: onSaved, validator, auto-validate, enabled?
CIDRFormField({
Key? key,
super.key,
autoFocus = false,
enableIPV6 = false,
focusNode,
nextFocusNode,
ValueChanged<CIDR>? onChanged,
FormFieldSetter<CIDR>? onSaved,
super.onSaved,
textInputAction,
CIDR? initialValue,
super.initialValue,
this.ipController,
this.bitsController,
}) : super(
key: key,
initialValue: initialValue,
onSaved: onSaved,
validator: (cidr) {
if (cidr == null) {
return "Please fill out this field";

View file

@ -4,7 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class DangerButton extends StatelessWidget {
const DangerButton({Key? key, required this.child, this.onPressed}) : super(key: key);
const DangerButton({super.key, required this.child, this.onPressed});
final Widget child;
final GestureTapCallback? onPressed;

View file

@ -6,14 +6,14 @@ import 'package:mobile_nebula/services/utils.dart';
/// SimplePage with a form and built in validation and confirmation to discard changes if any are made
class FormPage extends StatefulWidget {
const FormPage({
Key? key,
super.key,
required this.title,
required this.child,
required this.onSave,
required this.changed,
this.hideSave = false,
this.scrollController,
}) : super(key: key);
});
final String title;
final Function onSave;

View file

@ -8,7 +8,7 @@ import 'IPField.dart';
//TODO: Support initialValue
class IPAndPortField extends StatefulWidget {
const IPAndPortField({
Key? key,
super.key,
this.ipOnly = false,
this.ipHelp = "ip address",
this.autoFocus = false,
@ -20,7 +20,7 @@ class IPAndPortField extends StatefulWidget {
this.ipTextAlign,
this.ipController,
this.portController,
}) : super(key: key);
});
final String ipHelp;
final bool ipOnly;

View file

@ -8,7 +8,7 @@ import 'IPAndPortField.dart';
class IPAndPortFormField extends FormField<IPAndPort> {
//TODO: onSaved, validator, auto-validate, enabled?
IPAndPortFormField({
Key? key,
super.key,
ipOnly = false,
enableIPV6 = false,
ipHelp = "ip address",
@ -16,17 +16,14 @@ class IPAndPortFormField extends FormField<IPAndPort> {
focusNode,
nextFocusNode,
ValueChanged<IPAndPort>? onChanged,
FormFieldSetter<IPAndPort>? onSaved,
super.onSaved,
textInputAction,
IPAndPort? initialValue,
super.initialValue,
noBorder,
ipTextAlign = TextAlign.center,
this.ipController,
this.portController,
}) : super(
key: key,
initialValue: initialValue,
onSaved: onSaved,
validator: (ipAndPort) {
if (ipAndPort == null) {
return "Please fill out this field";

View file

@ -17,7 +17,7 @@ class IPField extends StatelessWidget {
final textAlign;
const IPField({
Key? key,
super.key,
this.ipOnly = false,
this.help = "ip address",
this.autoFocus = false,
@ -28,7 +28,7 @@ class IPField extends StatelessWidget {
this.textInputAction,
this.controller,
this.textAlign = TextAlign.center,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {

View file

@ -9,7 +9,7 @@ import 'IPField.dart';
class IPFormField extends FormField<String> {
//TODO: validator, auto-validate, enabled?
IPFormField({
Key? key,
super.key,
ipOnly = false,
enableIPV6 = false,
help = "ip address",
@ -17,7 +17,7 @@ class IPFormField extends FormField<String> {
focusNode,
nextFocusNode,
ValueChanged<String>? onChanged,
FormFieldSetter<String>? onSaved,
super.onSaved,
textPadding = const EdgeInsets.all(6.0),
textInputAction,
initialValue,
@ -25,9 +25,7 @@ class IPFormField extends FormField<String> {
crossAxisAlignment = CrossAxisAlignment.center,
textAlign = TextAlign.center,
}) : super(
key: key,
initialValue: initialValue,
onSaved: onSaved,
validator: (ip) {
if (ip == null || ip == "") {
return "Please fill out this field";

View file

@ -6,7 +6,7 @@ import 'package:mobile_nebula/components/SpecialTextField.dart';
class PlatformTextFormField extends FormField<String> {
//TODO: auto-validate, enabled?
PlatformTextFormField({
Key? key,
super.key,
widgetKey,
this.controller,
focusNode,
@ -28,11 +28,9 @@ class PlatformTextFormField extends FormField<String> {
String? initialValue,
String? placeholder,
FormFieldValidator<String>? validator,
ValueChanged<String?>? onSaved,
super.onSaved,
}) : super(
key: key,
initialValue: controller != null ? controller.text : (initialValue ?? ''),
onSaved: onSaved,
validator: (str) {
if (validator != null) {
return validator(str);

View file

@ -6,7 +6,7 @@ enum SimpleScrollable { none, vertical, horizontal, both }
class SimplePage extends StatelessWidget {
const SimplePage({
Key? key,
super.key,
required this.title,
required this.child,
this.leadingAction,
@ -19,7 +19,7 @@ class SimplePage extends StatelessWidget {
this.onLoading,
this.alignment,
this.refreshController,
}) : super(key: key);
});
final Widget title;
final Widget child;

View file

@ -6,7 +6,7 @@ import 'package:mobile_nebula/models/Site.dart';
import 'package:mobile_nebula/services/utils.dart';
class SiteItem extends StatelessWidget {
const SiteItem({Key? key, required this.site, this.onPressed}) : super(key: key);
const SiteItem({super.key, required this.site, this.onPressed});
final Site site;
final onPressed;

View file

@ -4,7 +4,7 @@ import 'package:flutter_svg/svg.dart';
import '../models/Site.dart';
class SiteTitle extends StatelessWidget {
const SiteTitle({Key? key, required this.site}) : super(key: key);
const SiteTitle({super.key, required this.site});
final Site site;

View file

@ -5,8 +5,14 @@ import 'package:flutter/material.dart';
// This is a button that pushes the bare minimum onto you, it doesn't even respect button themes - unless you tell it to
class SpecialButton extends StatefulWidget {
const SpecialButton({Key? key, this.child, this.color, this.onPressed, this.useButtonTheme = false, this.decoration})
: super(key: key);
const SpecialButton({
super.key,
this.child,
this.color,
this.onPressed,
this.useButtonTheme = false,
this.decoration,
});
final Widget? child;
final Color? color;

View file

@ -5,7 +5,7 @@ import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
/// A normal TextField or CupertinoTextField that looks the same on all platforms
class SpecialTextField extends StatefulWidget {
const SpecialTextField({
Key? key,
super.key,
this.placeholder,
this.suffix,
this.controller,
@ -28,7 +28,7 @@ class SpecialTextField extends StatefulWidget {
this.keyboardAppearance,
this.textAlignVertical,
this.inputFormatters,
}) : super(key: key);
});
final String? placeholder;
final TextEditingController? controller;

View file

@ -4,7 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class PrimaryButton extends StatelessWidget {
const PrimaryButton({Key? key, required this.child, this.onPressed}) : super(key: key);
const PrimaryButton({super.key, required this.child, this.onPressed});
final Widget child;
final GestureTapCallback? onPressed;

View file

@ -5,7 +5,7 @@ import 'package:mobile_nebula/services/utils.dart';
// A config item that detects tapping and calls back on a tap
class ConfigButtonItem extends StatelessWidget {
const ConfigButtonItem({Key? key, this.content, this.onPressed}) : super(key: key);
const ConfigButtonItem({super.key, this.content, this.onPressed});
final Widget? content;
final onPressed;

View file

@ -4,13 +4,13 @@ import 'package:mobile_nebula/services/utils.dart';
class ConfigCheckboxItem extends StatelessWidget {
const ConfigCheckboxItem({
Key? key,
super.key,
this.label,
this.content,
this.labelWidth = 100,
this.onChanged,
this.checked = false,
}) : super(key: key);
});
final Widget? label;
final Widget? content;

View file

@ -9,7 +9,7 @@ TextStyle basicTextStyle(BuildContext context) =>
const double _headerFontSize = 13.0;
class ConfigHeader extends StatelessWidget {
const ConfigHeader({Key? key, required this.label, this.color}) : super(key: key);
const ConfigHeader({super.key, required this.label, this.color});
final String label;
final Color? color;

View file

@ -6,12 +6,12 @@ import 'package:mobile_nebula/services/utils.dart';
class ConfigItem extends StatelessWidget {
const ConfigItem({
Key? key,
super.key,
this.label,
required this.content,
this.labelWidth = 100,
this.crossAxisAlignment = CrossAxisAlignment.center,
}) : super(key: key);
});
final Widget? label;
final Widget content;

View file

@ -7,14 +7,14 @@ import 'package:mobile_nebula/services/utils.dart';
class ConfigPageItem extends StatelessWidget {
const ConfigPageItem({
Key? key,
super.key,
this.label,
this.content,
this.labelWidth = 100,
this.onPressed,
this.disabled = false,
this.crossAxisAlignment = CrossAxisAlignment.center,
}) : super(key: key);
});
final Widget? label;
final Widget? content;

View file

@ -4,8 +4,7 @@ import 'package:mobile_nebula/services/utils.dart';
import 'ConfigHeader.dart';
class ConfigSection extends StatelessWidget {
const ConfigSection({Key? key, this.label, required this.children, this.borderColor, this.labelColor})
: super(key: key);
const ConfigSection({super.key, this.label, required this.children, this.borderColor, this.labelColor});
final List<Widget> children;
final String? label;

View file

@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart';
class ConfigTextItem extends StatelessWidget {
const ConfigTextItem({
Key? key,
super.key,
this.placeholder,
this.controller,
this.style = const TextStyle(fontFamily: 'RobotoMono'),
}) : super(key: key);
});
final String? placeholder;
final TextEditingController? controller;

View file

@ -10,7 +10,7 @@ import 'package:mobile_nebula/services/utils.dart';
import 'package:package_info_plus/package_info_plus.dart';
class AboutScreen extends StatefulWidget {
const AboutScreen({Key? key}) : super(key: key);
const AboutScreen({super.key});
@override
_AboutScreenState createState() => _AboutScreenState();

View file

@ -15,14 +15,14 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
class HostInfoScreen extends StatefulWidget {
const HostInfoScreen({
Key? key,
super.key,
required this.hostInfo,
required this.isLighthouse,
required this.pending,
this.onChanged,
required this.site,
required this.supportsQRScanning,
}) : super(key: key);
});
final bool isLighthouse;
final bool pending;

View file

@ -60,7 +60,7 @@ MAIH7gzreMGgrH/yR6rZpIHR3DxJ3E0aHtEI
};
class MainScreen extends StatefulWidget {
const MainScreen(this.dnEnrollStream, {Key? key}) : super(key: key);
const MainScreen(this.dnEnrollStream, {super.key});
final StreamController dnEnrollStream;

View file

@ -23,8 +23,7 @@ import '../components/SiteTitle.dart';
//TODO: ios is now the problem with connecting screwing our ability to query the hostmap (its a race)
class SiteDetailScreen extends StatefulWidget {
const SiteDetailScreen({Key? key, required this.site, this.onChanged, required this.supportsQRScanning})
: super(key: key);
const SiteDetailScreen({super.key, required this.site, this.onChanged, required this.supportsQRScanning});
final Site site;
final Function? onChanged;

View file

@ -15,7 +15,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../components/SiteTitle.dart';
class SiteLogsScreen extends StatefulWidget {
const SiteLogsScreen({Key? key, required this.site}) : super(key: key);
const SiteLogsScreen({super.key, required this.site});
final Site site;

View file

@ -11,13 +11,13 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
class SiteTunnelsScreen extends StatefulWidget {
const SiteTunnelsScreen({
Key? key,
super.key,
required this.site,
required this.tunnels,
required this.pending,
required this.onChanged,
required this.supportsQRScanning,
}) : super(key: key);
});
final Site site;
final List<HostInfo> tunnels;

View file

@ -26,13 +26,13 @@ class CertificateResult {
class AddCertificateScreen extends StatefulWidget {
const AddCertificateScreen({
Key? key,
super.key,
this.onSave,
this.onReplace,
required this.pubKey,
required this.privKey,
required this.supportsQRScanning,
}) : super(key: key);
});
// onSave will pop a new CertificateDetailsScreen.
// If onSave is null, onReplace must be set.

View file

@ -40,7 +40,7 @@ class Advanced {
}
class AdvancedScreen extends StatefulWidget {
const AdvancedScreen({Key? key, required this.site, required this.onSave}) : super(key: key);
const AdvancedScreen({super.key, required this.site, required this.onSave});
final Site site;
final ValueChanged<Advanced> onSave;

View file

@ -18,7 +18,7 @@ import 'package:mobile_nebula/services/utils.dart';
//TODO: In addition you will want to think about re-generation while the site is still active (This means storing multiple keys in secure storage)
class CAListScreen extends StatefulWidget {
const CAListScreen({Key? key, required this.cas, this.onSave, required this.supportsQRScanning}) : super(key: key);
const CAListScreen({super.key, required this.cas, this.onSave, required this.supportsQRScanning});
final List<CertificateInfo> cas;
final ValueChanged<List<CertificateInfo>>? onSave;

View file

@ -11,7 +11,7 @@ import 'package:mobile_nebula/services/utils.dart';
/// Displays the details of a CertificateInfo object. Respects incomplete objects (missing validity or rawCert)
class CertificateDetailsScreen extends StatefulWidget {
const CertificateDetailsScreen({
Key? key,
super.key,
required this.certInfo,
this.onDelete,
this.onSave,
@ -19,7 +19,7 @@ class CertificateDetailsScreen extends StatefulWidget {
this.pubKey,
this.privKey,
required this.supportsQRScanning,
}) : super(key: key);
});
final CertificateInfo certInfo;

View file

@ -6,7 +6,7 @@ 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);
const CipherScreen({super.key, required this.cipher, required this.onSave});
final String cipher;
final ValueChanged<String> onSave;

View file

@ -6,7 +6,7 @@ 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);
const LogVerbosityScreen({super.key, required this.verbosity, required this.onSave});
final String verbosity;
final ValueChanged<String> onSave;

View file

@ -7,7 +7,7 @@ class RenderedConfigScreen extends StatelessWidget {
final String config;
final String name;
RenderedConfigScreen({Key? key, required this.config, required this.name}) : super(key: key);
RenderedConfigScreen({super.key, required this.config, required this.name});
@override
Widget build(BuildContext context) {

View file

@ -23,8 +23,7 @@ import 'package:mobile_nebula/services/utils.dart';
//TODO: Enforce a name
class SiteConfigScreen extends StatefulWidget {
const SiteConfigScreen({Key? key, this.site, required this.onSave, required this.supportsQRScanning})
: super(key: key);
const SiteConfigScreen({super.key, this.site, required this.onSave, required this.supportsQRScanning});
final Site? site;

View file

@ -21,14 +21,13 @@ class _IPAndPort {
class StaticHostmapScreen extends StatefulWidget {
StaticHostmapScreen({
Key? key,
super.key,
this.nebulaIp = '',
destinations,
this.lighthouse = false,
this.onDelete,
required this.onSave,
}) : this.destinations = destinations ?? [],
super(key: key);
}) : this.destinations = destinations ?? [];
final List<IPAndPort> destinations;
final String nebulaIp;

View file

@ -22,7 +22,7 @@ class _Hostmap {
}
class StaticHostsScreen extends StatefulWidget {
const StaticHostsScreen({Key? key, required this.hostmap, required this.onSave}) : super(key: key);
const StaticHostsScreen({super.key, required this.hostmap, required this.onSave});
final Map<String, StaticHost> hostmap;
final ValueChanged<Map<String, StaticHost>>? onSave;

View file

@ -10,7 +10,7 @@ import 'package:mobile_nebula/models/UnsafeRoute.dart';
import 'package:mobile_nebula/services/utils.dart';
class UnsafeRouteScreen extends StatefulWidget {
const UnsafeRouteScreen({Key? key, required this.route, required this.onSave, this.onDelete}) : super(key: key);
const UnsafeRouteScreen({super.key, required this.route, required this.onSave, this.onDelete});
final UnsafeRoute route;
final ValueChanged<UnsafeRoute> onSave;

View file

@ -8,7 +8,7 @@ import 'package:mobile_nebula/screens/siteConfig/UnsafeRouteScreen.dart';
import 'package:mobile_nebula/services/utils.dart';
class UnsafeRoutesScreen extends StatefulWidget {
const UnsafeRoutesScreen({Key? key, required this.unsafeRoutes, required this.onSave}) : super(key: key);
const UnsafeRoutesScreen({super.key, required this.unsafeRoutes, required this.onSave});
final List<UnsafeRoute> unsafeRoutes;
final ValueChanged<List<UnsafeRoute>>? onSave;