pos changes
This commit is contained in:
@@ -6,9 +6,9 @@ import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_dimens.dart';
|
||||
import '../../../core/theme/app_layout.dart';
|
||||
import '../../../core/theme/app_typography.dart';
|
||||
import '../../../core/widgets/brand_mark.dart';
|
||||
import '../../../core/utils/formatters.dart';
|
||||
import '../../auth/providers/auth_controller.dart';
|
||||
import '../../sync/widgets/sign_out_dialog.dart';
|
||||
import '../providers/cart_controller.dart';
|
||||
import '../../sync/providers/sync_controller.dart';
|
||||
import '../providers/navigation_provider.dart';
|
||||
@@ -59,7 +59,9 @@ class AppSidebar extends ConsumerWidget {
|
||||
padding: const EdgeInsets.symmetric(vertical: AppSpacing.md),
|
||||
child: Column(
|
||||
children: [
|
||||
for (final section in NavSection.values)
|
||||
// Sections with nothing this session may open are not
|
||||
// rendered as empty headings.
|
||||
for (final section in ref.watch(visibleSectionsProvider))
|
||||
_Section(
|
||||
section: section,
|
||||
expanded: expanded,
|
||||
@@ -69,8 +71,6 @@ class AppSidebar extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_LogoutTile(expanded: expanded),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -94,23 +94,7 @@ class _Brand extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColors.primaryGradient,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'N',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
const BrandMark(size: 36),
|
||||
if (expanded) ...[
|
||||
const SizedBox(width: AppSpacing.md),
|
||||
Flexible(
|
||||
@@ -228,7 +212,8 @@ class _Section extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final active = ref.watch(activeModuleProvider);
|
||||
final active = ref.watch(resolvedModuleProvider);
|
||||
final visible = ref.watch(visibleModulesProvider);
|
||||
final cartCount = ref.watch(cartItemCountProvider);
|
||||
final ready = ref.watch(catalogueReadyProvider);
|
||||
final outstanding = ref.watch(unsyncedCountProvider).value ?? 0;
|
||||
@@ -255,7 +240,7 @@ class _Section extends ConsumerWidget {
|
||||
),
|
||||
child: Divider(height: 1),
|
||||
),
|
||||
for (final module in section.modules)
|
||||
for (final module in section.modules.where(visible.contains))
|
||||
_NavTile(
|
||||
module: module,
|
||||
expanded: expanded,
|
||||
@@ -434,48 +419,3 @@ class _Badge extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LogoutTile extends ConsumerWidget {
|
||||
const _LogoutTile({required this.expanded});
|
||||
|
||||
final bool expanded;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => showSignOutDialog(context, ref),
|
||||
borderRadius: AppRadius.brSm,
|
||||
child: Container(
|
||||
height: AppSizes.navItemHeight,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: expanded ? AppSpacing.md : 0,
|
||||
),
|
||||
alignment: expanded ? Alignment.centerLeft : Alignment.center,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.logout_rounded,
|
||||
size: 19, color: AppColors.danger,),
|
||||
if (expanded) ...[
|
||||
const SizedBox(width: AppSpacing.md),
|
||||
const Text(
|
||||
'Logout',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.danger,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user