Fixed desktop navigation
This commit is contained in:
@@ -7,12 +7,12 @@ import 'package:tm_app/core/utils/size_config.dart';
|
|||||||
import 'package:tm_app/view_models/home_view_model.dart';
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
import 'package:tm_app/view_models/tenders_view_model.dart';
|
import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||||
import 'package:tm_app/views/home/strings/home_strings.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 'package:tm_app/views/tenders/strings/tenders_strings.dart';
|
||||||
|
|
||||||
import '../../core/routes/app_routes.dart';
|
import '../../core/routes/app_routes.dart';
|
||||||
|
|
||||||
class DesktopNavigationWidget extends StatelessWidget
|
class DesktopNavigationWidget extends StatelessWidget {
|
||||||
implements PreferredSizeWidget {
|
|
||||||
const DesktopNavigationWidget({
|
const DesktopNavigationWidget({
|
||||||
required this.currentIndex,
|
required this.currentIndex,
|
||||||
super.key,
|
super.key,
|
||||||
@@ -22,9 +22,6 @@ class DesktopNavigationWidget extends StatelessWidget
|
|||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
final bool haveFilter;
|
final bool haveFilter;
|
||||||
|
|
||||||
@override
|
|
||||||
Size get preferredSize => const Size.fromHeight(64);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -34,16 +31,20 @@ class DesktopNavigationWidget extends StatelessWidget
|
|||||||
border: Border(bottom: BorderSide(color: AppColors.grey30)),
|
border: Border(bottom: BorderSide(color: AppColors.grey30)),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 40),
|
SizedBox(width: 40),
|
||||||
SvgPicture.asset(AssetsManager.logoSmall),
|
SvgPicture.asset(AssetsManager.logoSmall),
|
||||||
const Spacer(),
|
Spacer(),
|
||||||
_navigationItem(
|
_navigationItem(
|
||||||
context: context,
|
context: context,
|
||||||
text: HomeStrings.home,
|
text: HomeStrings.home,
|
||||||
isActive: currentIndex == 0,
|
isActive: currentIndex == 0,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (currentIndex != 0) {
|
if (currentIndex == 0) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
Router.neglect(context, () => HomeRouteData().go(context));
|
Router.neglect(context, () => HomeRouteData().go(context));
|
||||||
context.read<HomeViewModel>().init();
|
context.read<HomeViewModel>().init();
|
||||||
}
|
}
|
||||||
@@ -51,13 +52,15 @@ class DesktopNavigationWidget extends StatelessWidget
|
|||||||
iconPath: AssetsManager.home,
|
iconPath: AssetsManager.home,
|
||||||
activeIconPath: AssetsManager.homeActive,
|
activeIconPath: AssetsManager.homeActive,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 24),
|
SizedBox(width: 24),
|
||||||
_navigationItem(
|
_navigationItem(
|
||||||
context: context,
|
context: context,
|
||||||
text: TendersStrings.tendersTitle,
|
text: TendersStrings.tendersTitle,
|
||||||
isActive: currentIndex == 1,
|
isActive: currentIndex == 1,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (currentIndex != 1) {
|
if (currentIndex == 1) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
Router.neglect(context, () => TendersRouteData().go(context));
|
Router.neglect(context, () => TendersRouteData().go(context));
|
||||||
context.read<TendersViewModel>().getTenders();
|
context.read<TendersViewModel>().getTenders();
|
||||||
}
|
}
|
||||||
@@ -65,20 +68,57 @@ class DesktopNavigationWidget extends StatelessWidget
|
|||||||
iconPath: AssetsManager.tenders,
|
iconPath: AssetsManager.tenders,
|
||||||
activeIconPath: AssetsManager.tendersActive,
|
activeIconPath: AssetsManager.tendersActive,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 24),
|
SizedBox(width: 24),
|
||||||
_navigationItem(
|
_navigationItem(
|
||||||
context: context,
|
context: context,
|
||||||
text: TendersStrings.contracts,
|
text: TendersStrings.contracts,
|
||||||
isActive: currentIndex == 2,
|
isActive: currentIndex == 2,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (currentIndex != 2) {
|
if (currentIndex == 2) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// Router.neglect(context, () => TendersRouteData().go(context));
|
||||||
|
// context.read<TendersViewModel>().getTenders();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
iconPath: AssetsManager.contracts,
|
||||||
|
activeIconPath: AssetsManager.contracts,
|
||||||
|
),
|
||||||
|
SizedBox(width: 24),
|
||||||
|
_navigationItem(
|
||||||
|
context: context,
|
||||||
|
text: TendersStrings.notifications,
|
||||||
|
isActive: currentIndex == 3,
|
||||||
|
onTap: () {
|
||||||
|
if (currentIndex == 3) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Router.neglect(
|
||||||
|
context,
|
||||||
|
() => NotificationRouteData().go(context),
|
||||||
|
);
|
||||||
|
//context.read<notificationViewModel>().getTenders();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
iconPath: AssetsManager.notify,
|
||||||
|
activeIconPath: AssetsManager.notifyActive,
|
||||||
|
),
|
||||||
|
SizedBox(width: 24),
|
||||||
|
_navigationItem(
|
||||||
|
context: context,
|
||||||
|
text: ProfileStrings.profileTitle,
|
||||||
|
isActive: currentIndex == 4,
|
||||||
|
onTap: () {
|
||||||
|
if (currentIndex == 4) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
Router.neglect(context, () => ProfileRouteData().go(context));
|
Router.neglect(context, () => ProfileRouteData().go(context));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
iconPath: AssetsManager.profile,
|
iconPath: AssetsManager.profile,
|
||||||
activeIconPath: AssetsManager.profileActive,
|
activeIconPath: AssetsManager.profileActive,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
Spacer(),
|
||||||
if (haveFilter)
|
if (haveFilter)
|
||||||
Builder(
|
Builder(
|
||||||
builder:
|
builder:
|
||||||
@@ -93,7 +133,7 @@ class DesktopNavigationWidget extends StatelessWidget
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 68),
|
SizedBox(width: 68),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -117,7 +157,7 @@ class DesktopNavigationWidget extends StatelessWidget
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset(isActive ? activeIconPath : iconPath),
|
SvgPicture.asset(isActive ? activeIconPath : iconPath),
|
||||||
const SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
text,
|
text,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
Reference in New Issue
Block a user