Skip to content

Commit

Permalink
feat: add recommended dictionaries button
Browse files Browse the repository at this point in the history
Signed-off-by: Mumulhl <mumulhl.666@gmail.com>
  • Loading branch information
mumu-lhl committed Aug 27, 2024
1 parent ba06e09 commit d93a561
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 6 deletions.
5 changes: 5 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"notFound": "Not found",
"notSupport": "Not support this MDX file",
"copy": "Copy",
"readLoudly": "Read Loudly"
"readLoudly": "Read Loudly",
"recommendedDictionaries": "Recommmended Dictionaries"
}
3 changes: 2 additions & 1 deletion lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
"copy": "复制",
"@copy": {},
"readLoudly": "朗读",
"@readLoudly": {}
"@readLoudly": {},
"recommendedDictionaries": "推荐词典"
}
3 changes: 2 additions & 1 deletion lib/l10n/app_zh_HK.arb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
"copy": "複製",
"@copy": {},
"readLoudly": "朗讀",
"@readLoudly": {}
"@readLoudly": {},
"recommendedDictionaries": "推薦詞典"
}
3 changes: 2 additions & 1 deletion lib/l10n/app_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
"copy": "複製",
"@copy": {},
"readLoudly": "朗讀",
"@readLoudly": {}
"@readLoudly": {},
"recommendedDictionaries": "推薦詞典"
}
17 changes: 16 additions & 1 deletion lib/screens/home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "package:flutter/material.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
import "package:go_router/go_router.dart";
import "package:url_launcher/url_launcher.dart";

import "../database.dart";
import "../main.dart";
Expand All @@ -19,7 +20,21 @@ class HomeScreen extends StatelessWidget {
final locale = AppLocalizations.of(context);

if (currentDictionaryPath == null) {
body = Center(child: Text(locale!.addDictionary));
body = Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(locale!.addDictionary),
ElevatedButton(
child: Text(locale.recommendedDictionaries),
onPressed: () async {
await launchUrl(Uri.parse(
"https://github.com/mumu-lhl/Ciyue/wiki#recommended-dictionaries"));
},
)
],
));
} else {
if (searchWord == "") {
body = Center(child: Text(locale!.startToSearch));
Expand Down
66 changes: 65 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: e35a698ac302dd68e41f73250bd9517fe3ab5fa4f18fe4647a0872db61bacbab
url: "https://pub.dev"
source: hosted
version: "6.3.10"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e
url: "https://pub.dev"
source: hosted
version: "6.3.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af
url: "https://pub.dev"
source: hosted
version: "3.2.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -1098,4 +1162,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.22.0"
flutter: ">=3.24.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies:
flutter_tts: ^4.0.2
flutter_native_splash: ^2.4.1
package_info_plus: ^8.0.2
url_launcher: ^6.3.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit d93a561

Please sign in to comment.