From e4c6477bbad8d4b8eeb352968e633000591bebcd Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 10 May 2025 14:09:25 +0800 Subject: [PATCH] :sparkles: App settings & custom display language --- assets/i18n/en-US.json | 12 +- assets/i18n/zh-TW.json | 150 +++++++++++++++++++++ lib/main.dart | 6 +- lib/route.dart | 1 + lib/route.gr.dart | 225 +++++++++++++++++--------------- lib/screens/account.dart | 11 ++ lib/screens/explore.dart | 3 +- lib/screens/settings.dart | 69 ++++++++++ lib/widgets/post/post_item.dart | 12 +- pubspec.lock | 16 ++- pubspec.yaml | 1 + 11 files changed, 394 insertions(+), 112 deletions(-) create mode 100644 assets/i18n/zh-TW.json create mode 100644 lib/screens/settings.dart diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index b92d13e..6f7fc44 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -116,6 +116,11 @@ "checkInResultLevel2": "A Normal Day", "checkInResultLevel3": "Good Luck", "checkInResultLevel4": "Best Luck", + "checkInResultLevelShort0": "Wrost", + "checkInResultLevelShort1": "Bad", + "checkInResultLevelShort2": "Normal", + "checkInResultLevelShort3": "Good", + "checkInResultLevelShort4": "Best", "checkInActivityTitle": "{} checked in on {} and got a {}", "eventCalander": "Event Calander", "eventCalanderEmpty": "No events on that day.", @@ -141,5 +146,10 @@ "offline": "Offline", "status": "Status", "statusActivityTitle": "{} is {} {}", - "statusActivityEndedTitle": "{} is {} {} until {}" + "statusActivityEndedTitle": "{} is {} {} until {}", + "appSettings": "App Settings", + "settings": "Settings", + "language": "Language", + "settingsDisplayLanguage": "Display Language", + "languageFollowSystem": "Follow System" } diff --git a/assets/i18n/zh-TW.json b/assets/i18n/zh-TW.json new file mode 100644 index 0000000..4357104 --- /dev/null +++ b/assets/i18n/zh-TW.json @@ -0,0 +1,150 @@ +{ + "login": "登入", + "forgotPassword": "忘記密碼", + "loginPickFactor": "選擇驗證方式", + "loginMultiFactor": { + "one": "剩餘 {} 步驟", + "other": "剩餘 {} 步驟" + }, + "loginEnterPassword": "輸入驗證碼", + "loginSuccess": "已登入為 {}", + "loginGreeting": "歡迎回來!", + "username": "使用者名稱", + "usernameCannotChangeHint": "使用者名稱建立後無法更改。", + "usernameLookupHint": "我們也接受您的電子郵件地址。", + "unknown": "未知", + "termAcceptNextWithAgree": "繼續即表示您同意我們的服務條款及其他條款與條件。", + "termAcceptLink": "查看詳情", + "loginResetPasswordHint": "請提供您的使用者名稱以接收重設密碼連結。", + "password": "密碼", + "next": "下一步", + "createAccount": "建立帳號", + "nickname": "暱稱", + "email": "電子郵件", + "bio": "個人簡介", + "fieldCannotBeEmpty": "此欄位不得為空。", + "fieldEmailAddressMustBeValid": "電子郵件地址必須有效。", + "logout": "登出", + "updateYourProfile": "編輯個人資料", + "accountBasicInfo": "基本資訊", + "accountProfile": "您的個人資料", + "saveChanges": "儲存變更", + "publishers": "發布者", + "managedPublisher": "管理的發布者", + "createPublisher": "建立發布者", + "createPublisherHint": "用於創建貼文、合輯等。", + "editPublisher": "編輯發布者", + "syncPublisher": "使用帳號資料", + "create": "建立", + "update": "更新", + "edit": "編輯", + "delete": "刪除", + "deletePublisher": "刪除發布者 {}", + "deletePublisherHint": "您確定要刪除此發布者嗎?這也會刪除此發布者下的所有貼文和合輯。", + "somethingWentWrong": "發生了一些錯誤...", + "deletePost": "刪除貼文", + "deletePostHint": "您確定要刪除此貼文嗎?", + "copyLink": "複製連結", + "postCreateAccountTitle": "感謝您的加入!", + "postCreateAccountNext": "下一步是什麼?", + "postCreateAccountNext1": "前往您的電子郵件收件匣並接收帳號啟用郵件。", + "postCreateAccountNext2": "登入您的帳號並開始探索 Solar Network!", + "postPlaceholder": "您在想些什麼?", + "publishersEmpty": "尚無發布者", + "publishersEmptyDescription": "您需要建立一個發布者才能開始發布您的貼文。", + "authFactorPassword": "密碼", + "authFactorPasswordDescription": "您註冊時設定的密碼。", + "authFactorEmail": "電子郵件驗證碼", + "authFactorEmailDescription": "發送到您註冊時設定的電子郵件地址的一次性驗證碼。", + "authFactorTOTP": "時間戳記一次性密碼 (TOTP)", + "authFactorTOTPDescription": "由 TOTP 驗證器(例如 Google Authenticator 或 Authy)產生的一次性驗證碼。", + "authFactorInAppNotify": "應用程式內通知", + "authFactorInAppNotifyDescription": "透過應用程式內通知發送的一次性驗證碼。", + "realms": "領域", + "createRealm": "建立領域", + "createRealmHint": "結識有相同興趣的朋友、建立社群等等。", + "editRealm": "編輯領域", + "deleteRealm": "刪除領域", + "deleteRealmHint": "您確定要刪除此領域嗎?這也會刪除此領域下的所有頻道、發布者和貼文。", + "explore": "探索", + "account": "帳號", + "name": "名稱", + "description": "描述", + "slug": "網址別名", + "slugHint": "網址別名將用於存取此資源的 URL,應為唯一且符合 URL 安全規範。", + "createChatRoom": "建立聊天室", + "editChatRoom": "編輯聊天室", + "deleteChatRoom": "刪除聊天室", + "deleteChatRoomHint": "您確定要刪除此聊天室嗎?此操作無法復原。", + "chat": "聊天", + "chatMessageHint": "在 {} 中傳送訊息", + "chatDirectMessageHint": "傳送訊息給 {}", + "loading": "載入中...", + "descriptionNone": "尚無描述。", + "invites": "邀請", + "invitesEmpty": "尚無邀請,真是寂寞...", + "members": { + "one": "{} 位成員", + "other": "{} 位成員" + }, + "permissionOwner": "擁有者", + "permissionModerator": "版主", + "permissionMember": "成員", + "reply": "回覆", + "forward": "轉寄", + "edited": "已編輯", + "addVideo": "新增影片", + "addPhoto": "新增照片", + "createDirectMessage": "新增私訊", + "react": "表情符號", + "reactions": { + "zero": "表情符號", + "one": "{} 個表情符號", + "other": "{} 個表情符號" + }, + "reactionPositive": "正面", + "reactionNegative": "負面", + "reactionNeutral": "中性", + "connectionConnected": "已連線", + "connectionDisconnected": "已斷線", + "connectionReconnecting": "重新連線中", + "checkIn": "簽到", + "checkInNone": "尚未簽到", + "checkInNoneHint": "透過簽到獲取今日運勢提醒和每日獎勵。", + "checkInResultLevel0": "運勢最差", + "checkInResultLevel1": "運勢不佳", + "checkInResultLevel2": "普通的一天", + "checkInResultLevel3": "運勢不錯", + "checkInResultLevel4": "運勢極佳", + "checkInResultLevelShort0": "大兇", + "checkInResultLevelShort1": "兇", + "checkInResultLevelShort2": "中平", + "checkInResultLevelShort3": "吉", + "checkInResultLevelShort4": "大吉", + "checkInActivityTitle": "{} 在 {} 簽到並獲得了 {}", + "eventCalander": "活動日曆", + "eventCalanderEmpty": "當天沒有活動。", + "creatorHub": "創作者中心", + "creatorHubDescription": "管理貼文、數據分析等。", + "developerPortal": "開發者平台", + "developerPortalDescription": "使用 Solar Network™ 進行開發。", + "statusCreateHint": "您在想些什麼?新增一個狀態。", + "statusCreate": "新增狀態", + "statusUpdate": "更新狀態", + "statusLabel": "狀態", + "statusAttitude": "心情", + "attitudePositive": "正面", + "attitudeNeutral": "中性", + "attitudeNegative": "負面", + "statusInvisible": "隱形", + "statusInvisibleDescription": "您將對其他人顯示為離線。", + "statusNotDisturb": "請勿打擾", + "statusNotDisturbDescription": "推播通知將被禁用。", + "statusClearTime": "已清除於", + "statusNoAutoClear": "不要自動清除", + "online": "在線", + "offline": "離線", + "status": "狀態", + "statusActivityTitle": "{} {} {}", + "statusActivityEndedTitle": "{} 在 {} 於 {} 直到 {}" + } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 0860137..bff6cca 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -54,7 +54,11 @@ void main() async { child: Directionality( textDirection: TextDirection.ltr, child: EasyLocalization( - supportedLocales: [Locale('en', 'US')], + supportedLocales: [ + Locale('en', 'US'), + Locale('zh', 'CN'), + Locale('zh', 'TW'), + ], path: 'assets/i18n', fallbackLocale: Locale('en', 'US'), useFallbackTranslations: true, diff --git a/lib/route.dart b/lib/route.dart index 1d268d0..e630d9f 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -19,6 +19,7 @@ class AppRouter extends RootStackRouter { AutoRoute(page: ChatListRoute.page, path: 'chat'), ], ), + AutoRoute(page: SettingsRoute.page, path: '/settings'), AutoRoute(page: LoginRoute.page, path: '/auth/login'), AutoRoute(page: CreateAccountRoute.page, path: '/auth/create-account'), AutoRoute(page: MyselfProfileRoute.page, path: '/account/me'), diff --git a/lib/route.gr.dart b/lib/route.gr.dart index 324ee94..c1f884c 100644 --- a/lib/route.gr.dart +++ b/lib/route.gr.dart @@ -9,18 +9,18 @@ // coverage:ignore-file // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'package:auto_route/auto_route.dart' as _i18; -import 'package:flutter/material.dart' as _i19; -import 'package:island/models/post.dart' as _i20; +import 'package:auto_route/auto_route.dart' as _i19; +import 'package:flutter/material.dart' as _i20; +import 'package:island/models/post.dart' as _i21; import 'package:island/screens/account.dart' as _i2; import 'package:island/screens/account/me.dart' as _i12; import 'package:island/screens/account/me/event_calendar.dart' as _i11; import 'package:island/screens/account/me/publishers.dart' as _i7; -import 'package:island/screens/account/me/update.dart' as _i17; +import 'package:island/screens/account/me/update.dart' as _i18; import 'package:island/screens/account/profile.dart' as _i1; import 'package:island/screens/auth/create_account.dart' as _i6; import 'package:island/screens/auth/login.dart' as _i10; -import 'package:island/screens/auth/tabs.dart' as _i16; +import 'package:island/screens/auth/tabs.dart' as _i17; import 'package:island/screens/chat/chat.dart' as _i4; import 'package:island/screens/chat/room.dart' as _i5; import 'package:island/screens/chat/room_detail.dart' as _i3; @@ -29,14 +29,15 @@ import 'package:island/screens/posts/compose.dart' as _i13; import 'package:island/screens/posts/detail.dart' as _i14; import 'package:island/screens/realm/detail.dart' as _i15; import 'package:island/screens/realm/realms.dart' as _i8; +import 'package:island/screens/settings.dart' as _i16; /// generated route for /// [_i1.AccountProfileScreen] -class AccountProfileRoute extends _i18.PageRouteInfo { +class AccountProfileRoute extends _i19.PageRouteInfo { AccountProfileRoute({ - _i19.Key? key, + _i20.Key? key, required String name, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( AccountProfileRoute.name, args: AccountProfileRouteArgs(key: key, name: name), @@ -46,7 +47,7 @@ class AccountProfileRoute extends _i18.PageRouteInfo { static const String name = 'AccountProfileRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -62,7 +63,7 @@ class AccountProfileRoute extends _i18.PageRouteInfo { class AccountProfileRouteArgs { const AccountProfileRouteArgs({this.key, required this.name}); - final _i19.Key? key; + final _i20.Key? key; final String name; @@ -74,13 +75,13 @@ class AccountProfileRouteArgs { /// generated route for /// [_i2.AccountScreen] -class AccountRoute extends _i18.PageRouteInfo { - const AccountRoute({List<_i18.PageRouteInfo>? children}) +class AccountRoute extends _i19.PageRouteInfo { + const AccountRoute({List<_i19.PageRouteInfo>? children}) : super(AccountRoute.name, initialChildren: children); static const String name = 'AccountRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i2.AccountScreen(); @@ -90,11 +91,11 @@ class AccountRoute extends _i18.PageRouteInfo { /// generated route for /// [_i3.ChatDetailScreen] -class ChatDetailRoute extends _i18.PageRouteInfo { +class ChatDetailRoute extends _i19.PageRouteInfo { ChatDetailRoute({ - _i19.Key? key, + _i20.Key? key, required int id, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( ChatDetailRoute.name, args: ChatDetailRouteArgs(key: key, id: id), @@ -104,7 +105,7 @@ class ChatDetailRoute extends _i18.PageRouteInfo { static const String name = 'ChatDetailRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -119,7 +120,7 @@ class ChatDetailRoute extends _i18.PageRouteInfo { class ChatDetailRouteArgs { const ChatDetailRouteArgs({this.key, required this.id}); - final _i19.Key? key; + final _i20.Key? key; final int id; @@ -131,13 +132,13 @@ class ChatDetailRouteArgs { /// generated route for /// [_i4.ChatListScreen] -class ChatListRoute extends _i18.PageRouteInfo { - const ChatListRoute({List<_i18.PageRouteInfo>? children}) +class ChatListRoute extends _i19.PageRouteInfo { + const ChatListRoute({List<_i19.PageRouteInfo>? children}) : super(ChatListRoute.name, initialChildren: children); static const String name = 'ChatListRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i4.ChatListScreen(); @@ -147,11 +148,11 @@ class ChatListRoute extends _i18.PageRouteInfo { /// generated route for /// [_i5.ChatRoomScreen] -class ChatRoomRoute extends _i18.PageRouteInfo { +class ChatRoomRoute extends _i19.PageRouteInfo { ChatRoomRoute({ - _i19.Key? key, + _i20.Key? key, required int id, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( ChatRoomRoute.name, args: ChatRoomRouteArgs(key: key, id: id), @@ -161,7 +162,7 @@ class ChatRoomRoute extends _i18.PageRouteInfo { static const String name = 'ChatRoomRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -176,7 +177,7 @@ class ChatRoomRoute extends _i18.PageRouteInfo { class ChatRoomRouteArgs { const ChatRoomRouteArgs({this.key, required this.id}); - final _i19.Key? key; + final _i20.Key? key; final int id; @@ -188,13 +189,13 @@ class ChatRoomRouteArgs { /// generated route for /// [_i6.CreateAccountScreen] -class CreateAccountRoute extends _i18.PageRouteInfo { - const CreateAccountRoute({List<_i18.PageRouteInfo>? children}) +class CreateAccountRoute extends _i19.PageRouteInfo { + const CreateAccountRoute({List<_i19.PageRouteInfo>? children}) : super(CreateAccountRoute.name, initialChildren: children); static const String name = 'CreateAccountRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i6.CreateAccountScreen(); @@ -204,8 +205,8 @@ class CreateAccountRoute extends _i18.PageRouteInfo { /// generated route for /// [_i4.EditChatScreen] -class EditChatRoute extends _i18.PageRouteInfo { - EditChatRoute({_i19.Key? key, int? id, List<_i18.PageRouteInfo>? children}) +class EditChatRoute extends _i19.PageRouteInfo { + EditChatRoute({_i20.Key? key, int? id, List<_i19.PageRouteInfo>? children}) : super( EditChatRoute.name, args: EditChatRouteArgs(key: key, id: id), @@ -215,7 +216,7 @@ class EditChatRoute extends _i18.PageRouteInfo { static const String name = 'EditChatRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -230,7 +231,7 @@ class EditChatRoute extends _i18.PageRouteInfo { class EditChatRouteArgs { const EditChatRouteArgs({this.key, this.id}); - final _i19.Key? key; + final _i20.Key? key; final int? id; @@ -242,11 +243,11 @@ class EditChatRouteArgs { /// generated route for /// [_i7.EditPublisherScreen] -class EditPublisherRoute extends _i18.PageRouteInfo { +class EditPublisherRoute extends _i19.PageRouteInfo { EditPublisherRoute({ - _i19.Key? key, + _i20.Key? key, String? name, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( EditPublisherRoute.name, args: EditPublisherRouteArgs(key: key, name: name), @@ -256,7 +257,7 @@ class EditPublisherRoute extends _i18.PageRouteInfo { static const String name = 'EditPublisherRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -271,7 +272,7 @@ class EditPublisherRoute extends _i18.PageRouteInfo { class EditPublisherRouteArgs { const EditPublisherRouteArgs({this.key, this.name}); - final _i19.Key? key; + final _i20.Key? key; final String? name; @@ -283,11 +284,11 @@ class EditPublisherRouteArgs { /// generated route for /// [_i8.EditRealmScreen] -class EditRealmRoute extends _i18.PageRouteInfo { +class EditRealmRoute extends _i19.PageRouteInfo { EditRealmRoute({ - _i19.Key? key, + _i20.Key? key, String? slug, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( EditRealmRoute.name, args: EditRealmRouteArgs(key: key, slug: slug), @@ -297,7 +298,7 @@ class EditRealmRoute extends _i18.PageRouteInfo { static const String name = 'EditRealmRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -312,7 +313,7 @@ class EditRealmRoute extends _i18.PageRouteInfo { class EditRealmRouteArgs { const EditRealmRouteArgs({this.key, this.slug}); - final _i19.Key? key; + final _i20.Key? key; final String? slug; @@ -324,13 +325,13 @@ class EditRealmRouteArgs { /// generated route for /// [_i9.ExploreScreen] -class ExploreRoute extends _i18.PageRouteInfo { - const ExploreRoute({List<_i18.PageRouteInfo>? children}) +class ExploreRoute extends _i19.PageRouteInfo { + const ExploreRoute({List<_i19.PageRouteInfo>? children}) : super(ExploreRoute.name, initialChildren: children); static const String name = 'ExploreRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i9.ExploreScreen(); @@ -340,13 +341,13 @@ class ExploreRoute extends _i18.PageRouteInfo { /// generated route for /// [_i10.LoginScreen] -class LoginRoute extends _i18.PageRouteInfo { - const LoginRoute({List<_i18.PageRouteInfo>? children}) +class LoginRoute extends _i19.PageRouteInfo { + const LoginRoute({List<_i19.PageRouteInfo>? children}) : super(LoginRoute.name, initialChildren: children); static const String name = 'LoginRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i10.LoginScreen(); @@ -356,13 +357,13 @@ class LoginRoute extends _i18.PageRouteInfo { /// generated route for /// [_i7.ManagedPublisherScreen] -class ManagedPublisherRoute extends _i18.PageRouteInfo { - const ManagedPublisherRoute({List<_i18.PageRouteInfo>? children}) +class ManagedPublisherRoute extends _i19.PageRouteInfo { + const ManagedPublisherRoute({List<_i19.PageRouteInfo>? children}) : super(ManagedPublisherRoute.name, initialChildren: children); static const String name = 'ManagedPublisherRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i7.ManagedPublisherScreen(); @@ -372,13 +373,13 @@ class ManagedPublisherRoute extends _i18.PageRouteInfo { /// generated route for /// [_i11.MyselfEventCalendarScreen] -class MyselfEventCalendarRoute extends _i18.PageRouteInfo { - const MyselfEventCalendarRoute({List<_i18.PageRouteInfo>? children}) +class MyselfEventCalendarRoute extends _i19.PageRouteInfo { + const MyselfEventCalendarRoute({List<_i19.PageRouteInfo>? children}) : super(MyselfEventCalendarRoute.name, initialChildren: children); static const String name = 'MyselfEventCalendarRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i11.MyselfEventCalendarScreen(); @@ -388,13 +389,13 @@ class MyselfEventCalendarRoute extends _i18.PageRouteInfo { /// generated route for /// [_i12.MyselfProfileScreen] -class MyselfProfileRoute extends _i18.PageRouteInfo { - const MyselfProfileRoute({List<_i18.PageRouteInfo>? children}) +class MyselfProfileRoute extends _i19.PageRouteInfo { + const MyselfProfileRoute({List<_i19.PageRouteInfo>? children}) : super(MyselfProfileRoute.name, initialChildren: children); static const String name = 'MyselfProfileRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i12.MyselfProfileScreen(); @@ -404,13 +405,13 @@ class MyselfProfileRoute extends _i18.PageRouteInfo { /// generated route for /// [_i4.NewChatScreen] -class NewChatRoute extends _i18.PageRouteInfo { - const NewChatRoute({List<_i18.PageRouteInfo>? children}) +class NewChatRoute extends _i19.PageRouteInfo { + const NewChatRoute({List<_i19.PageRouteInfo>? children}) : super(NewChatRoute.name, initialChildren: children); static const String name = 'NewChatRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i4.NewChatScreen(); @@ -420,13 +421,13 @@ class NewChatRoute extends _i18.PageRouteInfo { /// generated route for /// [_i7.NewPublisherScreen] -class NewPublisherRoute extends _i18.PageRouteInfo { - const NewPublisherRoute({List<_i18.PageRouteInfo>? children}) +class NewPublisherRoute extends _i19.PageRouteInfo { + const NewPublisherRoute({List<_i19.PageRouteInfo>? children}) : super(NewPublisherRoute.name, initialChildren: children); static const String name = 'NewPublisherRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i7.NewPublisherScreen(); @@ -436,13 +437,13 @@ class NewPublisherRoute extends _i18.PageRouteInfo { /// generated route for /// [_i8.NewRealmScreen] -class NewRealmRoute extends _i18.PageRouteInfo { - const NewRealmRoute({List<_i18.PageRouteInfo>? children}) +class NewRealmRoute extends _i19.PageRouteInfo { + const NewRealmRoute({List<_i19.PageRouteInfo>? children}) : super(NewRealmRoute.name, initialChildren: children); static const String name = 'NewRealmRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i8.NewRealmScreen(); @@ -452,11 +453,11 @@ class NewRealmRoute extends _i18.PageRouteInfo { /// generated route for /// [_i13.PostComposeScreen] -class PostComposeRoute extends _i18.PageRouteInfo { +class PostComposeRoute extends _i19.PageRouteInfo { PostComposeRoute({ - _i19.Key? key, - _i20.SnPost? originalPost, - List<_i18.PageRouteInfo>? children, + _i20.Key? key, + _i21.SnPost? originalPost, + List<_i19.PageRouteInfo>? children, }) : super( PostComposeRoute.name, args: PostComposeRouteArgs(key: key, originalPost: originalPost), @@ -465,7 +466,7 @@ class PostComposeRoute extends _i18.PageRouteInfo { static const String name = 'PostComposeRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final args = data.argsAs( @@ -482,9 +483,9 @@ class PostComposeRoute extends _i18.PageRouteInfo { class PostComposeRouteArgs { const PostComposeRouteArgs({this.key, this.originalPost}); - final _i19.Key? key; + final _i20.Key? key; - final _i20.SnPost? originalPost; + final _i21.SnPost? originalPost; @override String toString() { @@ -494,11 +495,11 @@ class PostComposeRouteArgs { /// generated route for /// [_i14.PostDetailScreen] -class PostDetailRoute extends _i18.PageRouteInfo { +class PostDetailRoute extends _i19.PageRouteInfo { PostDetailRoute({ - _i19.Key? key, + _i20.Key? key, required int id, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( PostDetailRoute.name, args: PostDetailRouteArgs(key: key, id: id), @@ -508,7 +509,7 @@ class PostDetailRoute extends _i18.PageRouteInfo { static const String name = 'PostDetailRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -523,7 +524,7 @@ class PostDetailRoute extends _i18.PageRouteInfo { class PostDetailRouteArgs { const PostDetailRouteArgs({this.key, required this.id}); - final _i19.Key? key; + final _i20.Key? key; final int id; @@ -535,11 +536,11 @@ class PostDetailRouteArgs { /// generated route for /// [_i13.PostEditScreen] -class PostEditRoute extends _i18.PageRouteInfo { +class PostEditRoute extends _i19.PageRouteInfo { PostEditRoute({ - _i19.Key? key, + _i20.Key? key, required int id, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( PostEditRoute.name, args: PostEditRouteArgs(key: key, id: id), @@ -549,7 +550,7 @@ class PostEditRoute extends _i18.PageRouteInfo { static const String name = 'PostEditRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -564,7 +565,7 @@ class PostEditRoute extends _i18.PageRouteInfo { class PostEditRouteArgs { const PostEditRouteArgs({this.key, required this.id}); - final _i19.Key? key; + final _i20.Key? key; final int id; @@ -576,11 +577,11 @@ class PostEditRouteArgs { /// generated route for /// [_i15.RealmDetailScreen] -class RealmDetailRoute extends _i18.PageRouteInfo { +class RealmDetailRoute extends _i19.PageRouteInfo { RealmDetailRoute({ - _i19.Key? key, + _i20.Key? key, required String slug, - List<_i18.PageRouteInfo>? children, + List<_i19.PageRouteInfo>? children, }) : super( RealmDetailRoute.name, args: RealmDetailRouteArgs(key: key, slug: slug), @@ -590,7 +591,7 @@ class RealmDetailRoute extends _i18.PageRouteInfo { static const String name = 'RealmDetailRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -605,7 +606,7 @@ class RealmDetailRoute extends _i18.PageRouteInfo { class RealmDetailRouteArgs { const RealmDetailRouteArgs({this.key, required this.slug}); - final _i19.Key? key; + final _i20.Key? key; final String slug; @@ -617,13 +618,13 @@ class RealmDetailRouteArgs { /// generated route for /// [_i8.RealmListScreen] -class RealmListRoute extends _i18.PageRouteInfo { - const RealmListRoute({List<_i18.PageRouteInfo>? children}) +class RealmListRoute extends _i19.PageRouteInfo { + const RealmListRoute({List<_i19.PageRouteInfo>? children}) : super(RealmListRoute.name, initialChildren: children); static const String name = 'RealmListRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { return const _i8.RealmListScreen(); @@ -632,33 +633,49 @@ class RealmListRoute extends _i18.PageRouteInfo { } /// generated route for -/// [_i16.TabsScreen] -class TabsRoute extends _i18.PageRouteInfo { - const TabsRoute({List<_i18.PageRouteInfo>? children}) - : super(TabsRoute.name, initialChildren: children); +/// [_i16.SettingsScreen] +class SettingsRoute extends _i19.PageRouteInfo { + const SettingsRoute({List<_i19.PageRouteInfo>? children}) + : super(SettingsRoute.name, initialChildren: children); - static const String name = 'TabsRoute'; + static const String name = 'SettingsRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { - return const _i16.TabsScreen(); + return const _i16.SettingsScreen(); }, ); } /// generated route for -/// [_i17.UpdateProfileScreen] -class UpdateProfileRoute extends _i18.PageRouteInfo { - const UpdateProfileRoute({List<_i18.PageRouteInfo>? children}) +/// [_i17.TabsScreen] +class TabsRoute extends _i19.PageRouteInfo { + const TabsRoute({List<_i19.PageRouteInfo>? children}) + : super(TabsRoute.name, initialChildren: children); + + static const String name = 'TabsRoute'; + + static _i19.PageInfo page = _i19.PageInfo( + name, + builder: (data) { + return const _i17.TabsScreen(); + }, + ); +} + +/// generated route for +/// [_i18.UpdateProfileScreen] +class UpdateProfileRoute extends _i19.PageRouteInfo { + const UpdateProfileRoute({List<_i19.PageRouteInfo>? children}) : super(UpdateProfileRoute.name, initialChildren: children); static const String name = 'UpdateProfileRoute'; - static _i18.PageInfo page = _i18.PageInfo( + static _i19.PageInfo page = _i19.PageInfo( name, builder: (data) { - return const _i17.UpdateProfileScreen(); + return const _i18.UpdateProfileScreen(); }, ); } diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 23bb6b2..96b56e1 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -145,6 +145,17 @@ class AccountScreen extends HookConsumerWidget { context.router.push(UpdateProfileRoute()); }, ), + const Divider(height: 1).padding(vertical: 8), + ListTile( + minTileHeight: 48, + leading: const Icon(Symbols.settings), + trailing: const Icon(Symbols.chevron_right), + contentPadding: EdgeInsets.symmetric(horizontal: 24), + title: Text('appSettings').tr(), + onTap: () { + context.router.push(SettingsRoute()); + }, + ), if (kDebugMode) const Divider(height: 1).padding(vertical: 8), if (kDebugMode) ListTile( diff --git a/lib/screens/explore.dart b/lib/screens/explore.dart index d591236..759af57 100644 --- a/lib/screens/explore.dart +++ b/lib/screens/explore.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:gap/gap.dart'; @@ -26,7 +27,7 @@ class ExploreScreen extends ConsumerWidget { final postsNotifier = ref.watch(activityListProvider.notifier); return AppScaffold( - appBar: AppBar(title: const Text('Explore')), + appBar: AppBar(title: const Text('explore').tr()), floatingActionButton: FloatingActionButton( heroTag: Key("explore-page-fab"), onPressed: () { diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart new file mode 100644 index 0000000..d222bc2 --- /dev/null +++ b/lib/screens/settings.dart @@ -0,0 +1,69 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:collection/collection.dart'; +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:island/widgets/app_scaffold.dart'; +import 'package:material_symbols_icons/symbols.dart'; +import 'package:styled_widget/styled_widget.dart'; + +@RoutePage() +class SettingsScreen extends HookConsumerWidget { + const SettingsScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return AppScaffold( + appBar: AppBar(title: const Text('Settings')), + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + minLeadingWidth: 48, + title: Text('settingsDisplayLanguage').tr(), + contentPadding: const EdgeInsets.only(left: 24, right: 17), + leading: const Icon(Symbols.translate), + trailing: DropdownButtonHideUnderline( + child: DropdownButton2( + isExpanded: true, + items: [ + ...EasyLocalization.of( + context, + )!.supportedLocales.mapIndexed((idx, ele) { + return DropdownMenuItem( + value: ele, + child: Text( + '${ele.languageCode}-${ele.countryCode}', + ).fontSize(14), + ); + }), + DropdownMenuItem( + value: null, + child: Text('languageFollowSystem').tr().fontSize(14), + ), + ], + value: EasyLocalization.of(context)!.currentLocale, + onChanged: (Locale? value) { + if (value != null) { + EasyLocalization.of(context)!.setLocale(value); + } else { + EasyLocalization.of(context)!.resetLocale(); + } + }, + buttonStyleData: const ButtonStyleData( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 5), + height: 40, + width: 160, + ), + menuItemStyleData: const MenuItemStyleData(height: 40), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 1f845ca..3d65f85 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -127,7 +127,17 @@ class PostItem extends HookConsumerWidget { ], ), if (item.attachments.isNotEmpty) - CloudFileList(files: item.attachments), + Container( + margin: EdgeInsets.only(left: 48), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Theme.of(context).dividerColor, + width: 1, + ), + ), + child: CloudFileList(files: item.attachments), + ), PostReactionList( parentId: item.id, reactions: item.reactionsCount, diff --git a/pubspec.lock b/pubspec.lock index 207a3d2..28dc1ac 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -441,6 +441,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.4" + dropdown_button2: + dependency: "direct main" + description: + name: dropdown_button2 + sha256: b0fe8d49a030315e9eef6c7ac84ca964250155a6224d491c1365061bc974a9e1 + url: "https://pub.dev" + source: hosted + version: "2.3.9" easy_localization: dependency: "direct main" description: @@ -509,10 +517,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "978be1f602e0695daef8e345a3c597abf72b0c0ca6102fa2665eb549f5406a17" + sha256: a222f231db4f822fc49e3b753674bda630e981873c84bf8604bceeb77fce0b24 url: "https://pub.dev" source: hosted - version: "10.1.5" + version: "10.1.7" file_selector_linux: dependency: transitive description: @@ -2015,10 +2023,10 @@ packages: dependency: transitive description: name: win32 - sha256: dc6ecaa00a7c708e5b4d10ee7bec8c270e9276dfcab1783f57e9962d7884305f + sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" url: "https://pub.dev" source: hosted - version: "5.12.0" + version: "5.13.0" win32_registry: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 411a6c7..44ecf6b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -94,6 +94,7 @@ dependencies: tencent_rtc_sdk: ^12.3.6 table_calendar: ^3.1.3 relative_time: ^5.0.0 + dropdown_button2: ^2.3.9 dev_dependencies: flutter_test: