Skip to content

Commit 82ba680

Browse files
committed
use global context
1 parent 6f048f6 commit 82ba680

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+391
-441
lines changed

app/lib/api/file/pages/file_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class _FileSelectionListState extends ConsumerState<FileSelectionList> {
167167
ref.read(fileSelectionProvider.notifier).reset();
168168
},
169169
),
170-
title: Text("已选择{count}项".tr(context, args: {
170+
title: Text("已选择{count}项".tr(args: {
171171
"count": widget.selection.selected.length,
172172
})),
173173
trailing: Checkbox(

app/lib/api/file/pages/file_preview.dart

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ class _FilePreviewState extends ConsumerState<FilePreview> {
9999
),
100100
const SizedBox(height: 8),
101101
Text(
102-
"文件大小: {size}".tr(
103-
context,
104-
args: {"size": Util.formatSize(file.size)},
105-
),
102+
"文件大小: {size}".tr(args: {
103+
"size": Util.formatSize(file.size),
104+
}),
106105
maxLines: 1,
107106
overflow: TextOverflow.ellipsis,
108107
style: Theme.of(context).textTheme.bodySmall,
@@ -114,15 +113,15 @@ class _FilePreviewState extends ConsumerState<FilePreview> {
114113
SizedBox(
115114
width: double.infinity,
116115
child: FilledButton(
117-
child: Text('下载'.tr(context)),
116+
child: Text('下载'.tr()),
118117
onPressed: () async {
119118
await FileActionType.download.action(context, file, ref);
120119
},
121120
),
122121
),
123122
const SizedBox(height: 8),
124123
Text(
125-
"未知的文件类型,无法查看文件,请下载到本地查看".tr(context),
124+
"未知的文件类型,无法查看文件,请下载到本地查看".tr(),
126125
style: Theme.of(context).textTheme.bodySmall,
127126
),
128127
],
@@ -371,18 +370,22 @@ class _FileVideoPreviewState extends State<FileVideoPreview>
371370
overflow: TextOverflow.ellipsis,
372371
),
373372
),
374-
body: Column(
375-
children: [
376-
VideoPreview(controller: _controller),
377-
TabBar(
378-
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
379-
controller: _tabController,
380-
tabs: <Tab>[
381-
Tab(text: "简介".tr(context)),
382-
Tab(text: "播放列表".tr(context)),
383-
],
373+
body: CustomScrollView(
374+
slivers: [
375+
SliverToBoxAdapter(
376+
child: VideoPreview(controller: _controller),
377+
),
378+
SliverToBoxAdapter(
379+
child: TabBar(
380+
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
381+
controller: _tabController,
382+
tabs: <Tab>[
383+
Tab(text: "简介".tr()),
384+
Tab(text: "播放列表".tr()),
385+
],
386+
),
384387
),
385-
Expanded(
388+
SliverFillRemaining(
386389
child: Container(
387390
padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
388391
child: TabBarView(
@@ -392,7 +395,7 @@ class _FileVideoPreviewState extends State<FileVideoPreview>
392395
mainAxisSize: MainAxisSize.min,
393396
children: [
394397
ListTile(
395-
title: Text("文件名称".tr(context)),
398+
title: Text("文件名称".tr()),
396399
trailing: Text(_controller.currentSource.name),
397400
),
398401
],

app/lib/api/file/pages/file_select.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class _FileSelectState extends ConsumerState<FileSelect> {
8181
onPressed: () async {
8282
final result = await showEditingDialog(
8383
context,
84-
"新建文件夹".tr(context),
84+
"新建文件夹".tr(),
8585
);
8686
if (result != null) {
8787
FileService().mkdir(widget.path, result).then((_) {

app/lib/api/file/pages/repo_edit.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
4545
Widget build(BuildContext context) {
4646
return Scaffold(
4747
appBar: AppBar(
48-
title: _isEditing ? Text('修改存储'.tr(context)) : Text('添加存储'.tr(context)),
48+
title: _isEditing ? Text('修改存储'.tr()) : Text('添加存储'.tr()),
4949
actions: [
5050
if (_isEditing)
5151
TextButton(
52-
child: Text("删除".tr(context)),
52+
child: Text("删除".tr()),
5353
onPressed: () async {
5454
final result = await showAlertDialog<bool>(context,
55-
content: Text(("确认删除存储?".tr(context))));
55+
content: Text(("确认删除存储?".tr())));
5656
if (result != null && result) {
5757
await FileService().deleteRepo(_form.id).then((_) {
5858
ref.invalidate(repoProvider);
@@ -73,7 +73,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
7373
children: [
7474
if (!_isEditing)
7575
CustomFormField(
76-
label: "存储类型".tr(context),
76+
label: "存储类型".tr(),
7777
value: _form.driver,
7878
type: CustomFormFieldType.option,
7979
options: DriverType.values.map((v) {
@@ -90,7 +90,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
9090
},
9191
),
9292
CustomFormField(
93-
label: "存储名称".tr(context),
93+
label: "存储名称".tr(),
9494
value: _form.name,
9595
isRequired: true,
9696
onTap: (result) {
@@ -100,7 +100,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
100100
},
101101
),
102102
CustomFormField(
103-
label: "挂载目录".tr(context),
103+
label: "挂载目录".tr(),
104104
value: _form.path,
105105
onTap: (result) {
106106
setState(() {
@@ -109,7 +109,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
109109
},
110110
),
111111
ListTile(
112-
title: Text('存储状态'.tr(context)),
112+
title: Text('存储状态'.tr()),
113113
trailing: Switch(
114114
value: _form.status,
115115
onChanged: (result) {
@@ -130,7 +130,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
130130
SizedBox(
131131
width: double.infinity,
132132
child: ElevatedButton(
133-
child: Text('测试连接'.tr(context)),
133+
child: Text('测试连接'.tr()),
134134
onPressed: () async {
135135
await FileService().testRepo(_form);
136136
},
@@ -141,7 +141,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
141141
width: double.infinity,
142142
child: _isEditing
143143
? ElevatedButton(
144-
child: Text('确认修改'.tr(context)),
144+
child: Text('确认修改'.tr()),
145145
onPressed: () async {
146146
final nav = Navigator.of(context);
147147
await FileService()
@@ -156,7 +156,7 @@ class _RepoEditState extends ConsumerState<RepoEdit> {
156156
},
157157
)
158158
: ElevatedButton(
159-
child: Text('确认添加'.tr(context)),
159+
child: Text('确认添加'.tr()),
160160
onPressed: () async {
161161
final nav = Navigator.of(context);
162162
await FileService()

app/lib/api/file/pages/repo_list.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class _RepoListState extends ConsumerState<RepoList> {
2020
Widget build(BuildContext context) {
2121
return Scaffold(
2222
appBar: AppBar(
23-
title: Text('存储库'.tr(context)),
23+
title: Text('存储库'.tr()),
2424
),
2525
body: Container(
2626
margin: const EdgeInsets.fromLTRB(16, 0, 16, 0),
@@ -30,7 +30,7 @@ class _RepoListState extends ConsumerState<RepoList> {
3030
child: Column(
3131
children: [
3232
ListTile(
33-
title: Text("存储库".tr(context)),
33+
title: Text("存储库".tr()),
3434
dense: true,
3535
),
3636
CustomAsyncValue(
@@ -42,7 +42,6 @@ class _RepoListState extends ConsumerState<RepoList> {
4242
title: Text(item.name),
4343
subtitle: Text(
4444
"存储类型:{driver}".tr(
45-
context,
4645
args: {"driver": item.driver},
4746
),
4847
style: Theme.of(context).textTheme.bodySmall,
@@ -72,7 +71,7 @@ class _RepoListState extends ConsumerState<RepoList> {
7271
),
7372
ListTile(
7473
trailing: const Icon(Icons.add),
75-
title: Text("添加新存储".tr(context)),
74+
title: Text("添加新存储".tr()),
7675
onTap: () {
7776
Navigator.pushNamed(
7877
context,

app/lib/api/file/pages/setting_download.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class _FileSettingDownloadState extends ConsumerState<FileSettingDownload> {
2222
Widget build(BuildContext context) {
2323
return Scaffold(
2424
appBar: AppBar(
25-
title: Text('文件下载'.tr(context)),
25+
title: Text('文件下载'.tr()),
2626
),
2727
body: Container(
2828
margin: const EdgeInsets.fromLTRB(16, 0, 16, 0),
@@ -51,11 +51,11 @@ class _FileSettingDownloadState extends ConsumerState<FileSettingDownload> {
5151
child: Column(
5252
children: [
5353
ListTile(
54-
title: Text("文件下载".tr(context)),
54+
title: Text("文件下载".tr()),
5555
dense: true,
5656
),
5757
ListTile(
58-
title: Text('默认保存路径'.tr(context)),
58+
title: Text('默认保存路径'.tr()),
5959
subtitle: setting.downloadPath == null
6060
? FutureBuilder(
6161
future: PathUtil.getDownloadsPath(),
@@ -66,7 +66,7 @@ class _FileSettingDownloadState extends ConsumerState<FileSettingDownload> {
6666
if (snapshot.hasData) {
6767
return Text("${snapshot.data}");
6868
}
69-
return Text("加载中...".tr(context));
69+
return Text("加载中...".tr());
7070
},
7171
)
7272
: Text(setting.downloadPath!),
@@ -81,7 +81,7 @@ class _FileSettingDownloadState extends ConsumerState<FileSettingDownload> {
8181
},
8282
),
8383
ListTile(
84-
title: Text('同时下载任务数'.tr(context)),
84+
title: Text('同时下载任务数'.tr()),
8585
trailing: Wrap(
8686
crossAxisAlignment: WrapCrossAlignment.center,
8787
children: [
@@ -91,7 +91,7 @@ class _FileSettingDownloadState extends ConsumerState<FileSettingDownload> {
9191
onTap: () async {
9292
final result = await showNumberEditingDialog(
9393
context,
94-
"同时下载任务数".tr(context),
94+
"同时下载任务数".tr(),
9595
value: setting.downloadQueueSize.toString(),
9696
);
9797
if (result != null) {

0 commit comments

Comments
 (0)