mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
ab:deal push error, show error banner, fix splash empty by remove reset
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -45,12 +45,17 @@ class _AddressBookState extends State<AddressBook> {
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
if (gFFI.abModel.abError.isNotEmpty) {
|
||||
return _buildShowError(gFFI.abModel.abError.value);
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
_buildLoadingHavingPeers(),
|
||||
_buildNotEmptyLoading(),
|
||||
_buildErrorBanner(
|
||||
err: gFFI.abModel.pullError,
|
||||
retry: null,
|
||||
close: () => gFFI.abModel.pullError.value = ''),
|
||||
_buildErrorBanner(
|
||||
err: gFFI.abModel.pushError,
|
||||
retry: () => gFFI.abModel.pushAb(),
|
||||
close: () => gFFI.abModel.pushError.value = ''),
|
||||
Expanded(
|
||||
child: isDesktop
|
||||
? _buildAddressBookDesktop()
|
||||
@@ -60,22 +65,62 @@ class _AddressBookState extends State<AddressBook> {
|
||||
}
|
||||
});
|
||||
|
||||
Widget _buildShowError(String error) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(translate(error)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
gFFI.abModel.pullAb();
|
||||
},
|
||||
child: Text(translate("Retry")))
|
||||
],
|
||||
));
|
||||
Widget _buildErrorBanner(
|
||||
{required RxString err,
|
||||
required Function? retry,
|
||||
required Function close}) {
|
||||
const double height = 25;
|
||||
return Obx(() => Offstage(
|
||||
offstage: !(!gFFI.abModel.abLoading.value && err.value.isNotEmpty),
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: height,
|
||||
color: Color.fromARGB(255, 253, 238, 235),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
FittedBox(
|
||||
child: Icon(
|
||||
Icons.info,
|
||||
color: Color.fromARGB(255, 249, 81, 81),
|
||||
),
|
||||
).marginAll(4),
|
||||
Flexible(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Tooltip(
|
||||
message: translate(err.value),
|
||||
child: Text(
|
||||
translate(err.value),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)).marginSymmetric(vertical: 2),
|
||||
),
|
||||
if (retry != null)
|
||||
InkWell(
|
||||
onTap: () {
|
||||
retry.call();
|
||||
},
|
||||
child: Text(
|
||||
translate("Retry"),
|
||||
style: TextStyle(color: MyTheme.accent),
|
||||
)).marginSymmetric(horizontal: 5),
|
||||
FittedBox(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
close.call();
|
||||
},
|
||||
child: Icon(Icons.close).marginSymmetric(horizontal: 5),
|
||||
),
|
||||
).marginAll(4)
|
||||
],
|
||||
),
|
||||
)).marginOnly(bottom: 14),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildLoadingHavingPeers() {
|
||||
Widget _buildNotEmptyLoading() {
|
||||
double size = 15;
|
||||
return Obx(() => Offstage(
|
||||
offstage: !(gFFI.abModel.abLoading.value && !gFFI.abModel.emtpy),
|
||||
|
||||
@@ -229,13 +229,14 @@ class _PeerCardState extends State<_PeerCard>
|
||||
: '',
|
||||
child: Stack(children: [
|
||||
child,
|
||||
Positioned(
|
||||
top: 2,
|
||||
right: 10,
|
||||
child: CustomPaint(
|
||||
painter: TagPainter(radius: 3, colors: colors),
|
||||
),
|
||||
)
|
||||
if (colors.isNotEmpty)
|
||||
Positioned(
|
||||
top: 2,
|
||||
right: 10,
|
||||
child: CustomPaint(
|
||||
painter: TagPainter(radius: 3, colors: colors),
|
||||
),
|
||||
)
|
||||
]),
|
||||
);
|
||||
}
|
||||
@@ -329,13 +330,14 @@ class _PeerCardState extends State<_PeerCard>
|
||||
: '',
|
||||
child: Stack(children: [
|
||||
child,
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 12,
|
||||
child: CustomPaint(
|
||||
painter: TagPainter(radius: 4, colors: colors),
|
||||
),
|
||||
)
|
||||
if (colors.isNotEmpty)
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 12,
|
||||
child: CustomPaint(
|
||||
painter: TagPainter(radius: 4, colors: colors),
|
||||
),
|
||||
)
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user