diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index 1df1a27..ce5b808 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -896,5 +896,6 @@ "album": "Album", "albumDescription": "View albums and manage attachments.", "stickers": "Stickers", - "stickersDescription": "View sticker packs and manage stickers." + "stickersDescription": "View sticker packs and manage stickers.", + "navBottomUnauthorizedCaption": "Or create an account" } diff --git a/assets/translations/zh-CN.json b/assets/translations/zh-CN.json index 442e7fb..9880f8b 100644 --- a/assets/translations/zh-CN.json +++ b/assets/translations/zh-CN.json @@ -894,5 +894,6 @@ "album": "相册", "albumDescription": "查看相册与管理上传附件。", "stickers": "贴图", - "stickersDescription": "查看贴图包与管理贴图。" + "stickersDescription": "查看贴图包与管理贴图。", + "navBottomUnauthorizedCaption": "或者注册一个账号" } diff --git a/assets/translations/zh-HK.json b/assets/translations/zh-HK.json index 6c748bd..1c62f64 100644 --- a/assets/translations/zh-HK.json +++ b/assets/translations/zh-HK.json @@ -894,5 +894,6 @@ "album": "相冊", "albumDescription": "查看相冊與管理上傳附件。", "stickers": "貼圖", - "stickersDescription": "查看貼圖包與管理貼圖。" + "stickersDescription": "查看貼圖包與管理貼圖。", + "navBottomUnauthorizedCaption": "或者註冊一個賬號" } diff --git a/assets/translations/zh-TW.json b/assets/translations/zh-TW.json index 1273c26..09efe1b 100644 --- a/assets/translations/zh-TW.json +++ b/assets/translations/zh-TW.json @@ -894,5 +894,6 @@ "album": "相冊", "albumDescription": "查看相冊與管理上傳附件。", "stickers": "貼圖", - "stickersDescription": "查看貼圖包與管理貼圖。" + "stickersDescription": "查看貼圖包與管理貼圖。", + "navBottomUnauthorizedCaption": "或者註冊一個賬號" } diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 2f3ec70..db7013e 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -30,19 +30,7 @@ class AccountScreen extends StatelessWidget { return AppScaffold( appBar: AppBar( leading: AutoAppBarLeading(), - title: Text( - "screenAccount", - style: TextStyle( - color: Colors.white, - shadows: [ - Shadow( - offset: Offset(1, 1), - blurRadius: 5.0, - color: Color.fromARGB(255, 0, 0, 0), - ), - ], - ), - ).tr(), + title: Text("screenAccount").tr(), flexibleSpace: ua.user != null && ua.user!.banner.isNotEmpty ? Stack( fit: StackFit.expand, diff --git a/lib/widgets/navigation/app_drawer_navigation.dart b/lib/widgets/navigation/app_drawer_navigation.dart index 40b5498..60c9db7 100644 --- a/lib/widgets/navigation/app_drawer_navigation.dart +++ b/lib/widgets/navigation/app_drawer_navigation.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:animations/animations.dart'; import 'package:bitsdojo_window/bitsdojo_window.dart'; +import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -9,6 +10,7 @@ import 'package:gap/gap.dart'; import 'package:go_router/go_router.dart'; import 'package:material_symbols_icons/symbols.dart'; import 'package:provider/provider.dart'; +import 'package:responsive_framework/responsive_framework.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/channel.dart'; import 'package:surface/providers/config.dart'; @@ -46,6 +48,17 @@ class _AppNavigationDrawerState extends State { final nav = context.watch(); final cfg = context.watch(); + final routeName = GoRouter.of(context) + .routerDelegate + .currentConfiguration + .last + .route + .name; + final showNavButtons = cfg.hideBottomNav || + !(nav.showBottomNavScreen.contains(routeName) + ? ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE) + : false); + final backgroundColor = cfg.drawerIsExpanded ? Colors.transparent : null; return ListenableBuilder( @@ -78,19 +91,33 @@ class _AppNavigationDrawerState extends State { Expanded( child: _DrawerContentList(), ), - if (cfg.hideBottomNav) + if (showNavButtons) Row( spacing: 8, - children: nav.destinations.where((ele) => ele.isPinned).map( - (ele) { + children: + nav.destinations.where((ele) => ele.isPinned).mapIndexed( + (idx, ele) { return Expanded( child: Tooltip( message: ele.label.tr(), - child: IconButton.filledTonal( + child: IconButton( icon: ele.icon, - color: Theme.of(context) - .colorScheme - .onPrimaryContainer, + color: nav.currentIndex == idx + ? Theme.of(context) + .colorScheme + .onPrimaryContainer + : Theme.of(context).colorScheme.onSurface, + style: ButtonStyle( + backgroundColor: WidgetStatePropertyAll( + nav.currentIndex == idx + ? Theme.of(context) + .colorScheme + .primaryContainer + : Theme.of(context) + .colorScheme + .surfaceContainerLow, + ), + ), onPressed: () { GoRouter.of(context).goNamed(ele.screen); Scaffold.of(context).closeDrawer(); @@ -105,22 +132,30 @@ class _AppNavigationDrawerState extends State { alignment: Alignment.bottomCenter, child: ListTile( contentPadding: EdgeInsets.symmetric(horizontal: 24), - leading: AccountImage(content: ua.user?.avatar), - title: Text(ua.user?.nick ?? 'unknown'.tr()).fontSize(15), - subtitle: - Text('@${ua.user?.name ?? 'unknown'.tr()}').fontSize(13), + leading: AccountImage( + content: ua.user?.avatar, + fallbackWidget: + ua.isAuthorized ? null : const Icon(Symbols.login), + ), + title: ua.isAuthorized + ? Text(ua.user?.nick ?? 'unknown'.tr()).fontSize(15) + : Text('screenAuthLogin').tr(), + subtitle: ua.isAuthorized + ? Text('@${ua.user?.name ?? 'unknown'.tr()}').fontSize(13) + : Text('navBottomUnauthorizedCaption').fontSize(13).tr(), trailing: Row( mainAxisSize: MainAxisSize.min, children: [ - IconButton( - icon: const Icon(Symbols.notifications, fill: 1), - padding: EdgeInsets.zero, - visualDensity: VisualDensity.compact, - onPressed: () { - GoRouter.of(context).pushNamed('notification'); - Scaffold.of(context).closeDrawer(); - }, - ), + if (ua.isAuthorized) + IconButton( + icon: const Icon(Symbols.notifications, fill: 1), + padding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, + onPressed: () { + GoRouter.of(context).pushNamed('notification'); + Scaffold.of(context).closeDrawer(); + }, + ), IconButton( icon: const Icon(Symbols.settings, fill: 1), padding: EdgeInsets.zero, @@ -185,17 +220,6 @@ class _DrawerContentList extends StatelessWidget { horizontal: 32, vertical: 12, ), - ListTile( - minTileHeight: 48, - contentPadding: EdgeInsets.only(left: 28, right: 16), - leading: const Icon(Symbols.home).padding(right: 4), - title: Text('screenHome').tr(), - onTap: () { - GoRouter.of(context).goNamed('home'); - Scaffold.of(context).closeDrawer(); - }, - ), - const Divider(height: 1).padding(vertical: 4), ...rel.availableRealms.map((ele) { return ListTile( minTileHeight: 48, diff --git a/pubspec.yaml b/pubspec.yaml index 07a9e7c..8e18095 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.4.2+83 +version: 2.4.2+84 environment: sdk: ^3.5.4