Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arb/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"recoveryAll": "Recovery all data",
"recoverySuccess": "Recovery success",
"backupSuccess": "Backup success",
"copied": "Copied",
"noInfo": "No info",
"pleaseBindWebDAV": "Please bind WebDAV",
"bind": "Bind",
Expand Down
1 change: 1 addition & 0 deletions arb/intl_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"recoveryAll": "全データ復元",
"recoverySuccess": "復元成功",
"backupSuccess": "バックアップ成功",
"copied": "コピーしました",
"noInfo": "情報なし",
"pleaseBindWebDAV": "WebDAVをバインドしてください",
"bind": "バインド",
Expand Down
1 change: 1 addition & 0 deletions arb/intl_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"recoveryAll": "Восстановить все данные",
"recoverySuccess": "Восстановление успешно",
"backupSuccess": "Резервное копирование успешно",
"copied": "Скопировано",
"noInfo": "Нет информации",
"pleaseBindWebDAV": "Пожалуйста, привяжите WebDAV",
"bind": "Привязать",
Expand Down
1 change: 1 addition & 0 deletions arb/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"recoveryAll": "恢复所有数据",
"recoverySuccess": "恢复成功",
"backupSuccess": "备份成功",
"copied": "已复制",
"noInfo": "暂无信息",
"pleaseBindWebDAV": "请绑定WebDAV",
"bind": "绑定",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Sync data via WebDAV or file",
),
"backupSuccess": MessageLookupByLibrary.simpleMessage("Backup success"),
"copied": MessageLookupByLibrary.simpleMessage("Copied"),
"basicConfig": MessageLookupByLibrary.simpleMessage("Basic configuration"),
"basicConfigDesc": MessageLookupByLibrary.simpleMessage(
"Modify the basic configuration globally",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/intl/messages_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class MessageLookup extends MessageLookupByLibrary {
"WebDAVまたはファイルでデータを同期",
),
"backupSuccess": MessageLookupByLibrary.simpleMessage("バックアップ成功"),
"copied": MessageLookupByLibrary.simpleMessage("コピーしました"),
"basicConfig": MessageLookupByLibrary.simpleMessage("基本設定"),
"basicConfigDesc": MessageLookupByLibrary.simpleMessage("基本設定をグローバルに変更"),
"bind": MessageLookupByLibrary.simpleMessage("バインド"),
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/intl/messages_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class MessageLookup extends MessageLookupByLibrary {
"backupSuccess": MessageLookupByLibrary.simpleMessage(
"Резервное копирование успешно",
),
"copied": MessageLookupByLibrary.simpleMessage("Скопировано"),
"basicConfig": MessageLookupByLibrary.simpleMessage("Базовая конфигурация"),
"basicConfigDesc": MessageLookupByLibrary.simpleMessage(
"Глобальное изменение базовых настроек",
Expand Down
3 changes: 1 addition & 2 deletions lib/l10n/intl/messages_zh_CN.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ class MessageLookup extends MessageLookupByLibrary {
"backupAndRecoveryDesc": MessageLookupByLibrary.simpleMessage(
"通过WebDAV或者文件同步数据",
),
"backupSuccess": MessageLookupByLibrary.simpleMessage("备份成功"),
"basicConfig": MessageLookupByLibrary.simpleMessage("基本配置"),
"backupSuccess": MessageLookupByLibrary.simpleMessage("备份成功"), "copied": MessageLookupByLibrary.simpleMessage("已复制"), "basicConfig": MessageLookupByLibrary.simpleMessage("基本配置"),
"basicConfigDesc": MessageLookupByLibrary.simpleMessage("全局修改基本配置"),
"bind": MessageLookupByLibrary.simpleMessage("绑定"),
"blacklistMode": MessageLookupByLibrary.simpleMessage("黑名单模式"),
Expand Down
10 changes: 10 additions & 0 deletions lib/l10n/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 50 additions & 27 deletions lib/views/dashboard/widgets/intranet_ip.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/providers/app.dart';
import 'package:fl_clash/providers/config.dart';
import 'package:fl_clash/state.dart';
import 'package:fl_clash/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class IntranetIP extends StatelessWidget {
class IntranetIP extends ConsumerWidget {
const IntranetIP({super.key});

@override
Widget build(BuildContext context) {
Widget build(BuildContext context, WidgetRef ref) {
final localIp = ref.watch(localIpProvider);
final mixedPort = ref.watch(
patchClashConfigProvider.select((state) => state.mixedPort),
);

return SizedBox(
height: getWidgetHeight(1),
child: CommonCard(
info: Info(label: appLocalizations.intranetIP, iconData: Icons.devices),
onPressed: () {},
onPressed: localIp != null && localIp.isNotEmpty
? () async {
final url = 'http://$localIp:$mixedPort';
await Clipboard.setData(ClipboardData(text: url));
globalState.showMessage(
title: appLocalizations.tip,
message: TextSpan(text: '${appLocalizations.copied}\n$url'),
);
}
: null,
child: Container(
padding: baseInfoEdgeInsets.copyWith(top: 0),
child: Column(
Expand All @@ -23,33 +39,40 @@ class IntranetIP extends StatelessWidget {
children: [
SizedBox(
height: globalState.measure.bodyMediumHeight + 2,
child: Consumer(
builder: (_, ref, _) {
final localIp = ref.watch(localIpProvider);
return FadeThroughBox(
child: localIp != null
? TooltipText(
text: Text(
localIp.isNotEmpty
? localIp
: appLocalizations.noNetwork,
style: context.textTheme.bodyMedium?.toLight
.adjustSize(1),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
)
: Container(
padding: EdgeInsets.all(2),
child: AspectRatio(
aspectRatio: 1,
child: CircularProgressIndicator(
strokeWidth: 2,
child: FadeThroughBox(
child: localIp != null
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: TooltipText(
text: Text(
localIp.isNotEmpty
? localIp
: appLocalizations.noNetwork,
style: context.textTheme.bodyMedium?.toLight
.adjustSize(1),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
);
},
if (localIp.isNotEmpty)
Icon(
Icons.content_copy,
size: 16,
color: context.colorScheme.onSurfaceVariant
.withOpacity(0.6),
),
],
)
: Container(
padding: EdgeInsets.all(2),
child: AspectRatio(
aspectRatio: 1,
child: CircularProgressIndicator(strokeWidth: 2),
),
),
),
),
],
Expand Down