From dccd96844d8f6e5bf68911232cb2dfe1f64808a2 Mon Sep 17 00:00:00 2001 From: Caleb Jasik Date: Thu, 13 Feb 2025 11:17:58 -0600 Subject: [PATCH] `dart fix --apply --code=sort_child_properties_last` --- lib/components/DangerButton.dart | 4 ++-- lib/components/SimplePage.dart | 4 ++-- lib/components/SpecialButton.dart | 4 ++-- lib/components/buttons/PrimaryButton.dart | 4 ++-- lib/components/config/ConfigCheckboxItem.dart | 2 +- lib/components/config/ConfigPageItem.dart | 2 +- lib/components/config/ConfigSection.dart | 2 +- lib/screens/EnrollmentScreen.dart | 20 +++++++++---------- lib/screens/MainScreen.dart | 6 +++--- lib/screens/SiteLogsScreen.dart | 2 +- lib/screens/SiteTunnelsScreen.dart | 4 ++-- lib/screens/siteConfig/SiteConfigScreen.dart | 6 +++--- lib/screens/siteConfig/StaticHostsScreen.dart | 2 +- lib/services/utils.dart | 2 +- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/components/DangerButton.dart b/lib/components/DangerButton.dart index 592ae07..cd8c9cd 100644 --- a/lib/components/DangerButton.dart +++ b/lib/components/DangerButton.dart @@ -14,11 +14,11 @@ class DangerButton extends StatelessWidget { if (Platform.isAndroid) { return FilledButton( onPressed: onPressed, - child: child, style: FilledButton.styleFrom( backgroundColor: Theme.of(context).colorScheme.error, foregroundColor: Theme.of(context).colorScheme.onError, ), + child: child, ); } else { // Workaround for https://github.com/flutter/flutter/issues/161590 @@ -26,9 +26,9 @@ class DangerButton extends StatelessWidget { return CupertinoTheme( data: themeData.copyWith(primaryColor: CupertinoColors.white), child: CupertinoButton( - child: child, onPressed: onPressed, color: CupertinoColors.systemRed.resolveFrom(context), + child: child, ), ); } diff --git a/lib/components/SimplePage.dart b/lib/components/SimplePage.dart index 749e591..76c466f 100644 --- a/lib/components/SimplePage.dart +++ b/lib/components/SimplePage.dart @@ -48,8 +48,8 @@ class SimplePage extends StatelessWidget { if (scrollable == SimpleScrollable.vertical || scrollable == SimpleScrollable.both) { realChild = SingleChildScrollView( scrollDirection: Axis.vertical, - child: realChild, controller: refreshController == null ? scrollController : null, + child: realChild, ); addScrollbar = true; } @@ -69,10 +69,10 @@ class SimplePage extends StatelessWidget { onRefresh: onRefresh, onLoading: onLoading, controller: refreshController!, - child: realChild, enablePullUp: onLoading != null, enablePullDown: onRefresh != null, footer: ClassicFooter(loadStyle: LoadStyle.ShowWhenLoading), + child: realChild, ), ); addScrollbar = true; diff --git a/lib/components/SpecialButton.dart b/lib/components/SpecialButton.dart index aa6ab47..e645de4 100644 --- a/lib/components/SpecialButton.dart +++ b/lib/components/SpecialButton.dart @@ -42,7 +42,7 @@ class _SpecialButtonState extends State with SingleTickerProvider child: Ink( decoration: widget.decoration, 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 with SingleTickerProvider button: true, child: FadeTransition( 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)), ), ), ), diff --git a/lib/components/buttons/PrimaryButton.dart b/lib/components/buttons/PrimaryButton.dart index 21a253a..56ef3da 100644 --- a/lib/components/buttons/PrimaryButton.dart +++ b/lib/components/buttons/PrimaryButton.dart @@ -14,8 +14,8 @@ class PrimaryButton extends StatelessWidget { if (Platform.isAndroid) { return FilledButton( onPressed: onPressed, - child: child, style: FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.primary), + child: child, ); } else { // Workaround for https://github.com/flutter/flutter/issues/161590 @@ -23,9 +23,9 @@ class PrimaryButton extends StatelessWidget { return CupertinoTheme( data: themeData.copyWith(primaryColor: CupertinoColors.white), child: CupertinoButton( - child: child, onPressed: onPressed, color: CupertinoColors.secondaryLabel.resolveFrom(context), + child: child, ), ); } diff --git a/lib/components/config/ConfigCheckboxItem.dart b/lib/components/config/ConfigCheckboxItem.dart index f059ec7..99f4608 100644 --- a/lib/components/config/ConfigCheckboxItem.dart +++ b/lib/components/config/ConfigCheckboxItem.dart @@ -27,7 +27,7 @@ class ConfigCheckboxItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ 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 ? Icon(CupertinoIcons.check_mark, color: CupertinoColors.systemBlue.resolveFrom(context)) : Container(), diff --git a/lib/components/config/ConfigPageItem.dart b/lib/components/config/ConfigPageItem.dart index f51afee..706f974 100644 --- a/lib/components/config/ConfigPageItem.dart +++ b/lib/components/config/ConfigPageItem.dart @@ -53,7 +53,7 @@ class ConfigPageItem extends StatelessWidget { crossAxisAlignment: crossAxisAlignment, children: [ 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 ? Container() : Icon(CupertinoIcons.forward, color: CupertinoColors.placeholderText.resolveFrom(context), size: 18), diff --git a/lib/components/config/ConfigSection.dart b/lib/components/config/ConfigSection.dart index d681cee..26967ac 100644 --- a/lib/components/config/ConfigSection.dart +++ b/lib/components/config/ConfigSection.dart @@ -28,8 +28,8 @@ class ConfigSection extends StatelessWidget { } _children.add( Padding( - child: Divider(height: 1, color: Utils.configSectionBorder(context)), padding: EdgeInsets.only(left: pad), + child: Divider(height: 1, color: Utils.configSectionBorder(context)), ), ); } diff --git a/lib/screens/EnrollmentScreen.dart b/lib/screens/EnrollmentScreen.dart index 4093671..1033d06 100644 --- a/lib/screens/EnrollmentScreen.dart +++ b/lib/screens/EnrollmentScreen.dart @@ -94,27 +94,30 @@ class _EnrollmentScreenState extends State { } else { // No code, show the error child = Padding( + padding: EdgeInsets.only(top: 20), child: Center( child: Text( 'No valid enrollment code was found.\n\nContact your administrator to obtain a new enrollment code.', textAlign: TextAlign.center, ), ), - padding: EdgeInsets.only(top: 20), ); } } else if (error != null) { // Error while enrolling, display it child = Center( child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), child: SelectableText( '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: EdgeInsets.symmetric(horizontal: 16, vertical: 10), child: SelectableText.rich( TextSpan( children: [ @@ -134,22 +137,19 @@ class _EnrollmentScreenState extends State { ], ), ), - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10), ), Container( - child: Padding(child: SelectableText(error!), padding: EdgeInsets.all(16)), color: Theme.of(context).colorScheme.errorContainer, + child: Padding(padding: EdgeInsets.all(16), child: SelectableText(error!)), ), ], - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, ), ); } else if (enrolled) { // Enrollment complete! child = Padding( - child: Center(child: Text('Enrollment complete! 🎉', textAlign: TextAlign.center)), padding: EdgeInsets.only(top: 20), + child: Center(child: Text('Enrollment complete! 🎉', textAlign: TextAlign.center)), ); } else { // Have a code and actively enrolling @@ -157,7 +157,7 @@ class _EnrollmentScreenState extends State { child = Center( child: Column( 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( cupertino: (_, __) { return CupertinoProgressIndicatorData(radius: 50); @@ -168,7 +168,7 @@ class _EnrollmentScreenState extends State { ); } - 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() { @@ -212,7 +212,7 @@ class _EnrollmentScreenState extends State { Padding(padding: EdgeInsets.symmetric(vertical: 32), child: form), Padding( 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')))]), ), ], ); diff --git a/lib/screens/MainScreen.dart b/lib/screens/MainScreen.dart index 1b326e4..3ac91f3 100644 --- a/lib/screens/MainScreen.dart +++ b/lib/screens/MainScreen.dart @@ -115,8 +115,8 @@ class _MainScreenState extends State { if (kDebugMode) { debugSite = Row( - children: [_debugSave(badDebugSave), _debugSave(goodDebugSave), _debugClearKeys()], mainAxisAlignment: MainAxisAlignment.center, + children: [_debugSave(badDebugSave), _debugSave(goodDebugSave), _debugClearKeys()], ); } @@ -168,12 +168,12 @@ class _MainScreenState extends State { if (error != null) { return Center( child: Padding( + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: error!, ), - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10), ), ); } @@ -260,7 +260,7 @@ class _MainScreenState extends State { ); 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 diff --git a/lib/screens/SiteLogsScreen.dart b/lib/screens/SiteLogsScreen.dart index 0131ff1..630b9c3 100644 --- a/lib/screens/SiteLogsScreen.dart +++ b/lib/screens/SiteLogsScreen.dart @@ -59,6 +59,7 @@ class _SiteLogsScreenState extends State { refreshController.loadComplete(); }, refreshController: refreshController, + bottomBar: _buildBottomBar(), child: Container( padding: EdgeInsets.all(5), constraints: logBoxConstraints(context), @@ -75,7 +76,6 @@ class _SiteLogsScreenState extends State { }, style: TextStyle(fontFamily: 'RobotoMono', fontSize: 14)), ), ), - bottomBar: _buildBottomBar(), ); } diff --git a/lib/screens/SiteTunnelsScreen.dart b/lib/screens/SiteTunnelsScreen.dart index a15ddc0..114bfa6 100644 --- a/lib/screens/SiteTunnelsScreen.dart +++ b/lib/screens/SiteTunnelsScreen.dart @@ -77,7 +77,7 @@ class _SiteTunnelsScreenState extends State { ), ), label: Row( - children: [Padding(child: icon, padding: EdgeInsets.only(right: 10)), Text(hostInfo.vpnIp)], + children: [Padding(padding: EdgeInsets.only(right: 10), child: icon), Text(hostInfo.vpnIp)], ), labelWidth: ipWidth, content: Container(alignment: Alignment.centerRight, child: Text(hostInfo.cert?.details.name ?? "")), @@ -85,7 +85,7 @@ class _SiteTunnelsScreenState extends State { }).toList(); 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), }; diff --git a/lib/screens/siteConfig/SiteConfigScreen.dart b/lib/screens/siteConfig/SiteConfigScreen.dart index f857f4c..3363370 100644 --- a/lib/screens/siteConfig/SiteConfigScreen.dart +++ b/lib/screens/siteConfig/SiteConfigScreen.dart @@ -182,8 +182,8 @@ class _SiteConfigScreenState extends State { children: [ certError ? Padding( - child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20), padding: EdgeInsets.only(right: 5), + child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20), ) : Container(), certError ? Text('Needs attention') : Text(site.certInfo?.cert.details.name ?? 'Unknown certificate'), @@ -233,8 +233,8 @@ class _SiteConfigScreenState extends State { children: [ caError ? Padding( - child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20), padding: EdgeInsets.only(right: 5), + child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20), ) : Container(), caError ? Text('Needs attention') : Text(Utils.itemCountFormat(site.ca.length)), @@ -274,8 +274,8 @@ class _SiteConfigScreenState extends State { children: [ site.staticHostmap.length == 0 ? Padding( - child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20), padding: EdgeInsets.only(right: 5), + child: Icon(Icons.error, color: CupertinoColors.systemRed.resolveFrom(context), size: 20), ) : Container(), site.staticHostmap.length == 0 diff --git a/lib/screens/siteConfig/StaticHostsScreen.dart b/lib/screens/siteConfig/StaticHostsScreen.dart index 0678f83..b63f33d 100644 --- a/lib/screens/siteConfig/StaticHostsScreen.dart +++ b/lib/screens/siteConfig/StaticHostsScreen.dart @@ -80,11 +80,11 @@ class _StaticHostsScreenState extends State { label: Row( children: [ Padding( + padding: EdgeInsets.only(right: 10), child: Icon( host.lighthouse ? Icons.lightbulb_outline : Icons.computer, color: CupertinoColors.placeholderText.resolveFrom(context), ), - padding: EdgeInsets.only(right: 10), ), Text(host.nebulaIp), ], diff --git a/lib/services/utils.dart b/lib/services/utils.dart index 32437c7..ee6654a 100644 --- a/lib/services/utils.dart +++ b/lib/services/utils.dart @@ -79,9 +79,9 @@ class Utils { static Widget trailingSaveWidget(BuildContext context, Function onPressed) { return PlatformTextButton( - child: Text('Save'), padding: Platform.isAndroid ? null : EdgeInsets.zero, onPressed: () => onPressed(), + child: Text('Save'), ); }