dart fix --apply --code=sort_child_properties_last

This commit is contained in:
Caleb Jasik 2025-02-13 11:17:58 -06:00
parent b4ba6bb726
commit dccd96844d
No known key found for this signature in database
14 changed files with 32 additions and 32 deletions

View file

@ -14,11 +14,11 @@ class DangerButton extends StatelessWidget {
if (Platform.isAndroid) { if (Platform.isAndroid) {
return FilledButton( return FilledButton(
onPressed: onPressed, onPressed: onPressed,
child: child,
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.error, backgroundColor: Theme.of(context).colorScheme.error,
foregroundColor: Theme.of(context).colorScheme.onError, foregroundColor: Theme.of(context).colorScheme.onError,
), ),
child: child,
); );
} else { } else {
// Workaround for https://github.com/flutter/flutter/issues/161590 // Workaround for https://github.com/flutter/flutter/issues/161590
@ -26,9 +26,9 @@ class DangerButton extends StatelessWidget {
return CupertinoTheme( return CupertinoTheme(
data: themeData.copyWith(primaryColor: CupertinoColors.white), data: themeData.copyWith(primaryColor: CupertinoColors.white),
child: CupertinoButton( child: CupertinoButton(
child: child,
onPressed: onPressed, onPressed: onPressed,
color: CupertinoColors.systemRed.resolveFrom(context), color: CupertinoColors.systemRed.resolveFrom(context),
child: child,
), ),
); );
} }

View file

@ -48,8 +48,8 @@ class SimplePage extends StatelessWidget {
if (scrollable == SimpleScrollable.vertical || scrollable == SimpleScrollable.both) { if (scrollable == SimpleScrollable.vertical || scrollable == SimpleScrollable.both) {
realChild = SingleChildScrollView( realChild = SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: realChild,
controller: refreshController == null ? scrollController : null, controller: refreshController == null ? scrollController : null,
child: realChild,
); );
addScrollbar = true; addScrollbar = true;
} }
@ -69,10 +69,10 @@ class SimplePage extends StatelessWidget {
onRefresh: onRefresh, onRefresh: onRefresh,
onLoading: onLoading, onLoading: onLoading,
controller: refreshController!, controller: refreshController!,
child: realChild,
enablePullUp: onLoading != null, enablePullUp: onLoading != null,
enablePullDown: onRefresh != null, enablePullDown: onRefresh != null,
footer: ClassicFooter(loadStyle: LoadStyle.ShowWhenLoading), footer: ClassicFooter(loadStyle: LoadStyle.ShowWhenLoading),
child: realChild,
), ),
); );
addScrollbar = true; addScrollbar = true;

View file

@ -42,7 +42,7 @@ class _SpecialButtonState extends State<SpecialButton> with SingleTickerProvider
child: Ink( child: Ink(
decoration: widget.decoration, decoration: widget.decoration,
color: widget.color, color: widget.color,
child: InkWell(child: widget.child, onTap: widget.onPressed), child: InkWell(onTap: widget.onPressed, child: widget.child),
), ),
); );
} }
@ -65,7 +65,7 @@ class _SpecialButtonState extends State<SpecialButton> with SingleTickerProvider
button: true, button: true,
child: FadeTransition( child: FadeTransition(
opacity: _opacityAnimation!, opacity: _opacityAnimation!,
child: DefaultTextStyle(style: textStyle, child: Container(child: widget.child, color: widget.color)), child: DefaultTextStyle(style: textStyle, child: Container(color: widget.color, child: widget.child)),
), ),
), ),
), ),

View file

@ -14,8 +14,8 @@ class PrimaryButton extends StatelessWidget {
if (Platform.isAndroid) { if (Platform.isAndroid) {
return FilledButton( return FilledButton(
onPressed: onPressed, onPressed: onPressed,
child: child,
style: FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.primary), style: FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.primary),
child: child,
); );
} else { } else {
// Workaround for https://github.com/flutter/flutter/issues/161590 // Workaround for https://github.com/flutter/flutter/issues/161590
@ -23,9 +23,9 @@ class PrimaryButton extends StatelessWidget {
return CupertinoTheme( return CupertinoTheme(
data: themeData.copyWith(primaryColor: CupertinoColors.white), data: themeData.copyWith(primaryColor: CupertinoColors.white),
child: CupertinoButton( child: CupertinoButton(
child: child,
onPressed: onPressed, onPressed: onPressed,
color: CupertinoColors.secondaryLabel.resolveFrom(context), color: CupertinoColors.secondaryLabel.resolveFrom(context),
child: child,
), ),
); );
} }

View file

@ -27,7 +27,7 @@ class ConfigCheckboxItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
label != null ? Container(width: labelWidth, child: label) : Container(), label != null ? Container(width: labelWidth, child: label) : Container(),
Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))), Expanded(child: Container(padding: EdgeInsets.only(right: 10), child: content)),
checked checked
? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context)) ? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context))
: Container(), : Container(),

