mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-02-23 03:25:26 +00:00
dart fix --apply --code=prefer_is_empty
This commit is contained in:
parent
7fd9ff5abc
commit
e75c4f1c86
10 changed files with 18 additions and 18 deletions
|
@ -14,7 +14,7 @@ class SiteItem extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final borderColor =
|
||||
site.errors.length > 0
|
||||
site.errors.isNotEmpty
|
||||
? CupertinoColors.systemRed.resolveFrom(context)
|
||||
: site.connected
|
||||
? CupertinoColors.systemGreen.resolveFrom(context)
|
||||
|
|
|
@ -64,7 +64,7 @@ class _SpecialTextFieldState extends State<SpecialTextField> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.inputFormatters == null || formatters.length == 0) {
|
||||
if (widget.inputFormatters == null || formatters.isEmpty) {
|
||||
formatters = [FilteringTextInputFormatter.allow(RegExp(r'[^\t]'))];
|
||||
} else {
|
||||
formatters = widget.inputFormatters!;
|
||||
|
|
|
@ -108,7 +108,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
|||
}
|
||||
|
||||
Widget _buildRemotes() {
|
||||
if (hostInfo.remoteAddresses.length == 0) {
|
||||
if (hostInfo.remoteAddresses.isEmpty) {
|
||||
return ConfigSection(
|
||||
label: 'REMOTES',
|
||||
children: [ConfigItem(content: Text('No remote addresses yet'), labelWidth: 0)],
|
||||
|
@ -150,7 +150,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
|||
);
|
||||
});
|
||||
|
||||
return ConfigSection(label: items.length > 0 ? 'Tap to change the active address' : null, children: items);
|
||||
return ConfigSection(label: items.isNotEmpty ? 'Tap to change the active address' : null, children: items);
|
||||
}
|
||||
|
||||
Widget _buildStaticRemotes() {
|
||||
|
@ -171,7 +171,7 @@ class _HostInfoScreenState extends State<HostInfoScreen> {
|
|||
);
|
||||
});
|
||||
|
||||
return ConfigSection(label: items.length > 0 ? 'REMOTES' : null, children: items);
|
||||
return ConfigSection(label: items.isNotEmpty ? 'REMOTES' : null, children: items);
|
||||
}
|
||||
|
||||
Widget _buildClose() {
|
||||
|
|
|
@ -202,7 +202,7 @@ class _MainScreenState extends State<MainScreen> {
|
|||
}
|
||||
|
||||
Widget _buildSites() {
|
||||
if (sites == null || sites!.length == 0) {
|
||||
if (sites == null || sites!.isEmpty) {
|
||||
return _buildNoSites();
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class _SiteDetailScreenState extends State<SiteDetailScreen> {
|
|||
}
|
||||
|
||||
Widget _buildErrors() {
|
||||
if (site.errors.length == 0) {
|
||||
if (site.errors.isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ class _SiteDetailScreenState extends State<SiteDetailScreen> {
|
|||
Switch.adaptive(
|
||||
value: widget.site.connected,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
onChanged: widget.site.errors.length > 0 && !widget.site.connected ? null : handleChange,
|
||||
onChanged: widget.site.errors.isNotEmpty && !widget.site.connected ? null : handleChange,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -245,7 +245,7 @@ class _AddCertificateScreenState extends State<AddCertificateScreen> {
|
|||
var rawCerts = await platform.invokeMethod("nebula.parseCerts", <String, String>{"certs": rawCert});
|
||||
|
||||
List<dynamic> certs = jsonDecode(rawCerts);
|
||||
if (certs.length > 0) {
|
||||
if (certs.isNotEmpty) {
|
||||
var tryCertInfo = CertificateInfo.fromJson(certs.first);
|
||||
if (tryCertInfo.cert.details.isCa) {
|
||||
return Utils.popError(
|
||||
|
|
|
@ -51,7 +51,7 @@ class _CAListScreenState extends State<CAListScreen> {
|
|||
List<Widget> items = [];
|
||||
final caItems = _buildCAs();
|
||||
|
||||
if (caItems.length > 0) {
|
||||
if (caItems.isNotEmpty) {
|
||||
items.add(ConfigSection(children: caItems));
|
||||
}
|
||||
|
||||
|
|
|
@ -120,19 +120,19 @@ class _CertificateDetailsScreenState extends State<CertificateDetailsScreen> {
|
|||
|
||||
Widget _buildFilters() {
|
||||
List<Widget> items = [];
|
||||
if (certInfo.cert.details.groups.length > 0) {
|
||||
if (certInfo.cert.details.groups.isNotEmpty) {
|
||||
items.add(ConfigItem(label: Text('Groups'), content: SelectableText(certInfo.cert.details.groups.join(', '))));
|
||||
}
|
||||
|
||||
if (certInfo.cert.details.ips.length > 0) {
|
||||
if (certInfo.cert.details.ips.isNotEmpty) {
|
||||
items.add(ConfigItem(label: Text('IPs'), content: SelectableText(certInfo.cert.details.ips.join(', '))));
|
||||
}
|
||||
|
||||
if (certInfo.cert.details.subnets.length > 0) {
|
||||
if (certInfo.cert.details.subnets.isNotEmpty) {
|
||||
items.add(ConfigItem(label: Text('Subnets'), content: SelectableText(certInfo.cert.details.subnets.join(', '))));
|
||||
}
|
||||
|
||||
return items.length > 0
|
||||
return items.isNotEmpty
|
||||
? ConfigSection(label: certInfo.cert.details.isCa ? 'FILTERS' : 'DETAILS', children: items)
|
||||
: Container();
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
|
|||
final certError = site.certInfo == null || site.certInfo!.validity == null || !site.certInfo!.validity!.valid;
|
||||
var caError = false;
|
||||
if (!site.managed) {
|
||||
caError = site.ca.length == 0;
|
||||
caError = site.ca.isEmpty;
|
||||
if (!caError) {
|
||||
site.ca.forEach((ca) {
|
||||
if (ca.validity == null || !ca.validity!.valid) {
|
||||
|
@ -272,13 +272,13 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
|
|||
alignment: WrapAlignment.end,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: <Widget>[
|
||||
site.staticHostmap.length == 0
|
||||
site.staticHostmap.isEmpty
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(right: 5),
|
||||
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
|
||||
)
|
||||
: Container(),
|
||||
site.staticHostmap.length == 0
|
||||
site.staticHostmap.isEmpty
|
||||
? Text('Needs attention')
|
||||
: Text(Utils.itemCountFormat(site.staticHostmap.length)),
|
||||
],
|
||||
|
|
|
@ -54,7 +54,7 @@ class _StaticHostmapScreenState extends State<StaticHostmapScreen> {
|
|||
_destinations[UniqueKey()] = _IPAndPort(focusNode: FocusNode(), destination: dest);
|
||||
});
|
||||
|
||||
if (_destinations.length == 0) {
|
||||
if (_destinations.isEmpty) {
|
||||
_addDestination();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue