mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-14 20:24:29 +01:00
refactor: Simplify conditional rendering logic using null aware operators (#1049)
This commit is contained in:
@@ -103,7 +103,7 @@ class _ServerDetailPageState extends ConsumerState<ServerDetailPage> with Single
|
||||
Widget _buildMainPage(ServerState si) {
|
||||
final buildFuncs = !_moveServerFuncs;
|
||||
final logo = _buildLogo(si);
|
||||
final children = <Widget>[if (logo != null) logo, if (buildFuncs) ServerFuncBtns(spi: si.spi)];
|
||||
final children = <Widget>[?logo, if (buildFuncs) ServerFuncBtns(spi: si.spi)];
|
||||
for (final card in _cardsOrder) {
|
||||
final child = _cardBuildMap[card]?.call(si);
|
||||
if (child != null) {
|
||||
|
||||
@@ -162,7 +162,7 @@ class _SshDiscoveryPageState extends ConsumerState<SshDiscoveryPage> {
|
||||
layoutBuilder: (currentChild, previousChildren) {
|
||||
return Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
children: <Widget>[...previousChildren, if (currentChild != null) currentChild],
|
||||
children: <Widget>[...previousChildren, ?currentChild],
|
||||
);
|
||||
},
|
||||
child: selectedResults.isNotEmpty
|
||||
|
||||
@@ -11,8 +11,8 @@ extension _App on _AppSettingsPageState {
|
||||
_buildCheckUpdate(),
|
||||
_buildHomeTabs(),
|
||||
PlatformPublicSettings.buildBioAuth,
|
||||
if (androidSettings != null) androidSettings,
|
||||
if (specific != null) specific,
|
||||
?androidSettings,
|
||||
?specific,
|
||||
_buildAppMore(),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user