Skip to content

Commit 5dda285

Browse files
committed
Fix list form input view issues
Fix traffic view issues
1 parent 5184ed6 commit 5dda285

File tree

11 files changed

+248
-211
lines changed

11 files changed

+248
-211
lines changed

lib/fragments/config/dns.dart

Lines changed: 178 additions & 153 deletions
Large diffs are not rendered by default.

lib/fragments/config/general.dart

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,31 +189,35 @@ class MixedPortItem extends ConsumerWidget {
189189
}
190190
}
191191

192-
class HostsItem extends ConsumerWidget {
192+
class HostsItem extends StatelessWidget {
193193
const HostsItem({super.key});
194194

195195
@override
196-
Widget build(BuildContext context, ref) {
197-
final hosts =
198-
ref.watch(patchClashConfigProvider.select((state) => state.hosts));
196+
Widget build(BuildContext context) {
199197
return ListItem.open(
200198
leading: const Icon(Icons.view_list_outlined),
201199
title: const Text("Hosts"),
202200
subtitle: Text(appLocalizations.hostsDesc),
203201
delegate: OpenDelegate(
204202
isBlur: false,
205203
title: "Hosts",
206-
widget: ListPage(
207-
title: "Hosts",
208-
items: hosts.entries,
209-
titleBuilder: (item) => Text(item.key),
210-
subtitleBuilder: (item) => Text(item.value),
211-
onChange: (items) {
212-
ref.read(patchClashConfigProvider.notifier).updateState(
213-
(state) => state.copyWith(
214-
hosts: Map.fromEntries(items),
215-
),
216-
);
204+
widget: Consumer(
205+
builder: (_, ref, __) {
206+
final hosts = ref
207+
.watch(patchClashConfigProvider.select((state) => state.hosts));
208+
return ListPage(
209+
title: "Hosts",
210+
items: hosts.entries,
211+
titleBuilder: (item) => Text(item.key),
212+
subtitleBuilder: (item) => Text(item.value),
213+
onChange: (items) {
214+
ref.read(patchClashConfigProvider.notifier).updateState(
215+
(state) => state.copyWith(
216+
hosts: Map.fromEntries(items),
217+
),
218+
);
219+
},
220+
);
217221
},
218222
),
219223
extendPageWidth: 360,

lib/fragments/config/network.dart

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class TunStackItem extends ConsumerWidget {
186186
}
187187
}
188188

189-
class BypassDomainItem extends ConsumerWidget {
189+
class BypassDomainItem extends StatelessWidget {
190190
const BypassDomainItem({super.key});
191191

192192
_initActions(BuildContext context, WidgetRef ref) {
@@ -219,32 +219,33 @@ class BypassDomainItem extends ConsumerWidget {
219219
}
220220

221221
@override
222-
Widget build(BuildContext context, ref) {
223-
final bypassDomain =
224-
ref.watch(networkSettingProvider.select((state) => state.bypassDomain));
225-
222+
Widget build(BuildContext context) {
226223
return ListItem.open(
227224
title: Text(appLocalizations.bypassDomain),
228225
subtitle: Text(appLocalizations.bypassDomainDesc),
229226
delegate: OpenDelegate(
230227
isBlur: false,
231228
isScaffold: true,
232229
title: appLocalizations.bypassDomain,
233-
widget: Builder(builder: (context) {
234-
_initActions(context, ref);
235-
return ListPage(
236-
title: appLocalizations.bypassDomain,
237-
items: bypassDomain,
238-
titleBuilder: (item) => Text(item),
239-
onChange: (items) {
240-
ref.read(networkSettingProvider.notifier).updateState(
241-
(state) => state.copyWith(
242-
bypassDomain: List.from(items),
243-
),
244-
);
245-
},
246-
);
247-
}),
230+
widget: Consumer(
231+
builder: (_, ref, __) {
232+
_initActions(context, ref);
233+
final bypassDomain = ref.watch(
234+
networkSettingProvider.select((state) => state.bypassDomain));
235+
return ListPage(
236+
title: appLocalizations.bypassDomain,
237+
items: bypassDomain,
238+
titleBuilder: (item) => Text(item),
239+
onChange: (items) {
240+
ref.read(networkSettingProvider.notifier).updateState(
241+
(state) => state.copyWith(
242+
bypassDomain: List.from(items),
243+
),
244+
);
245+
},
246+
);
247+
},
248+
),
248249
extendPageWidth: 360,
249250
),
250251
);
@@ -293,25 +294,29 @@ class RouteAddressItem extends ConsumerWidget {
293294
if (bypassPrivate) {
294295
return Container();
295296
}
296-
final routeAddress = ref.watch(
297-
patchClashConfigProvider.select((state) => state.tun.routeAddress));
298297
return ListItem.open(
299298
title: Text(appLocalizations.routeAddress),
300299
subtitle: Text(appLocalizations.routeAddressDesc),
301300
delegate: OpenDelegate(
302301
isBlur: false,
303302
isScaffold: true,
304303
title: appLocalizations.routeAddress,
305-
widget: ListPage(
306-
title: appLocalizations.routeAddress,
307-
items: routeAddress,
308-
titleBuilder: (item) => Text(item),
309-
onChange: (items) {
310-
ref.read(patchClashConfigProvider.notifier).updateState(
311-
(state) => state.copyWith.tun(
312-
routeAddress: List.from(items),
313-
),
314-
);
304+
widget: Consumer(
305+
builder: (_, ref, __) {
306+
final routeAddress = ref.watch(patchClashConfigProvider
307+
.select((state) => state.tun.routeAddress));
308+
return ListPage(
309+
title: appLocalizations.routeAddress,
310+
items: routeAddress,
311+
titleBuilder: (item) => Text(item),
312+
onChange: (items) {
313+
ref.read(patchClashConfigProvider.notifier).updateState(
314+
(state) => state.copyWith.tun(
315+
routeAddress: List.from(items),
316+
),
317+
);
318+
},
319+
);
315320
},
316321
),
317322
extendPageWidth: 360,

lib/l10n/arb/intl_en.arb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,5 +343,5 @@
343343
"copyLink": "Copy link",
344344
"exportFile": "Export file",
345345
"cacheCorrupt": "The cache is corrupt. Do you want to clear it?",
346-
"detectionTip": "Relying on third-party APIs is for reference only"
346+
"detectionTip": "Relying on third-party api is for reference only"
347347
}

lib/l10n/arb/intl_zh_CN.arb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,5 +343,5 @@
343343
"copyLink": "复制链接",
344344
"exportFile": "导出文件",
345345
"cacheCorrupt": "缓存已损坏,是否清空?",
346-
"detectionTip": "依赖第三方程序仅供参考"
346+
"detectionTip": "依赖第三方api仅供参考"
347347
}

lib/l10n/intl/messages_en.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class MessageLookup extends MessageLookupByLibrary {
181181
"A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.",
182182
),
183183
"detectionTip": MessageLookupByLibrary.simpleMessage(
184-
"Relying on third-party APIs is for reference only",
184+
"Relying on third-party api is for reference only",
185185
),
186186
"direct": MessageLookupByLibrary.simpleMessage("Direct"),
187187
"disclaimer": MessageLookupByLibrary.simpleMessage("Disclaimer"),

lib/l10n/intl/messages_zh_CN.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class MessageLookup extends MessageLookupByLibrary {
122122
"desc": MessageLookupByLibrary.simpleMessage(
123123
"基于ClashMeta的多平台代理客户端,简单易用,开源无广告。",
124124
),
125-
"detectionTip": MessageLookupByLibrary.simpleMessage("依赖第三方程序仅供参考"),
125+
"detectionTip": MessageLookupByLibrary.simpleMessage("依赖第三方api仅供参考"),
126126
"direct": MessageLookupByLibrary.simpleMessage("直连"),
127127
"disclaimer": MessageLookupByLibrary.simpleMessage("免责声明"),
128128
"disclaimerDesc": MessageLookupByLibrary.simpleMessage(

lib/l10n/l10n.dart

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/models/common.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class TrafficValue {
334334
}
335335
if (_value > pow(1024, 1)) {
336336
return TrafficValueShow(
337-
value: _value / pow(1024, 2),
337+
value: _value / pow(1024, 1),
338338
unit: TrafficUnit.KB,
339339
);
340340
}

lib/widgets/input.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:fl_clash/models/common.dart';
44
import 'package:fl_clash/state.dart';
55
import 'package:fl_clash/widgets/null_status.dart';
66
import 'package:flutter/material.dart';
7+
78
import 'card.dart';
89
import 'float_layout.dart';
910
import 'list.dart';
@@ -118,7 +119,7 @@ class _InputDialogState extends State<InputDialog> {
118119
border: const OutlineInputBorder(),
119120
suffixText: suffixText,
120121
),
121-
onSubmitted: (_){
122+
onSubmitted: (_) {
122123
_handleUpdate();
123124
},
124125
),
@@ -256,7 +257,8 @@ class ListPage<T> extends StatelessWidget {
256257
child: ListItem(
257258
leading: leadingBuilder != null ? leadingBuilder!(e) : null,
258259
title: titleBuilder(e),
259-
subtitle: subtitleBuilder != null ? subtitleBuilder!(e) : null,
260+
subtitle:
261+
subtitleBuilder != null ? subtitleBuilder!(e) : null,
260262
trailing: IconButton(
261263
icon: const Icon(Icons.delete_outline),
262264
onPressed: () {
@@ -318,6 +320,7 @@ class ListPage<T> extends StatelessWidget {
318320

319321
@override
320322
Widget build(BuildContext context) {
323+
print("daad===>$items");
321324
return FloatLayout(
322325
floatingWidget: FloatWrapper(
323326
child: FloatingActionButton(

0 commit comments

Comments
 (0)