diff --git a/flutter/lib/desktop/pages/connection_page.dart b/flutter/lib/desktop/pages/connection_page.dart index 408e0ee92..fe8e6c642 100644 --- a/flutter/lib/desktop/pages/connection_page.dart +++ b/flutter/lib/desktop/pages/connection_page.dart @@ -64,76 +64,90 @@ class _OnlineStatusWidgetState extends State { @override Widget build(BuildContext context) { final isIncomingOnly = bind.isIncomingOnly(); - return Container( - height: height, - child: Obx(() => Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 8, - width: 8, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: _svcStopped.value || - stateGlobal.svcStatus.value == SvcStatus.connecting - ? kColorWarn - : (stateGlobal.svcStatus.value == SvcStatus.ready - ? Color.fromARGB(255, 50, 190, 166) - : Color.fromARGB(255, 224, 79, 95)), - ), - ).marginSymmetric(horizontal: em), - Container( - width: isIncomingOnly ? 226 : null, - child: _buildConnStatusMsg(), - ), - // stop - Offstage( - offstage: !_svcStopped.value, - child: InkWell( - onTap: () async { - await start_service(true); - }, - child: Text(translate("Start service"), + startServiceWidget() => Offstage( + offstage: !_svcStopped.value, + child: InkWell( + onTap: () async { + await start_service(true); + }, + child: Text(translate("Start service"), + style: TextStyle( + decoration: TextDecoration.underline, fontSize: em))) + .marginOnly(left: em), + ); + + setupServerWidget() => Flexible( + child: Offstage( + offstage: !(!_svcStopped.value && + stateGlobal.svcStatus.value == SvcStatus.ready && + _svcIsUsingPublicServer.value), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text(', ', style: TextStyle(fontSize: em)), + Flexible( + child: InkWell( + onTap: onUsePublicServerGuide, + child: Row( + children: [ + Flexible( + child: Text( + translate('setup_server_tip'), style: TextStyle( decoration: TextDecoration.underline, - fontSize: em))) - .marginOnly(left: em), - ), - // ready && public - // No need to show the guide if is custom client. - if (!isIncomingOnly) - Flexible( - child: Offstage( - offstage: !(!_svcStopped.value && - stateGlobal.svcStatus.value == SvcStatus.ready && - _svcIsUsingPublicServer.value), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text(', ', style: TextStyle(fontSize: em)), - Flexible( - child: InkWell( - onTap: onUsePublicServerGuide, - child: Row( - children: [ - Flexible( - child: Text( - translate('setup_server_tip'), - style: TextStyle( - decoration: TextDecoration.underline, - fontSize: em), - ), - ), - ], - ), + fontSize: em), ), - ) + ), ], ), ), ) - ], - )), + ], + ), + ), + ); + + basicWidget() => Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 8, + width: 8, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: _svcStopped.value || + stateGlobal.svcStatus.value == SvcStatus.connecting + ? kColorWarn + : (stateGlobal.svcStatus.value == SvcStatus.ready + ? Color.fromARGB(255, 50, 190, 166) + : Color.fromARGB(255, 224, 79, 95)), + ), + ).marginSymmetric(horizontal: em), + Container( + width: isIncomingOnly ? 226 : null, + child: _buildConnStatusMsg(), + ), + // stop + if (!isIncomingOnly) startServiceWidget(), + // ready && public + // No need to show the guide if is custom client. + if (!isIncomingOnly) setupServerWidget(), + ], + ); + + return Container( + height: height, + child: Obx(() => isIncomingOnly + ? Column( + children: [ + basicWidget(), + Align( + child: startServiceWidget(), + alignment: Alignment.centerLeft) + .marginOnly(top: 2.0, left: 22.0), + ], + ) + : basicWidget()), ).paddingOnly(right: isIncomingOnly ? 8 : 0); }