|
@@ -28,12 +28,33 @@ class HomeView extends GetView<HomeController> {
|
|
|
),
|
|
|
child: Scaffold(
|
|
|
backgroundColor: Colors.transparent,
|
|
|
- appBar: const SysAppBar(title: Text("首页"),),
|
|
|
+ appBar: SysAppBar(title: Text("首页"),actions: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ IconButton(
|
|
|
+ icon: const Icon(Icons.refresh),
|
|
|
+ onPressed: () {
|
|
|
+ controller.fetchNode();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ const Text('刷新节点'), // 这里是您的标题
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],),
|
|
|
|
|
|
body: Obx(() {
|
|
|
-
|
|
|
- return controller.globalController.isLoading.value ? const CircularProgressIndicator() : Column(
|
|
|
+ if(controller.errorMsg.isNotEmpty){
|
|
|
+ WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
+ ScaffoldMessenger.of(context).showSnackBar(
|
|
|
+ SnackBar(content: Text(controller.errorMsg.value))
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return controller.isLoading.value ? const Center(child: CircularProgressIndicator()) : Column(
|
|
|
children: [
|
|
|
+ // 错误消息展示
|
|
|
+
|
|
|
+
|
|
|
UserStatusWidget(isActive: controller.GetEnable(),isLoading: controller.isLoading.value,username:controller.GetUserName(),expiryDate: controller.GetExpiredAt(),userTraffic:controller.GetTraffic(),onRefresh: () async {
|
|
|
// 这里插入刷新操作代码
|
|
|
//await Future.delayed(Duration(seconds: 2));
|
|
@@ -142,6 +163,7 @@ class _UserStatusWidgetState extends State<UserStatusWidget> {
|
|
|
Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, // 这将使子组件从左边开始对齐
|
|
|
children: [
|
|
|
+
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(widget.username),
|