feat closable update card
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
parent
ae37c2ab2a
commit
31101221e0
@ -48,6 +48,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
var watchIsInputMonitoring = false;
|
var watchIsInputMonitoring = false;
|
||||||
var watchIsCanRecordAudio = false;
|
var watchIsCanRecordAudio = false;
|
||||||
Timer? _updateTimer;
|
Timer? _updateTimer;
|
||||||
|
bool isCardClosed = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -321,14 +322,15 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Widget> buildHelpCards() async {
|
Future<Widget> buildHelpCards() async {
|
||||||
if (updateUrl.isNotEmpty) {
|
if (updateUrl.isNotEmpty && !isCardClosed) {
|
||||||
return buildInstallCard(
|
return buildInstallCard(
|
||||||
"Status",
|
"Status",
|
||||||
"There is a newer version of ${bind.mainGetAppNameSync()} ${bind.mainGetNewVersion()} available.",
|
"There is a newer version of ${bind.mainGetAppNameSync()} ${bind.mainGetNewVersion()} available.",
|
||||||
"Click to download", () async {
|
"Click to download", () async {
|
||||||
final Uri url = Uri.parse('https://rustdesk.com/download');
|
final Uri url = Uri.parse('https://rustdesk.com/download');
|
||||||
await launchUrl(url);
|
await launchUrl(url);
|
||||||
});
|
},
|
||||||
|
closeButton: true);
|
||||||
}
|
}
|
||||||
if (systemError.isNotEmpty) {
|
if (systemError.isNotEmpty) {
|
||||||
return buildInstallCard("", systemError, "", () {});
|
return buildInstallCard("", systemError, "", () {});
|
||||||
@ -394,8 +396,17 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
|
|
||||||
Widget buildInstallCard(String title, String content, String btnText,
|
Widget buildInstallCard(String title, String content, String btnText,
|
||||||
GestureTapCallback onPressed,
|
GestureTapCallback onPressed,
|
||||||
{String? help, String? link}) {
|
{String? help, String? link, bool? closeButton}) {
|
||||||
return Container(
|
|
||||||
|
void closeCard() {
|
||||||
|
setState(() {
|
||||||
|
isCardClosed = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
margin: EdgeInsets.only(top: 20),
|
margin: EdgeInsets.only(top: 20),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -467,6 +478,21 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
)).marginOnly(top: 6)),
|
)).marginOnly(top: 6)),
|
||||||
]
|
]
|
||||||
: <Widget>[]))),
|
: <Widget>[]))),
|
||||||
|
),
|
||||||
|
if (closeButton != null && closeButton == true)
|
||||||
|
Positioned(
|
||||||
|
top: 18,
|
||||||
|
right: 0,
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
onPressed: closeCard,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user