Files
tm_app/lib/views/shared/desktop_navigation_widget.dart
T
AmirReza Jamali dde66521f6 Add Docker support and enhance data models for tender details
- Introduced a .dockerignore file to optimize Docker builds by excluding unnecessary files.
- Updated the Dockerfile to use a Flutter base image, enabling web builds for the application.
- Added new data models for `Lot` and `OrganizationAddress` to represent tender details more accurately.
- Enhanced the `Organization` model to include `companyId` and a nested `address` field.
- Updated the `TenderData` model to include new fields such as `noticeTypeCode`, `formType`, and `lots`, reflecting the API response structure.
- Regenerated necessary code for data models to ensure compatibility with the updated structures.
2026-06-03 13:32:42 +03:30

226 lines
7.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/constants/assets.dart';
import 'package:tm_app/core/services/tab_navigation_service.dart';
import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/notification_state_service.dart';
import 'package:tm_app/views/home/strings/home_strings.dart';
import 'package:tm_app/views/profile/strings/profile_strings.dart';
import 'package:tm_app/views/tenders/strings/tenders_strings.dart';
import '../../core/routes/app_routes.dart';
class DesktopNavigationWidget extends StatelessWidget {
const DesktopNavigationWidget({
required this.currentIndex,
super.key,
this.haveFilter = false,
});
final int currentIndex;
final bool haveFilter;
@override
Widget build(BuildContext context) {
return Container(
height: 64,
decoration: BoxDecoration(
color: AppColors.backgroundColor,
border: Border(bottom: BorderSide(color: AppColors.grey30)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(width: 40),
InkWell(
onTap: () {
if (currentIndex == 0) {
return;
} else {
Router.neglect(
context,
() => const HomeRouteData().go(context),
);
context.read<TabNavigationService>().onTabSelected(0);
}
},
child: SizedBox(
width: 150,
height: 48,
child: SvgPicture.asset(AssetsManager.logoSvg),
),
),
const Spacer(),
_navigationItem(
context: context,
text: HomeStrings.home,
isActive: currentIndex == 0,
onTap: () {
if (currentIndex == 0) {
return;
} else {
Router.neglect(
context,
() => const HomeRouteData().go(context),
);
context.read<TabNavigationService>().onTabSelected(0);
}
},
iconPath: AssetsManager.home,
activeIconPath: AssetsManager.homeActive,
),
const SizedBox(width: 24),
_navigationItem(
context: context,
text: TendersStrings.tendersTitle,
isActive: currentIndex == 1,
onTap: () {
Router.neglect(
context,
() => const TendersRouteData().go(context),
);
context.read<TabNavigationService>().onTabSelected(1);
},
iconPath: AssetsManager.tenders,
activeIconPath: AssetsManager.tendersActive,
),
// AI-NOTE (for PR reviewer): Board tab disabled (commented, not
// removed) to hide the Board page from desktop navigation per request.
// The Board route/page itself is left intact; re-enable this nav item
// to bring the tab back. Note the tab indices of later items are
// unchanged because this block is fully commented out.
// const SizedBox(width: 24),
// _navigationItem(
// context: context,
// text: TendersStrings.board,
// isActive: currentIndex == 2,
// onTap: () {
// if (currentIndex == 2) {
// return;
// } else {
// Router.neglect(
// context,
// () => const BoardRouteData().go(context),
// );
// // context.read<TendersViewModel>().getTenders();
// }
// },
// iconPath: AssetsManager.board,
// activeIconPath: AssetsManager.boardActive,
// ),
const SizedBox(width: 24),
_navigationItem(
context: context,
text: TendersStrings.notifications,
isActive: currentIndex == 3,
onTap: () {
if (currentIndex == 3) {
return;
} else {
Router.neglect(
context,
() => const NotificationRouteData().go(context),
);
context.read<TabNavigationService>().onTabSelected(3);
}
},
iconPath: AssetsManager.notify,
activeIconPath: AssetsManager.notifyActive,
),
const SizedBox(width: 24),
_navigationItem(
context: context,
text: ProfileStrings.profileTitle,
isActive: currentIndex == 4,
onTap: () {
if (currentIndex == 4) {
return;
} else {
Router.neglect(
context,
() => const ProfileRouteData().go(context),
);
}
},
iconPath: AssetsManager.profile,
activeIconPath: AssetsManager.profileActive,
),
const Spacer(),
if (haveFilter)
Builder(
builder:
(context) => IconButton(
icon: SvgPicture.asset(
AssetsManager.filter,
height: 24.0.w(),
width: 24.0.w(),
),
onPressed: () {
Scaffold.of(context).openEndDrawer();
},
),
),
const SizedBox(width: 68),
],
),
);
}
Widget _navigationItem({
required BuildContext context,
required String text,
required bool isActive,
required VoidCallback onTap,
required String iconPath,
required String activeIconPath,
}) {
final hasUnread =
context.watch<NotificationStateService>().hasUnreadNotification;
return InkWell(
onTap: onTap,
child: SizedBox(
width: 115.0,
height: 64,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
clipBehavior: Clip.none,
children: [
SvgPicture.asset(isActive ? activeIconPath : iconPath),
if (text == TendersStrings.notifications && hasUnread)
Positioned(
right: -5,
top: -2,
child: Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
),
],
),
const SizedBox(width: 8),
Text(
text,
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
color: isActive ? AppColors.primaryColor : AppColors.grey60,
),
),
],
),
),
);
}
}