tablet navigation bar fixed
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:tm_app/core/constants/assets.dart';
|
||||
import 'package:tm_app/core/constants/strings.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
|
||||
class TabletShellPage extends StatelessWidget {
|
||||
TabletShellPage({
|
||||
const TabletShellPage({
|
||||
required this.navigationShell,
|
||||
required this.onTap,
|
||||
super.key,
|
||||
@@ -16,106 +11,8 @@ class TabletShellPage extends StatelessWidget {
|
||||
final StatefulNavigationShell navigationShell;
|
||||
final ValueChanged<int> onTap;
|
||||
|
||||
final GlobalKey<ScaffoldState> _key = GlobalKey();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
key: _key,
|
||||
body: Stack(
|
||||
children: [
|
||||
navigationShell,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 64.0.h(),
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.backgroundColor,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColors.grey30, width: 1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SvgPicture.asset(AssetsManager.logoSmall),
|
||||
InkWell(
|
||||
onTap: () => _key.currentState!.openDrawer(),
|
||||
child: SvgPicture.asset(AssetsManager.menu),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
drawer: Container(
|
||||
width: 200.0.w(),
|
||||
height: double.infinity,
|
||||
color: AppColors.backgroundColor,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 48.0.h()),
|
||||
_drawerItem(
|
||||
context: context,
|
||||
text: AppStrings.home,
|
||||
isActive: navigationShell.currentIndex == 0,
|
||||
onTap: () => onTap(0),
|
||||
iconPath: AssetsManager.home,
|
||||
activeIconPath: AssetsManager.homeActive,
|
||||
),
|
||||
_drawerItem(
|
||||
context: context,
|
||||
text: AppStrings.tendersTitle,
|
||||
isActive: navigationShell.currentIndex == 1,
|
||||
onTap: () => onTap(1),
|
||||
iconPath: AssetsManager.tenders,
|
||||
activeIconPath: AssetsManager.tendersActive,
|
||||
),
|
||||
_drawerItem(
|
||||
context: context,
|
||||
text: AppStrings.profile,
|
||||
isActive: navigationShell.currentIndex == 2,
|
||||
onTap: () => onTap(2),
|
||||
iconPath: AssetsManager.profile,
|
||||
activeIconPath: AssetsManager.profileActive,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _drawerItem({
|
||||
required BuildContext context,
|
||||
required String text,
|
||||
required bool isActive,
|
||||
required VoidCallback onTap,
|
||||
required String iconPath,
|
||||
required String activeIconPath,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: 200.0.w(),
|
||||
height: 64.0.h(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.only(start: 24.0.w()),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(isActive ? activeIconPath : iconPath),
|
||||
SizedBox(width: 8.0.w()),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: isActive ? AppColors.primaryColor : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return Scaffold(body: navigationShell);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user