diff --git a/lib/controller/proxies.dart b/lib/controller/proxies.dart index fbf8e467..06bb30e9 100644 --- a/lib/controller/proxies.dart +++ b/lib/controller/proxies.dart @@ -11,7 +11,13 @@ class ProxiesController extends GetxController { final FrpcController f_c = Get.find(); var proxiesListWidgets = [ DataRow(cells: [ - DataCell(Text('加载中喵喵喵?')), + DataCell(SizedBox( + height: 22.0, + width: 22.0, + child: CircularProgressIndicator( + strokeWidth: 2, + ), + )), DataCell(Text('-')), DataCell(Text('-')), DataCell(Text('-')), @@ -80,4 +86,25 @@ class ProxiesController extends GetxController { ); } } + + reload(username, token) { + proxiesListWidgets.value = [ + DataRow(cells: [ + 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); + } } diff --git a/lib/ui/panel/proxies.dart b/lib/ui/panel/proxies.dart index aee3ba0e..86454f81 100644 --- a/lib/ui/panel/proxies.dart +++ b/lib/ui/panel/proxies.dart @@ -34,21 +34,37 @@ class PanelProxies extends StatelessWidget { .actions(), ), drawer: DrawerX(context: context).drawer(), - body: ListView(children: [ - Obx(() => DataTable( - columnSpacing: 5.0, - columns: [ - 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: [Text('刷新'), Icon(Icons.refresh)], + ), + ), + Obx(() => Column( + children: [ + DataTable( + columnSpacing: 5.0, + columns: [ + 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()); } }