Skip to content

Commit

Permalink
Hotfix for #22
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrot committed Apr 14, 2022
1 parent a02a24d commit b3ee45e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/components/list.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:wsl2distromanager/components/api.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:wsl2distromanager/dialogs/dialogs.dart';
Expand Down Expand Up @@ -28,9 +30,17 @@ class _DistroListState extends State<DistroList> {
@override
void initState() {
initPrefs();
reloadEvery5Seconds();
super.initState();
}

void reloadEvery5Seconds() async {
for (;;) {
await Future.delayed(const Duration(seconds: 5));
setState(() {});
}
}

@override
Widget build(BuildContext context) {
return distroList(widget.api, widget.statusMsg, hover);
Expand All @@ -43,6 +53,7 @@ FutureBuilder<Instances> distroList(WSLApi api,
return FutureBuilder<Instances>(
future: api.list(),
builder: (context, snapshot) {
// Update every 20 seconds
if (snapshot.hasData) {
List<Widget> newList = [];
List<String> list = snapshot.data?.all ?? [];
Expand Down

0 comments on commit b3ee45e

Please # to comment.