Skip to content

Commit

Permalink
[*]Add refresh button on proxies list & fix grey screen on release
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Dec 19, 2023
1 parent 735ebd7 commit 64484e5
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 16 deletions.
29 changes: 28 additions & 1 deletion lib/controller/proxies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ class ProxiesController extends GetxController {
final FrpcController f_c = Get.find();
var proxiesListWidgets = <DataRow>[
DataRow(cells: <DataCell>[
DataCell(Text('加载中喵喵喵?')),
DataCell(SizedBox(
height: 22.0,
width: 22.0,
child: CircularProgressIndicator(
strokeWidth: 2,
),
)),
DataCell(Text('-')),
DataCell(Text('-')),
DataCell(Text('-')),
Expand Down Expand Up @@ -80,4 +86,25 @@ class ProxiesController extends GetxController {
);
}
}

reload(username, token) {
proxiesListWidgets.value = <DataRow>[
DataRow(cells: <DataCell>[
DataCell(SizedBox(
height: 22.0,
width: 22.0,
child: CircularProgressIndicator(
strokeWidth: 2,
),
)),
DataCell(Text('-')),
DataCell(Text('-')),
DataCell(Text('-')),
DataCell(Text('-')),
DataCell(Text('-')),
DataCell(Text('-')),
])
];
load(username, token);
}
}
46 changes: 31 additions & 15 deletions lib/ui/panel/proxies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,37 @@ class PanelProxies extends StatelessWidget {
.actions(),
),
drawer: DrawerX(context: context).drawer(),
body: ListView(children: [
Obx(() => DataTable(
columnSpacing: 5.0,
columns: <DataColumn>[
DataColumn(label: Expanded(child: Text('名称'))),
DataColumn(label: Expanded(child: Text('ID'))),
DataColumn(label: Expanded(child: Text('节点'))),
DataColumn(label: Expanded(child: Text('协议'))),
DataColumn(label: Expanded(child: Text('本地IP'))),
DataColumn(label: Expanded(child: Text('端口'))),
DataColumn(label: Expanded(child: Text('操作')))
],
rows: p_c.proxiesListWidgets,
))
]),
body: Container(
margin: EdgeInsets.all(40.0),
child: ListView(
children: [
ElevatedButton(
onPressed: () => {p_c.reload(c.user, c.token)},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[Text('刷新'), Icon(Icons.refresh)],
),
),
Obx(() => Column(
children: [
DataTable(
columnSpacing: 5.0,
columns: <DataColumn>[
DataColumn(label: Flexible(child: Text('名称'))),
DataColumn(label: Flexible(child: Text('ID'))),
DataColumn(label: Flexible(child: Text('节点'))),
DataColumn(label: Flexible(child: Text('协议'))),
DataColumn(label: Flexible(child: Text('本地IP'))),
DataColumn(label: Flexible(child: Text('端口'))),
DataColumn(label: Flexible(child: Text('操作')))
],
rows: p_c.proxiesListWidgets.value,
),
],
))
],
),
),
floatingActionButton: FloatingActionButtonX().button());
}
}

0 comments on commit 64484e5

Please sign in to comment.