This commit is contained in:
lollipopkit
2023-07-21 14:37:29 +08:00
parent 0d5707a1df
commit b443870e62
5 changed files with 65 additions and 7 deletions

View File

@@ -49,7 +49,6 @@ class _ServerPageState extends State<ServerPage>
late ServerProvider _serverProvider;
late SettingStore _settingStore;
late S _s;
late NetViewType _netViewType;
String? _tag;
@@ -58,7 +57,6 @@ class _ServerPageState extends State<ServerPage>
super.initState();
_serverProvider = locator<ServerProvider>();
_settingStore = locator<SettingStore>();
_netViewType = _settingStore.netViewType.fetch() ?? NetViewType.speed;
}
@override
@@ -333,10 +331,15 @@ class _ServerPageState extends State<ServerPage>
}
Widget _buildNet(ServerStatus ss) {
final data = _netViewType.build(ss);
return AnimatedSwitcher(
duration: const Duration(milliseconds: 177),
child: _buildIOData(data.up, data.down),
return ValueListenableBuilder<NetViewType>(
valueListenable: _settingStore.netViewType.listenable(),
builder: (_, val, __) {
final data = val.build(ss);
return AnimatedSwitcher(
duration: const Duration(milliseconds: 177),
child: _buildIOData(data.up, data.down),
);
},
);
}

View File

@@ -924,7 +924,7 @@ class _SettingPageState extends State<SettingPage> {
),
),
onTap: () {
_keyboardTypeKey.currentState?.showButtonMenu();
_netViewTypeKey.currentState?.showButtonMenu();
},
);
}