diff --git a/assets/translation.json b/assets/translation.json index 985ab59..974be32 100644 --- a/assets/translation.json +++ b/assets/translation.json @@ -246,7 +246,12 @@ "New version available": "有新版本可用", "A new version is available. Do you want to update now?" : "有新版本可用。您要现在更新吗?", "No new version available": "没有新版本可用", - "Export as pdf": "导出为pdf" + "Export as pdf": "导出为pdf", + "Export as epub": "导出为epub", + "Aggregated Search": "聚合搜索", + "No search results found": "未找到搜索结果", + "Added @c comics to download queue." : "已添加 @c 本漫画到下载队列", + "Download started": "下载已开始" }, "zh_TW": { "Home": "首頁", @@ -495,6 +500,11 @@ "New version available": "有新版本可用", "A new version is available. Do you want to update now?" : "有新版本可用。您要現在更新嗎?", "No new version available": "沒有新版本可用", - "Export as pdf": "匯出為pdf" + "Export as pdf": "匯出為pdf", + "Export as epub": "匯出為epub", + "Aggregated Search": "聚合搜索", + "No search results found": "未找到搜索結果", + "Added @c comics to download queue." : "已添加 @c 本漫畫到下載隊列", + "Download started": "下載已開始" } } \ No newline at end of file diff --git a/lib/components/appbar.dart b/lib/components/appbar.dart index 0550e60..841d5fe 100644 --- a/lib/components/appbar.dart +++ b/lib/components/appbar.dart @@ -76,7 +76,7 @@ class _AppbarState extends State { var content = Container( decoration: BoxDecoration( color: widget.backgroundColor ?? - context.colorScheme.surface.withOpacity(0.72), + context.colorScheme.surface.toOpacity(0.72), ), height: _kAppBarHeight + context.padding.top, child: Row( @@ -189,20 +189,19 @@ class _MySliverAppBarDelegate extends SliverPersistentHeaderDelegate { leading ?? (Navigator.of(context).canPop() ? Tooltip( - message: "Back".tl, - child: IconButton( - icon: const Icon(Icons.arrow_back), - onPressed: () => Navigator.maybePop(context), - ), - ) + message: "Back".tl, + child: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => Navigator.maybePop(context), + ), + ) : const SizedBox()), const SizedBox( width: 16, ), Expanded( child: DefaultTextStyle( - style: - DefaultTextStyle.of(context).style.copyWith(fontSize: 20), + style: DefaultTextStyle.of(context).style.copyWith(fontSize: 20), maxLines: 1, overflow: TextOverflow.ellipsis, child: title, @@ -215,12 +214,12 @@ class _MySliverAppBarDelegate extends SliverPersistentHeaderDelegate { ], ).paddingTop(topPadding); - if(style == AppbarStyle.blur) { + if (style == AppbarStyle.blur) { return SizedBox.expand( child: BlurEffect( blur: 15, child: Material( - color: context.colorScheme.surface.withOpacity(0.72), + color: context.colorScheme.surface.toOpacity(0.72), elevation: 0, borderRadius: BorderRadius.circular(radius), child: body, @@ -298,12 +297,21 @@ class _FilledTabBarState extends State { super.dispose(); } + PageStorageBucket get bucket => PageStorage.of(context); + @override void didChangeDependencies() { _controller = widget.controller ?? DefaultTabController.of(context); - _controller.animation!.addListener(onTabChanged); initPainter(); super.didChangeDependencies(); + var prevIndex = bucket.readState(context) as int?; + if (prevIndex != null && + prevIndex != _controller.index && + prevIndex >= 0 && + prevIndex < widget.tabs.length) { + _controller.index = prevIndex; + } + _controller.animation!.addListener(onTabChanged); } @override @@ -347,6 +355,7 @@ class _FilledTabBarState extends State { controller: scrollController, builder: (context, controller, physics) { return SingleChildScrollView( + key: const PageStorageKey('scroll'), scrollDirection: Axis.horizontal, padding: EdgeInsets.zero, controller: controller, @@ -387,6 +396,7 @@ class _FilledTabBarState extends State { } updateScrollOffset(i); previousIndex = i; + bucket.writeState(context, i); } void updateScrollOffset(int i) { @@ -724,6 +734,7 @@ class _SliverSearchBarDelegate extends SliverPersistentHeaderDelegate { icon: const Icon(Icons.clear), onPressed: () { editingController.clear(); + onChanged?.call(""); }, ); }, diff --git a/lib/components/button.dart b/lib/components/button.dart index 8a16de0..e3cc116 100644 --- a/lib/components/button.dart +++ b/lib/components/button.dart @@ -214,7 +214,7 @@ class _ButtonState extends State