🐛 Fix no nav to use
This commit is contained in:
parent
55b79bfd8f
commit
4209a13c84
@ -896,5 +896,6 @@
|
|||||||
"album": "Album",
|
"album": "Album",
|
||||||
"albumDescription": "View albums and manage attachments.",
|
"albumDescription": "View albums and manage attachments.",
|
||||||
"stickers": "Stickers",
|
"stickers": "Stickers",
|
||||||
"stickersDescription": "View sticker packs and manage stickers."
|
"stickersDescription": "View sticker packs and manage stickers.",
|
||||||
|
"navBottomUnauthorizedCaption": "Or create an account"
|
||||||
}
|
}
|
||||||
|
@ -894,5 +894,6 @@
|
|||||||
"album": "相册",
|
"album": "相册",
|
||||||
"albumDescription": "查看相册与管理上传附件。",
|
"albumDescription": "查看相册与管理上传附件。",
|
||||||
"stickers": "贴图",
|
"stickers": "贴图",
|
||||||
"stickersDescription": "查看贴图包与管理贴图。"
|
"stickersDescription": "查看贴图包与管理贴图。",
|
||||||
|
"navBottomUnauthorizedCaption": "或者注册一个账号"
|
||||||
}
|
}
|
||||||
|
@ -894,5 +894,6 @@
|
|||||||
"album": "相冊",
|
"album": "相冊",
|
||||||
"albumDescription": "查看相冊與管理上傳附件。",
|
"albumDescription": "查看相冊與管理上傳附件。",
|
||||||
"stickers": "貼圖",
|
"stickers": "貼圖",
|
||||||
"stickersDescription": "查看貼圖包與管理貼圖。"
|
"stickersDescription": "查看貼圖包與管理貼圖。",
|
||||||
|
"navBottomUnauthorizedCaption": "或者註冊一個賬號"
|
||||||
}
|
}
|
||||||
|
@ -894,5 +894,6 @@
|
|||||||
"album": "相冊",
|
"album": "相冊",
|
||||||
"albumDescription": "查看相冊與管理上傳附件。",
|
"albumDescription": "查看相冊與管理上傳附件。",
|
||||||
"stickers": "貼圖",
|
"stickers": "貼圖",
|
||||||
"stickersDescription": "查看貼圖包與管理貼圖。"
|
"stickersDescription": "查看貼圖包與管理貼圖。",
|
||||||
|
"navBottomUnauthorizedCaption": "或者註冊一個賬號"
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,7 @@ class AccountScreen extends StatelessWidget {
|
|||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: AutoAppBarLeading(),
|
leading: AutoAppBarLeading(),
|
||||||
title: Text(
|
title: Text("screenAccount").tr(),
|
||||||
"screenAccount",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
shadows: [
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(1, 1),
|
|
||||||
blurRadius: 5.0,
|
|
||||||
color: Color.fromARGB(255, 0, 0, 0),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).tr(),
|
|
||||||
flexibleSpace: ua.user != null && ua.user!.banner.isNotEmpty
|
flexibleSpace: ua.user != null && ua.user!.banner.isNotEmpty
|
||||||
? Stack(
|
? Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:animations/animations.dart';
|
import 'package:animations/animations.dart';
|
||||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -9,6 +10,7 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:responsive_framework/responsive_framework.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:surface/providers/channel.dart';
|
import 'package:surface/providers/channel.dart';
|
||||||
import 'package:surface/providers/config.dart';
|
import 'package:surface/providers/config.dart';
|
||||||
@ -46,6 +48,17 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
|
|||||||
final nav = context.watch<NavigationProvider>();
|
final nav = context.watch<NavigationProvider>();
|
||||||
final cfg = context.watch<ConfigProvider>();
|
final cfg = context.watch<ConfigProvider>();
|
||||||
|
|
||||||
|
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;
|
final backgroundColor = cfg.drawerIsExpanded ? Colors.transparent : null;
|
||||||
|
|
||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
@ -78,19 +91,33 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: _DrawerContentList(),
|
child: _DrawerContentList(),
|
||||||
),
|
),
|
||||||
if (cfg.hideBottomNav)
|
if (showNavButtons)
|
||||||
Row(
|
Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: nav.destinations.where((ele) => ele.isPinned).map(
|
children:
|
||||||
(ele) {
|
nav.destinations.where((ele) => ele.isPinned).mapIndexed(
|
||||||
|
(idx, ele) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: ele.label.tr(),
|
message: ele.label.tr(),
|
||||||
child: IconButton.filledTonal(
|
child: IconButton(
|
||||||
icon: ele.icon,
|
icon: ele.icon,
|
||||||
color: Theme.of(context)
|
color: nav.currentIndex == idx
|
||||||
|
? Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onPrimaryContainer,
|
.onPrimaryContainer
|
||||||
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
nav.currentIndex == idx
|
||||||
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primaryContainer
|
||||||
|
: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow,
|
||||||
|
),
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
GoRouter.of(context).goNamed(ele.screen);
|
GoRouter.of(context).goNamed(ele.screen);
|
||||||
Scaffold.of(context).closeDrawer();
|
Scaffold.of(context).closeDrawer();
|
||||||
@ -105,13 +132,21 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
|
|||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||||
leading: AccountImage(content: ua.user?.avatar),
|
leading: AccountImage(
|
||||||
title: Text(ua.user?.nick ?? 'unknown'.tr()).fontSize(15),
|
content: ua.user?.avatar,
|
||||||
subtitle:
|
fallbackWidget:
|
||||||
Text('@${ua.user?.name ?? 'unknown'.tr()}').fontSize(13),
|
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(
|
trailing: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
if (ua.isAuthorized)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.notifications, fill: 1),
|
icon: const Icon(Symbols.notifications, fill: 1),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
@ -185,17 +220,6 @@ class _DrawerContentList extends StatelessWidget {
|
|||||||
horizontal: 32,
|
horizontal: 32,
|
||||||
vertical: 12,
|
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) {
|
...rel.availableRealms.map((ele) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
minTileHeight: 48,
|
minTileHeight: 48,
|
||||||
|
@ -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
|
# 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
|
# 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.
|
# 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:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user