View file

@ -53,7 +53,7 @@ class ConfigPageItem extends StatelessWidget {
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
children: <Widget>[ children: <Widget>[
label != null ? Container(width: labelWidth, child: label) : Container(), label != null ? Container(width: labelWidth, child: label) : Container(),
Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))), Expanded(child: Container(padding: EdgeInsets.only(right: 10), child: content)),
disabled disabled
? Container() ? Container()
: Icon(CupertinoIcons.forward, color: CupertinoColors.placeholderText.resolveFrom(context), size: 18), : Icon(CupertinoIcons.forward, color: CupertinoColors.placeholderText.resolveFrom(context), size: 18),

View file

@ -28,8 +28,8 @@ class ConfigSection extends StatelessWidget {
} }
_children.add( _children.add(
Padding( Padding(
child: Divider(height: 1, color: Utils.configSectionBorder(context)),
padding: EdgeInsets.only(left: pad), padding: EdgeInsets.only(left: pad),
child: Divider(height: 1, color: Utils.configSectionBorder(context)),
), ),
); );
} }

View file

@ -94,27 +94,30 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
} else { } else {
// No code, show the error // No code, show the error
child = Padding( child = Padding(
padding: EdgeInsets.only(top: 20),
child: Center( child: Center(
child: Text( child: Text(
'No valid enrollment code was found.\n\nContact your administrator to obtain a new enrollment code.', 'No valid enrollment code was found.\n\nContact your administrator to obtain a new enrollment code.',
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
padding: EdgeInsets.only(top: 20),
); );
} }
} else if (error != null) { } else if (error != null) {
// Error while enrolling, display it // Error while enrolling, display it
child = Center( child = Center(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20),
child: SelectableText( child: SelectableText(
'There was an issue while attempting to enroll this device. Contact your administrator to obtain a new enrollment code.', 'There was an issue while attempting to enroll this device. Contact your administrator to obtain a new enrollment code.',
), ),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: SelectableText.rich( child: SelectableText.rich(
TextSpan( TextSpan(
children: [ children: [
@ -134,22 +137,19 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
], ],
), ),
), ),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
), ),
Container( Container(
child: Padding(child: SelectableText(error!), padding: EdgeInsets.all(16)),
color: Theme.of(context).colorScheme.errorContainer, color: Theme.of(context).colorScheme.errorContainer,
child: Padding(padding: EdgeInsets.all(16), child: SelectableText(error!)),
), ),
], ],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
), ),
); );
} else if (enrolled) { } else if (enrolled) {
// Enrollment complete! // Enrollment complete!
child = Padding( child = Padding(
child: Center(child: Text('Enrollment complete! 🎉', textAlign: TextAlign.center)),
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: Center(child: Text('Enrollment complete! 🎉', textAlign: TextAlign.center)),
); );
} else { } else {
// Have a code and actively enrolling // Have a code and actively enrolling
@ -157,7 +157,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
child = Center( child = Center(
child: Column( child: Column(
children: [ children: [
Padding(child: Text('Contacting DN for enrollment'), padding: EdgeInsets.only(bottom: 25)), Padding(padding: EdgeInsets.only(bottom: 25), child: Text('Contacting DN for enrollment')),
PlatformCircularProgressIndicator( PlatformCircularProgressIndicator(
cupertino: (_, __) { cupertino: (_, __) {
return CupertinoProgressIndicatorData(radius: 50); return CupertinoProgressIndicatorData(radius: 50);
@ -168,7 +168,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
); );
} }
return SimplePage(title: Text('Enroll with Managed Nebula'), child: child, alignment: alignment); return SimplePage(title: Text('Enroll with Managed Nebula'), alignment: alignment, child: child);
} }
Widget _codeEntry() { Widget _codeEntry() {
@ -212,7 +212,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
Padding(padding: EdgeInsets.symmetric(vertical: 32), child: form), Padding(padding: EdgeInsets.symmetric(vertical: 32), child: form),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16), padding: EdgeInsets.symmetric(horizontal: 16),
child: Row(children: [Expanded(child: PrimaryButton(child: Text('Submit'), onPressed: onSubmit))]), child: Row(children: [Expanded(child: PrimaryButton(onPressed: onSubmit, child: Text('Submit')))]),
), ),
], ],
); );

View file

@ -115,8 +115,8 @@ class _MainScreenState extends State<MainScreen> {
if (kDebugMode) { if (kDebugMode) {
debugSite = Row( debugSite = Row(
children: [_debugSave(badDebugSave), _debugSave(goodDebugSave), _debugClearKeys()],
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [_debugSave(badDebugSave), _debugSave(goodDebugSave), _debugClearKeys()],
); );
} }
@ -168,12 +168,12 @@ class _MainScreenState extends State<MainScreen> {
if (error != null) { if (error != null) {
return Center( return Center(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: error!, children: error!,
), ),
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
), ),
); );
} }
@ -260,7 +260,7 @@ class _MainScreenState extends State<MainScreen> {
); );
if (Platform.isIOS) { if (Platform.isIOS) {
child = CupertinoTheme(child: child, data: CupertinoTheme.of(context)); child = CupertinoTheme(data: CupertinoTheme.of(context), child: child);
} }
// The theme here is to remove the hardcoded canvas border reordering forces on us // The theme here is to remove the hardcoded canvas border reordering forces on us

