Merge pull request #5433 from 21pages/ab
replace offstage with if-else for LinearProgressIndicator in dialog
This commit is contained in:
commit
08af0d4bf2
@ -46,6 +46,7 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
}
|
}
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
if (gFFI.abModel.retrying.value) LinearProgressIndicator(),
|
if (gFFI.abModel.retrying.value) LinearProgressIndicator(),
|
||||||
_buildErrorBanner(
|
_buildErrorBanner(
|
||||||
err: gFFI.abModel.pullError,
|
err: gFFI.abModel.pullError,
|
||||||
@ -397,8 +398,8 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 4.0,
|
height: 4.0,
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
@ -463,8 +464,8 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 4.0,
|
height: 4.0,
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -156,8 +156,8 @@ void changeIdDialog() {
|
|||||||
}).toList(),
|
}).toList(),
|
||||||
)).marginOnly(bottom: 8)
|
)).marginOnly(bottom: 8)
|
||||||
: SizedBox.shrink(),
|
: SizedBox.shrink(),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
@ -202,8 +202,8 @@ void changeWhiteList({Function()? callback}) async {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 4.0,
|
height: 4.0,
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
@ -1435,8 +1435,8 @@ void editAbTagDialog(
|
|||||||
.toList(growable: false),
|
.toList(growable: false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
@ -1496,9 +1496,9 @@ void renameDialog(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(() => Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: isInProgress.isFalse,
|
Obx(() =>
|
||||||
child: const LinearProgressIndicator())),
|
isInProgress.value ? const LinearProgressIndicator() : Offstage())
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -12,7 +12,15 @@ import 'package:url_launcher/url_launcher.dart';
|
|||||||
import '../../common.dart';
|
import '../../common.dart';
|
||||||
import './dialog.dart';
|
import './dialog.dart';
|
||||||
|
|
||||||
const kOpSvgList = ['github', 'google', 'apple', 'okta', 'facebook', 'azure', 'auth0'];
|
const kOpSvgList = [
|
||||||
|
'github',
|
||||||
|
'google',
|
||||||
|
'apple',
|
||||||
|
'okta',
|
||||||
|
'facebook',
|
||||||
|
'azure',
|
||||||
|
'auth0'
|
||||||
|
];
|
||||||
|
|
||||||
class _IconOP extends StatelessWidget {
|
class _IconOP extends StatelessWidget {
|
||||||
final String op;
|
final String op;
|
||||||
@ -27,7 +35,8 @@ class _IconOP extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final svgFile = kOpSvgList.contains(op.toLowerCase()) ? op.toLowerCase() : 'default';
|
final svgFile =
|
||||||
|
kOpSvgList.contains(op.toLowerCase()) ? op.toLowerCase() : 'default';
|
||||||
return Container(
|
return Container(
|
||||||
margin: margin,
|
margin: margin,
|
||||||
child: icon == null
|
child: icon == null
|
||||||
@ -345,9 +354,8 @@ class LoginWidgetUserPass extends StatelessWidget {
|
|||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
errorText: passMsg,
|
errorText: passMsg,
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress,
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
child: const LinearProgressIndicator()),
|
|
||||||
const SizedBox(height: 12.0),
|
const SizedBox(height: 12.0),
|
||||||
FittedBox(
|
FittedBox(
|
||||||
child:
|
child:
|
||||||
@ -664,9 +672,8 @@ Future<bool?> verificationCodeDialog(UserPayload? user) async {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress,
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
child: const LinearProgressIndicator()),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onCancel: close,
|
onCancel: close,
|
||||||
|
@ -27,11 +27,13 @@ final peerCardUiType = PeerUiType.grid.obs;
|
|||||||
|
|
||||||
class _PeerCard extends StatefulWidget {
|
class _PeerCard extends StatefulWidget {
|
||||||
final Peer peer;
|
final Peer peer;
|
||||||
|
final PeerTabIndex tab;
|
||||||
final Function(BuildContext, String) connect;
|
final Function(BuildContext, String) connect;
|
||||||
final PopupMenuEntryBuilder popupMenuEntryBuilder;
|
final PopupMenuEntryBuilder popupMenuEntryBuilder;
|
||||||
|
|
||||||
const _PeerCard(
|
const _PeerCard(
|
||||||
{required this.peer,
|
{required this.peer,
|
||||||
|
required this.tab,
|
||||||
required this.connect,
|
required this.connect,
|
||||||
required this.popupMenuEntryBuilder,
|
required this.popupMenuEntryBuilder,
|
||||||
Key? key})
|
Key? key})
|
||||||
@ -71,10 +73,14 @@ class _PeerCardState extends State<_PeerCard>
|
|||||||
if (peerTabModel.multiSelectionMode) {
|
if (peerTabModel.multiSelectionMode) {
|
||||||
peerTabModel.select(peer);
|
peerTabModel.select(peer);
|
||||||
} else {
|
} else {
|
||||||
if (!isWebDesktop) connect(context, peer.id);
|
if (!isWebDesktop) {
|
||||||
|
connectInPeerTab(context, peer.id, widget.tab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDoubleTap: isWebDesktop ? () => connect(context, peer.id) : null,
|
onDoubleTap: isWebDesktop
|
||||||
|
? () => connectInPeerTab(context, peer.id, widget.tab)
|
||||||
|
: null,
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
peerTabModel.select(peer);
|
peerTabModel.select(peer);
|
||||||
},
|
},
|
||||||
@ -443,7 +449,9 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _PeerCard(
|
return _PeerCard(
|
||||||
peer: peer,
|
peer: peer,
|
||||||
connect: (BuildContext context, String id) => connect(context, id),
|
tab: tab,
|
||||||
|
connect: (BuildContext context, String id) =>
|
||||||
|
connectInPeerTab(context, id, tab),
|
||||||
popupMenuEntryBuilder: _buildPopupMenuEntry,
|
popupMenuEntryBuilder: _buildPopupMenuEntry,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -477,9 +485,10 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
style: style,
|
style: style,
|
||||||
),
|
),
|
||||||
proc: () {
|
proc: () {
|
||||||
connect(
|
connectInPeerTab(
|
||||||
context,
|
context,
|
||||||
peer.id,
|
peer.id,
|
||||||
|
tab,
|
||||||
isFileTransfer: isFileTransfer,
|
isFileTransfer: isFileTransfer,
|
||||||
isTcpTunneling: isTcpTunneling,
|
isTcpTunneling: isTcpTunneling,
|
||||||
isRDP: isRDP,
|
isRDP: isRDP,
|
||||||
@ -552,7 +561,7 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
proc: () {
|
proc: () {
|
||||||
connect(context, id, isRDP: true);
|
connectInPeerTab(context, id, tab, isRDP: true);
|
||||||
},
|
},
|
||||||
padding: menuPadding,
|
padding: menuPadding,
|
||||||
dismissOnClicked: true,
|
dismissOnClicked: true,
|
||||||
@ -1309,3 +1318,26 @@ class TagPainter extends CustomPainter {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void connectInPeerTab(BuildContext context, String id, PeerTabIndex tab,
|
||||||
|
{bool isFileTransfer = false,
|
||||||
|
bool isTcpTunneling = false,
|
||||||
|
bool isRDP = false}) async {
|
||||||
|
if (tab == PeerTabIndex.ab) {
|
||||||
|
// If recent peer's alias is empty, set it to ab's alias
|
||||||
|
// Because the platform is not set, it may not take effect, but it is more important not to display if the connection is not successful
|
||||||
|
Peer? p = gFFI.abModel.find(id);
|
||||||
|
if (p != null &&
|
||||||
|
p.alias.isNotEmpty &&
|
||||||
|
(await bind.mainGetPeerOption(id: id, key: "alias")).isEmpty) {
|
||||||
|
await bind.mainSetPeerAlias(
|
||||||
|
id: id,
|
||||||
|
alias: p.alias,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connect(context, id,
|
||||||
|
isFileTransfer: isFileTransfer,
|
||||||
|
isTcpTunneling: isTcpTunneling,
|
||||||
|
isRDP: isRDP);
|
||||||
|
}
|
||||||
|
@ -208,10 +208,9 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _createRefresh() {
|
Widget _createRefresh() {
|
||||||
|
if (gFFI.peerTabModel.currentTab < 3) return Offstage();
|
||||||
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
||||||
return Offstage(
|
return Container(
|
||||||
offstage: gFFI.peerTabModel.currentTab < 3, // local tab can't see effect
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(4.0),
|
padding: EdgeInsets.all(4.0),
|
||||||
child: AnimatedRotationWidget(
|
child: AnimatedRotationWidget(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -229,7 +228,6 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
size: 18,
|
size: 18,
|
||||||
color: textColor,
|
color: textColor,
|
||||||
)))),
|
)))),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2065,9 +2065,9 @@ void changeSocks5Proxy() async {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress,
|
if (isInProgress)
|
||||||
child: const LinearProgressIndicator().marginOnly(top: 8))
|
const LinearProgressIndicator().marginOnly(top: 8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -182,8 +182,8 @@ class _InstallPageBodyState extends State<_InstallPageBody>
|
|||||||
.marginOnly(bottom: em),
|
.marginOnly(bottom: em),
|
||||||
InkWell(
|
InkWell(
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
onTap: () =>
|
onTap: () => launchUrlString(
|
||||||
launchUrlString('https://rustdesk.com/privacy.html'),
|
'https://rustdesk.com/privacy.html'),
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: 'https://rustdesk.com/privacy.html',
|
message: 'https://rustdesk.com/privacy.html',
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
@ -204,11 +204,10 @@ class _InstallPageBodyState extends State<_InstallPageBody>
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(() => Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !showProgress.value,
|
child: Obx(() => showProgress.value
|
||||||
child:
|
? LinearProgressIndicator().marginOnly(right: 10)
|
||||||
LinearProgressIndicator().marginOnly(right: 10),
|
: Offstage()),
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => OutlinedButton.icon(
|
() => OutlinedButton.icon(
|
||||||
|
@ -223,9 +223,8 @@ void showServerSettingsWithValue(
|
|||||||
labelText: 'Key',
|
labelText: 'Key',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Offstage(
|
// NOT use Offstage to wrap LinearProgressIndicator
|
||||||
offstage: !isInProgress,
|
if (isInProgress) const LinearProgressIndicator(),
|
||||||
child: LinearProgressIndicator())
|
|
||||||
])),
|
])),
|
||||||
actions: [
|
actions: [
|
||||||
dialogButton('Cancel', onPressed: () {
|
dialogButton('Cancel', onPressed: () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user