diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b7752a2..0f354c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,6 +26,9 @@ jobs: echo "$CERTIFICATE" | base64 --decode > signing_certificate.p12 security import signing_certificate.p12 -k ~/Library/Keychains/login.keychain -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign + - name: Check rust-toolchain.toml + run: rustup show + # Step 2: Build the Flutter macOS app - name: Build Flutter macOS App run: flutter build macos --release @@ -97,10 +100,8 @@ jobs: with: distribution: 'oracle' java-version: '17' - - name: Setup Rust - run: | - rustup update - rustup default stable + - name: Check rust-toolchain.toml + run: rustup show - run: flutter pub get - run: flutter build apk --release - uses: actions/upload-artifact@v4 diff --git a/assets/translation.json b/assets/translation.json index e472a5b..add7a5a 100644 --- a/assets/translation.json +++ b/assets/translation.json @@ -358,7 +358,7 @@ "Once the operation is successful, app will automatically sync data with the server.": "操作成功后, APP将自动与服务器同步数据", "Cache cleared": "缓存已清除", "Disabled": "已禁用", - "WebDAV Auto Sync": "WebDAV 自动同步", + "Auto Sync Data": "自动同步数据", "Mark all as read": "全部标记为已读", "Do you want to mark all as read?" : "您要全部标记为已读吗?", "Swipe down for previous chapter": "向下滑动查看上一章", @@ -377,7 +377,8 @@ "Jump to page": "跳转到页面", "Page": "页面", "Jump": "跳转", - "Copy Image": "复制图片" + "Copy Image": "复制图片", + "A valid WebDav directory URL": "有效的WebDav目录URL" }, "zh_TW": { "Home": "首頁", @@ -738,7 +739,7 @@ "Once the operation is successful, app will automatically sync data with the server.": "操作成功後, APP將自動與伺服器同步資料", "Cache cleared": "快取已清除", "Disabled": "已停用", - "WebDAV Auto Sync": "WebDAV 自動同步", + "Auto Sync Data": "自動同步資料", "Mark all as read": "全部標記為已讀", "Do you want to mark all as read?" : "您要全部標記為已讀嗎?", "Swipe down for previous chapter": "向下滑動查看上一章", @@ -757,6 +758,7 @@ "Jump to page": "跳轉到頁面", "Page": "頁面", "Jump": "跳轉", - "Copy Image": "複製圖片" + "Copy Image": "複製圖片", + "A valid WebDav directory URL": "有效的WebDav目錄URL" } } diff --git a/lib/components/window_frame.dart b/lib/components/window_frame.dart index c716d18..75c6f5b 100644 --- a/lib/components/window_frame.dart +++ b/lib/components/window_frame.dart @@ -150,9 +150,10 @@ class _WindowFrameState extends State { onPressed: debug, child: Text('Debug'), ), - if (!App.isMacOS) _WindowButtons( - onClose: _onClose, - ) + if (!App.isMacOS) + _WindowButtons( + onClose: _onClose, + ) ], ), ); @@ -562,31 +563,31 @@ class _VirtualWindowFrameState extends State } Widget _buildVirtualWindowFrame(BuildContext context) { - return DecoratedBox( - decoration: BoxDecoration( - color: Colors.transparent, - border: Border.all( - color: Theme.of(context).dividerColor, - width: (_isMaximized || _isFullScreen) ? 0 : 1, - ), - boxShadow: [ - if (!_isMaximized && !_isFullScreen) + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(_isMaximized ? 0 : 8), + color: Colors.transparent, + boxShadow: [ BoxShadow( - color: Colors.black.toOpacity(0.1), - offset: Offset(0.0, _isFocused ? 4 : 2), - blurRadius: 6, - ) - ], - ), - child: widget.child, - ); + color: Colors.black.toOpacity(_isFocused ? 0.4 : 0.2), + offset: Offset(0.0, 2), + blurRadius: 4, + ) + ], + ), + clipBehavior: Clip.antiAlias, + child: widget.child, + ); } @override Widget build(BuildContext context) { return DragToResizeArea( enableResizeEdges: (_isMaximized || _isFullScreen) ? [] : null, - child: _buildVirtualWindowFrame(context), + child: Padding( + padding: EdgeInsets.all(_isMaximized ? 0 : 4), + child: _buildVirtualWindowFrame(context), + ), ); } diff --git a/lib/main.dart b/lib/main.dart index 0ab3875..463a3b0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -34,13 +34,10 @@ void main(List args) { await windowManager.setBackgroundColor(Colors.transparent); } await windowManager.setMinimumSize(const Size(500, 600)); - if (!App.isLinux) { - // https://github.com/leanflutter/window_manager/issues/460 - var placement = await WindowPlacement.loadFromFile(); - await placement.applyToWindow(); - await windowManager.show(); - WindowPlacement.loop(); - } + var placement = await WindowPlacement.loadFromFile(); + await placement.applyToWindow(); + await windowManager.show(); + WindowPlacement.loop(); }); } }, (error, stack) { @@ -201,6 +198,7 @@ class _MyAppState extends State with WidgetsBindingObserver { 'dark' => ThemeMode.dark, _ => ThemeMode.system }, + color: Colors.transparent, localizationsDelegates: [ GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, @@ -248,6 +246,7 @@ class _MyAppState extends State with WidgetsBindingObserver { ); } return _SystemUiProvider(Material( + color: App.isLinux ? Colors.transparent : null, child: widget, )); } diff --git a/lib/pages/settings/app.dart b/lib/pages/settings/app.dart index 4bb032f..e190d14 100644 --- a/lib/pages/settings/app.dart +++ b/lib/pages/settings/app.dart @@ -330,11 +330,10 @@ class _WebdavSettingState extends State<_WebdavSetting> { String url = ""; String user = ""; String pass = ""; - bool autoSync = false; + bool autoSync = true; bool isTesting = false; bool upload = true; - bool isEnabled = false; @override void initState() { @@ -349,8 +348,7 @@ class _WebdavSettingState extends State<_WebdavSetting> { url = configs[0]; user = configs[1]; pass = configs[2]; - isEnabled = true; - autoSync = appdata.implicitData['webdavAutoSync'] ?? false; + autoSync = appdata.implicitData['webdavAutoSync'] ?? true; } void onAutoSyncChanged(bool value) { @@ -368,16 +366,11 @@ class _WebdavSettingState extends State<_WebdavSetting> { body: SingleChildScrollView( child: Column( children: [ - const SizedBox(height: 12), - SwitchListTile( - title: Text("WebDAV Auto Sync".tl), - value: autoSync, - onChanged: onAutoSyncChanged, - ), const SizedBox(height: 12), TextField( - decoration: const InputDecoration( + decoration: InputDecoration( labelText: "URL", + hintText: "A valid WebDav directory URL".tl, border: OutlineInputBorder(), ), controller: TextEditingController(text: url), @@ -402,6 +395,16 @@ class _WebdavSettingState extends State<_WebdavSetting> { onChanged: (value) => pass = value, ), const SizedBox(height: 12), + ListTile( + leading: Icon(Icons.sync), + title: Text("Auto Sync Data".tl), + contentPadding: EdgeInsets.zero, + trailing: Switch( + value: autoSync, + onChanged: onAutoSyncChanged, + ), + ), + const SizedBox(height: 12), Row( children: [ Text("Operation".tl), @@ -428,21 +431,28 @@ class _WebdavSettingState extends State<_WebdavSetting> { ], ), const SizedBox(height: 16), - Container( - padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primaryContainer, - borderRadius: BorderRadius.circular(8), - ), - child: Row( - children: [ - const Icon(Icons.info_outline, size: 20), - const SizedBox(width: 8), - Expanded( - child: Text("Once the operation is successful, app will automatically sync data with the server.".tl), - ), - ], - ), + AnimatedSize( + duration: const Duration(milliseconds: 200), + child: autoSync + ? Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primaryContainer, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + const Icon(Icons.info_outline, size: 20), + const SizedBox(width: 8), + Expanded( + child: Text( + "Once the operation is successful, app will automatically sync data with the server." + .tl), + ), + ], + ), + ) + : const SizedBox.shrink(), ), const SizedBox(height: 16), Center( diff --git a/linux/my_application.cc b/linux/my_application.cc index 774c9c2..5b2bfe6 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -48,6 +48,12 @@ static void my_application_activate(GApplication* application) { } gtk_window_set_default_size(window, 1280, 720); + GdkVisual* visual; + gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE); + visual = gdk_screen_get_rgba_visual(screen); + if (visual != NULL && gdk_screen_is_composited(screen)) { + gtk_widget_set_visual(GTK_WIDGET(window), visual); + } gtk_widget_show(GTK_WIDGET(window)); g_autoptr(FlDartProject) project = fl_dart_project_new(); @@ -58,6 +64,7 @@ static void my_application_activate(GApplication* application) { gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + gtk_widget_hide(GTK_WIDGET(window)); gtk_widget_grab_focus(GTK_WIDGET(view)); } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..2ee436d --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.85.1" +targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android"]