Update Selector 2

This commit is contained in:
chen08209
2024-05-04 01:14:56 +08:00
parent dbf1724cca
commit fc0767ed25
2 changed files with 24 additions and 25 deletions

View File

@@ -366,32 +366,31 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
}) { }) {
return SingleChildScrollView( return SingleChildScrollView(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: AnimateGrid<Proxy>( child: Selector3<AppState, Config, ClashConfig, ProxiesCardSelectorState>(
items: _getProxies(group.all, proxiesSortType), selector: (_, appState, config, clashConfig) =>
columns: columns, ProxiesCardSelectorState(
itemHeight: _getItemHeight(), currentGroupName: appState.getCurrentGroupName(
keyBuilder: (item) { config.currentGroupName,
return ObjectKey(item); clashConfig.mode,
}, ),
builder: (_, proxy) { currentProxyName: appState.getCurrentProxyName(
return Selector3<AppState, Config, ClashConfig, config.currentProxyName,
ProxiesCardSelectorState>( clashConfig.mode,
selector: (_, appState, config, clashConfig) => ),
ProxiesCardSelectorState( ),
currentGroupName: appState.getCurrentGroupName( builder: (_, state, __) {
config.currentGroupName, return AnimateGrid<Proxy>(
clashConfig.mode, items: _getProxies(group.all, proxiesSortType),
), columns: columns,
currentProxyName: appState.getCurrentProxyName( itemHeight: _getItemHeight(),
config.currentProxyName, keyBuilder: (item) {
clashConfig.mode, return ObjectKey(item);
), },
), builder: (_, proxy) {
builder: (_, state, __) {
final isSelected = group.type == GroupType.Selector final isSelected = group.type == GroupType.Selector
? group.name == state.currentGroupName && ? group.name == state.currentGroupName &&
proxy.name == state.currentProxyName proxy.name == state.currentProxyName
: group.now == state.currentProxyName; : group.now == proxy.name;
return _card( return _card(
isSelected: isSelected, isSelected: isSelected,
onPressed: () { onPressed: () {

View File

@@ -1,7 +1,7 @@
name: fl_clash name: fl_clash
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free. description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
publish_to: 'none' publish_to: 'none'
version: 0.7.6 version: 0.7.7
environment: environment:
sdk: '>=3.1.0 <4.0.0' sdk: '>=3.1.0 <4.0.0'