View file

@ -59,6 +59,7 @@ class _SiteLogsScreenState extends State<SiteLogsScreen> {
refreshController.loadComplete(); refreshController.loadComplete();
}, },
refreshController: refreshController, refreshController: refreshController,
bottomBar: _buildBottomBar(),
child: Container( child: Container(
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
constraints: logBoxConstraints(context), constraints: logBoxConstraints(context),
@ -75,7 +76,6 @@ class _SiteLogsScreenState extends State<SiteLogsScreen> {
}, style: TextStyle(fontFamily: 'RobotoMono', fontSize: 14)), }, style: TextStyle(fontFamily: 'RobotoMono', fontSize: 14)),
), ),
), ),
bottomBar: _buildBottomBar(),
); );
} }

View file

@ -77,7 +77,7 @@ class _SiteTunnelsScreenState extends State<SiteTunnelsScreen> {
), ),
), ),
label: Row( label: Row(
children: <Widget>[Padding(child: icon, padding: EdgeInsets.only(right: 10)), Text(hostInfo.vpnIp)], children: <Widget>[Padding(padding: EdgeInsets.only(right: 10), child: icon), Text(hostInfo.vpnIp)],
), ),
labelWidth: ipWidth, labelWidth: ipWidth,
content: Container(alignment: Alignment.centerRight, child: Text(hostInfo.cert?.details.name ?? "")), content: Container(alignment: Alignment.centerRight, child: Text(hostInfo.cert?.details.name ?? "")),
@ -85,7 +85,7 @@ class _SiteTunnelsScreenState extends State<SiteTunnelsScreen> {
}).toList(); }).toList();
final Widget child = switch (children.length) { final Widget child = switch (children.length) {
0 => Center(child: Padding(child: Text('No tunnels to show'), padding: EdgeInsets.only(top: 30))), 0 => Center(child: Padding(padding: EdgeInsets.only(top: 30), child: Text('No tunnels to show'))),
_ => ConfigSection(children: children), _ => ConfigSection(children: children),
}; };

View file

@ -182,8 +182,8 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
children: <Widget>[ children: <Widget>[
certError certError
? Padding( ? Padding(
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
padding: EdgeInsets.only(right: 5), padding: EdgeInsets.only(right: 5),
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
) )
: Container(), : Container(),
certError ? Text('Needs attention') : Text(site.certInfo?.cert.details.name ?? 'Unknown certificate'), certError ? Text('Needs attention') : Text(site.certInfo?.cert.details.name ?? 'Unknown certificate'),
@ -233,8 +233,8 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
children: <Widget>[ children: <Widget>[
caError caError
? Padding( ? Padding(
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
padding: EdgeInsets.only(right: 5), padding: EdgeInsets.only(right: 5),
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
) )
: Container(), : Container(),
caError ? Text('Needs attention') : Text(Utils.itemCountFormat(site.ca.length)), caError ? Text('Needs attention') : Text(Utils.itemCountFormat(site.ca.length)),
@ -274,8 +274,8 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
children: <Widget>[ children: <Widget>[
site.staticHostmap.length == 0 site.staticHostmap.length == 0
? Padding( ? Padding(
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
padding: EdgeInsets.only(right: 5), padding: EdgeInsets.only(right: 5),
child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20),
) )
: Container(), : Container(),
site.staticHostmap.length == 0 site.staticHostmap.length == 0

View file

@ -80,11 +80,11 @@ class _StaticHostsScreenState extends State<StaticHostsScreen> {
label: Row( label: Row(
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(right: 10),
child: Icon( child: Icon(
host.lighthouse ? Icons.lightbulb_outline : Icons.computer, host.lighthouse ? Icons.lightbulb_outline : Icons.computer,
color: CupertinoColors.placeholderText.resolveFrom(context), color: CupertinoColors.placeholderText.resolveFrom(context),
), ),
padding: EdgeInsets.only(right: 10),
), ),
Text(host.nebulaIp), Text(host.nebulaIp),
], ],

View file

@ -79,9 +79,9 @@ class Utils {
static Widget trailingSaveWidget(BuildContext context, Function onPressed) { static Widget trailingSaveWidget(BuildContext context, Function onPressed) {
return PlatformTextButton( return PlatformTextButton(
child: Text('Save'),
padding: Platform.isAndroid ? null : EdgeInsets.zero, padding: Platform.isAndroid ? null : EdgeInsets.zero,
onPressed: () => onPressed(), onPressed: () => onPressed(),
child: Text('Save'),
); );
} }