tablet navigation bar fixed

This commit is contained in:
amirrezaghabeli
2025-08-26 14:58:06 +03:30
parent 3bde47dbb3
commit 4f07facbb8
18 changed files with 628 additions and 479 deletions
+132 -138
View File
@@ -51,145 +51,139 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Consumer<ProfileViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading) {
return Center(
child: CircularProgressIndicator(color: AppColors.secondary50),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
return Column(
children: [
DesktopNavigationWidget(
currentIndex: 2, // Tenders index
onTabChanged: (index) {
// Navigate to different screens based on index
switch (index) {
case 0:
// Navigate to home
Router.neglect(context, () => context.go('/home'));
break;
case 1:
// Navigate to profile
Router.neglect(context, () => context.go('/tenders'));
break;
case 2:
// Already on profile
break;
}
},
),
SizedBox(
// color: Colors.amber.shade100,
width: 740,
// height: 662,
child: Column(
children: [
SizedBox(height: 36.0.h()),
TitleDescription(
title: 'Company Name',
description: viewModel.companyProfileData!.name!,
),
TitleDescription(
title: 'National ID',
description: viewModel.companyProfileData!.id!,
),
TitleDescription(
title: 'Registration No.',
description:
viewModel.companyProfileData!.registrationNumber!,
),
TitleDescription(
title: 'Business Type',
description: '-',
),
TitleDescription(
title: 'Founded',
description:
viewModel.companyProfileData!.foundedYear!
.toString(),
),
SizedBox(height: 24.0.h()),
// Theme Toggle
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
AppStrings.settings,
style: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
),
),
),
SizedBox(height: 36.0.h()),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
child: Row(
children: [
Text(
AppStrings.appTheme,
style: TextStyle(
fontSize: 16.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey70,
),
),
Spacer(),
SvgPicture.asset(AssetsManager.sun),
SizedBox(width: 12.0.w()),
SizedBox(
width: 52.0.w(),
height: 32.0.h(),
child: ThemeToggle(),
),
SizedBox(width: 12.0.w()),
SvgPicture.asset(AssetsManager.moon),
],
),
),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.dividerColor, thickness: 1),
SizedBox(height: 24.0.h()),
// Spacer(),
Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () => viewModel.logout(),
child: Container(
width: 156,
height: 56.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(100),
),
alignment: Alignment.center,
child: Text(
'Logout',
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.primaryColor,
),
),
),
),
),
],
),
),
],
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Consumer<ProfileViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading) {
return Center(
child: CircularProgressIndicator(color: AppColors.secondary50),
);
},
),
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
return Column(
children: [
DesktopNavigationWidget(
currentIndex: 2, // Tenders index
onTabChanged: (index) {
// Navigate to different screens based on index
switch (index) {
case 0:
// Navigate to home
Router.neglect(context, () => context.go('/home'));
break;
case 1:
// Navigate to profile
Router.neglect(context, () => context.go('/tenders'));
break;
case 2:
// Already on profile
break;
}
},
),
SizedBox(
// color: Colors.amber.shade100,
width: 740,
// height: 662,
child: Column(
children: [
SizedBox(height: 36.0.h()),
TitleDescription(
title: 'Company Name',
description: viewModel.companyProfileData!.name!,
),
TitleDescription(
title: 'National ID',
description: viewModel.companyProfileData!.id!,
),
TitleDescription(
title: 'Registration No.',
description:
viewModel.companyProfileData!.registrationNumber!,
),
TitleDescription(title: 'Business Type', description: '-'),
TitleDescription(
title: 'Founded',
description:
viewModel.companyProfileData!.foundedYear!.toString(),
),
SizedBox(height: 24.0.h()),
// Theme Toggle
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
AppStrings.settings,
style: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
),
),
),
SizedBox(height: 36.0.h()),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
child: Row(
children: [
Text(
AppStrings.appTheme,
style: TextStyle(
fontSize: 16.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey70,
),
),
Spacer(),
SvgPicture.asset(AssetsManager.sun),
SizedBox(width: 12.0.w()),
SizedBox(
width: 52.0.w(),
height: 32.0.h(),
child: ThemeToggle(),
),
SizedBox(width: 12.0.w()),
SvgPicture.asset(AssetsManager.moon),
],
),
),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.dividerColor, thickness: 1),
SizedBox(height: 24.0.h()),
// Spacer(),
Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () => viewModel.logout(),
child: Container(
width: 156,
height: 56.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(100),
),
alignment: Alignment.center,
child: Text(
'Logout',
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.primaryColor,
),
),
),
),
),
],
),
),
],
);
},
),
);
}
@@ -1,13 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/constants/assets.dart';
import 'package:tm_app/core/constants/strings.dart';
import 'package:tm_app/core/routes/app_routes.dart';
import 'package:tm_app/view_models/home_view_model.dart';
import 'package:tm_app/view_models/profile_view_model.dart';
import '../../../core/theme/colors.dart';
import '../../../core/utils/size_config.dart';
import '../../shared/tablet_navigation_widget.dart';
import '../widgets/theme_toggle.dart';
import '../widgets/title_description.dart';
@@ -49,6 +52,7 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
@override
Widget build(BuildContext context) {
final GlobalKey<ScaffoldState> key = GlobalKey();
return Consumer<ProfileViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading) {
@@ -62,7 +66,49 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
return SafeArea(
child: Scaffold(
key: key,
backgroundColor: AppColors.backgroundColor,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(64),
child: AppBar(
backgroundColor: AppColors.backgroundColor,
elevation: 0,
titleSpacing: 0,
leading: Padding(
padding: EdgeInsetsDirectional.only(start: 24.0.w()),
child: SvgPicture.asset(AssetsManager.logoSmall),
),
actions: [
IconButton(
icon: Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: SvgPicture.asset(
AssetsManager.menu,
height: 32.0.w(),
width: 32.0.w(),
),
),
onPressed: () => key.currentState!.openDrawer(),
),
],
),
),
drawer: TabletNavigationWidget(
currentIndex: 2,
onTabChanged: (index) {
switch (index) {
case 0:
context.pop();
Router.neglect(context, () => context.go('/home'));
context.read<HomeViewModel>().init();
break;
case 1:
context.pop();
Router.neglect(context, () => context.go('/tenders'));
break;
}
},
),
body: Padding(
padding: EdgeInsets.symmetric(
horizontal: 24.0.w(),