replace offstage with if-else for LinearProgressIndicator in dialog
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
a7163c6a04
commit
979203cbdb
@ -46,6 +46,7 @@ class _AddressBookState extends State<AddressBook> {
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (gFFI.abModel.retrying.value) LinearProgressIndicator(),
|
||||
_buildErrorBanner(
|
||||
err: gFFI.abModel.pullError,
|
||||
@ -397,8 +398,8 @@ class _AddressBookState extends State<AddressBook> {
|
||||
const SizedBox(
|
||||
height: 4.0,
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@ -463,8 +464,8 @@ class _AddressBookState extends State<AddressBook> {
|
||||
const SizedBox(
|
||||
height: 4.0,
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
|
@ -156,8 +156,8 @@ void changeIdDialog() {
|
||||
}).toList(),
|
||||
)).marginOnly(bottom: 8)
|
||||
: SizedBox.shrink(),
|
||||
Offstage(
|
||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@ -202,8 +202,8 @@ void changeWhiteList({Function()? callback}) async {
|
||||
const SizedBox(
|
||||
height: 4.0,
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@ -1435,8 +1435,8 @@ void editAbTagDialog(
|
||||
.toList(growable: false),
|
||||
),
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress, child: const LinearProgressIndicator())
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@ -1496,9 +1496,9 @@ void renameDialog(
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(() => Offstage(
|
||||
offstage: isInProgress.isFalse,
|
||||
child: const LinearProgressIndicator())),
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
Obx(() =>
|
||||
isInProgress.value ? const LinearProgressIndicator() : Offstage())
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
|
@ -12,7 +12,15 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../common.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 {
|
||||
final String op;
|
||||
@ -27,7 +35,8 @@ class _IconOP extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final svgFile = kOpSvgList.contains(op.toLowerCase()) ? op.toLowerCase() : 'default';
|
||||
final svgFile =
|
||||
kOpSvgList.contains(op.toLowerCase()) ? op.toLowerCase() : 'default';
|
||||
return Container(
|
||||
margin: margin,
|
||||
child: icon == null
|
||||
@ -345,9 +354,8 @@ class LoginWidgetUserPass extends StatelessWidget {
|
||||
autoFocus: false,
|
||||
errorText: passMsg,
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress,
|
||||
child: const LinearProgressIndicator()),
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
const SizedBox(height: 12.0),
|
||||
FittedBox(
|
||||
child:
|
||||
@ -664,9 +672,8 @@ Future<bool?> verificationCodeDialog(UserPayload? user) async {
|
||||
},
|
||||
),
|
||||
*/
|
||||
Offstage(
|
||||
offstage: !isInProgress,
|
||||
child: const LinearProgressIndicator()),
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
],
|
||||
),
|
||||
onCancel: close,
|
||||
|
@ -208,28 +208,26 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
}
|
||||
|
||||
Widget _createRefresh() {
|
||||
if (gFFI.peerTabModel.currentTab < 3) return Offstage();
|
||||
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
||||
return Offstage(
|
||||
offstage: gFFI.peerTabModel.currentTab < 3, // local tab can't see effect
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: AnimatedRotationWidget(
|
||||
onPressed: () {
|
||||
if (gFFI.peerTabModel.currentTab < entries.length) {
|
||||
entries[gFFI.peerTabModel.currentTab].load();
|
||||
}
|
||||
},
|
||||
spinning: gFFI.abModel.abLoading,
|
||||
child: RotatedBox(
|
||||
quarterTurns: 2,
|
||||
child: Tooltip(
|
||||
message: translate('Refresh'),
|
||||
child: Icon(
|
||||
Icons.refresh,
|
||||
size: 18,
|
||||
color: textColor,
|
||||
)))),
|
||||
),
|
||||
return Container(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: AnimatedRotationWidget(
|
||||
onPressed: () {
|
||||
if (gFFI.peerTabModel.currentTab < entries.length) {
|
||||
entries[gFFI.peerTabModel.currentTab].load();
|
||||
}
|
||||
},
|
||||
spinning: gFFI.abModel.abLoading,
|
||||
child: RotatedBox(
|
||||
quarterTurns: 2,
|
||||
child: Tooltip(
|
||||
message: translate('Refresh'),
|
||||
child: Icon(
|
||||
Icons.refresh,
|
||||
size: 18,
|
||||
color: textColor,
|
||||
)))),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2065,9 +2065,9 @@ void changeSocks5Proxy() async {
|
||||
),
|
||||
],
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress,
|
||||
child: const LinearProgressIndicator().marginOnly(top: 8))
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress)
|
||||
const LinearProgressIndicator().marginOnly(top: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -182,8 +182,8 @@ class _InstallPageBodyState extends State<_InstallPageBody>
|
||||
.marginOnly(bottom: em),
|
||||
InkWell(
|
||||
hoverColor: Colors.transparent,
|
||||
onTap: () =>
|
||||
launchUrlString('https://rustdesk.com/privacy.html'),
|
||||
onTap: () => launchUrlString(
|
||||
'https://rustdesk.com/privacy.html'),
|
||||
child: Tooltip(
|
||||
message: 'https://rustdesk.com/privacy.html',
|
||||
child: Row(children: [
|
||||
@ -204,11 +204,10 @@ class _InstallPageBodyState extends State<_InstallPageBody>
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Obx(() => Offstage(
|
||||
offstage: !showProgress.value,
|
||||
child:
|
||||
LinearProgressIndicator().marginOnly(right: 10),
|
||||
)),
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
child: Obx(() => showProgress.value
|
||||
? LinearProgressIndicator().marginOnly(right: 10)
|
||||
: Offstage()),
|
||||
),
|
||||
Obx(
|
||||
() => OutlinedButton.icon(
|
||||
|
@ -223,9 +223,8 @@ void showServerSettingsWithValue(
|
||||
labelText: 'Key',
|
||||
),
|
||||
),
|
||||
Offstage(
|
||||
offstage: !isInProgress,
|
||||
child: LinearProgressIndicator())
|
||||
// NOT use Offstage to wrap LinearProgressIndicator
|
||||
if (isInProgress) const LinearProgressIndicator(),
|
||||
])),
|
||||
actions: [
|
||||
dialogButton('Cancel', onPressed: () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user