fix: mobile, server page, jumps on loading (#8819)
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
f7e9057a39
commit
0451a1c45f
@ -3326,18 +3326,8 @@ bool isInHomePage() {
|
|||||||
return controller.state.value.selected == 0;
|
return controller.state.value.selected == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildPresetPasswordWarning() {
|
Widget _buildPresetPasswordWarning() {
|
||||||
return FutureBuilder<bool>(
|
if (bind.mainGetBuildinOption(key: kOptionRemovePresetPasswordWarning) !=
|
||||||
future: bind.isPresetPassword(),
|
|
||||||
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete
|
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
return Text(
|
|
||||||
'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error
|
|
||||||
} else if (snapshot.hasData && snapshot.data == true) {
|
|
||||||
if (bind.mainGetBuildinOption(
|
|
||||||
key: kOptionRemovePresetPasswordWarning) !=
|
|
||||||
'N') {
|
'N') {
|
||||||
return SizedBox.shrink();
|
return SizedBox.shrink();
|
||||||
}
|
}
|
||||||
@ -3362,6 +3352,27 @@ Widget buildPresetPasswordWarning() {
|
|||||||
],
|
],
|
||||||
).paddingAll(8),
|
).paddingAll(8),
|
||||||
); // Show a warning message if the Future completed with true
|
); // Show a warning message if the Future completed with true
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildPresetPasswordWarningMobile() {
|
||||||
|
if (bind.isPresetPasswordMobileOnly()) {
|
||||||
|
return _buildPresetPasswordWarning();
|
||||||
|
} else {
|
||||||
|
return SizedBox.shrink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildPresetPasswordWarning() {
|
||||||
|
return FutureBuilder<bool>(
|
||||||
|
future: bind.isPresetPassword(),
|
||||||
|
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text(
|
||||||
|
'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error
|
||||||
|
} else if (snapshot.hasData && snapshot.data == true) {
|
||||||
|
return _buildPresetPasswordWarning();
|
||||||
} else {
|
} else {
|
||||||
return SizedBox
|
return SizedBox
|
||||||
.shrink(); // Show nothing if the Future completed with false or null
|
.shrink(); // Show nothing if the Future completed with false or null
|
||||||
|
@ -187,7 +187,7 @@ class _ServerPageState extends State<ServerPage> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
buildPresetPasswordWarning(),
|
buildPresetPasswordWarningMobile(),
|
||||||
gFFI.serverModel.isStart
|
gFFI.serverModel.isStart
|
||||||
? ServerInfo()
|
? ServerInfo()
|
||||||
: ServiceNotRunningNotification(),
|
: ServiceNotRunningNotification(),
|
||||||
|
@ -1966,6 +1966,12 @@ pub fn is_preset_password() -> bool {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't call this function for desktop version.
|
||||||
|
// We need this function because we want a sync return for mobile version.
|
||||||
|
pub fn is_preset_password_mobile_only() -> SyncReturn<bool> {
|
||||||
|
SyncReturn(is_preset_password())
|
||||||
|
}
|
||||||
|
|
||||||
/// Send a url scheme through the ipc.
|
/// Send a url scheme through the ipc.
|
||||||
///
|
///
|
||||||
/// * macOS only
|
/// * macOS only
|
||||||
|
Loading…
x
Reference in New Issue
Block a user