|
|
@@ -2,8 +2,11 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:nomo/config/theme/theme_extensions/theme_extension.dart';
|
|
|
+import 'package:nomo/utils/misc.dart';
|
|
|
+
|
|
|
import '../../../../config/translations/strings_enum.dart';
|
|
|
import '../../../base/base_view.dart';
|
|
|
+import '../../../widgets/click_opacity.dart';
|
|
|
import '../../../widgets/ix_app_bar.dart';
|
|
|
import '../controllers/node_controller.dart';
|
|
|
import '../widgets/node_list.dart';
|
|
|
@@ -12,7 +15,23 @@ class NodeView extends BaseView<NodeController> {
|
|
|
const NodeView({super.key});
|
|
|
|
|
|
@override
|
|
|
- PreferredSizeWidget? get appBar => IXAppBar(title: Strings.selectServer.tr);
|
|
|
+ PreferredSizeWidget? get appBar => IXAppBar(
|
|
|
+ title: Strings.selectServer.tr,
|
|
|
+ actions: [
|
|
|
+ if (isDesktop)
|
|
|
+ ClickOpacity(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
+ child: Icon(
|
|
|
+ Icons.refresh,
|
|
|
+ size: 20.w,
|
|
|
+ color: Get.reactiveTheme.hintColor,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ onTap: () => controller.refreshLocations(),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
|
|
|
@override
|
|
|
Widget buildContent(BuildContext context) {
|
|
|
@@ -25,6 +44,7 @@ class NodeView extends BaseView<NodeController> {
|
|
|
initialIndex: controller.currentTabIndex, // 恢复上次的 Tab 位置
|
|
|
child: Column(
|
|
|
children: [
|
|
|
+ if (isDesktop) _buildRefreshingIndicator(),
|
|
|
_buildTabs(),
|
|
|
Expanded(child: _buildTabBarView()),
|
|
|
],
|
|
|
@@ -32,6 +52,20 @@ class NodeView extends BaseView<NodeController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget _buildRefreshingIndicator() {
|
|
|
+ return Obx(
|
|
|
+ () => controller.isRefreshing
|
|
|
+ ? LinearProgressIndicator(
|
|
|
+ backgroundColor: Get.reactiveTheme.scaffoldBackgroundColor,
|
|
|
+ minHeight: 2.w,
|
|
|
+ valueColor: AlwaysStoppedAnimation<Color>(
|
|
|
+ Get.reactiveTheme.primaryColor,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : const SizedBox(height: 2),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Widget _buildTabs() {
|
|
|
return TabBar(
|
|
|
splashFactory: NoSplash.splashFactory,
|