check and fix in ui

This commit is contained in:
amirrezaghabeli
2025-08-10 16:05:03 +03:30
parent 55d7d96baf
commit 9ea9480818
35 changed files with 1066 additions and 416 deletions
+2
View File
@@ -6,6 +6,7 @@ import 'package:tm_app/data/repositories/tender_detail_repository.dart';
import 'package:tm_app/data/services/home_service.dart';
import 'package:tm_app/data/services/tender_detail_service.dart';
import 'package:tm_app/view_models/tender_detail_view_model.dart';
import 'package:tm_app/view_models/tenders_view_model.dart';
import '../../data/repositories/auth_repository.dart';
import '../../data/services/auth_service.dart';
@@ -59,6 +60,7 @@ List<SingleChildWidget> get viewModels {
(context) =>
TenderDetailViewModel(tenderDetailRepository: context.read()),
),
ChangeNotifierProvider(create: (context) => TendersViewModel()),
];
}
+8
View File
@@ -3,6 +3,11 @@ class AssetsManager {
//bottom navigation
static const homeActive = 'assets/icons/home_active.svg';
static const home = 'assets/icons/home.svg';
static const tenders = 'assets/icons/task_square.svg';
static const tendersActive = 'assets/icons/task-square_active.svg';
static const profile = 'assets/icons/profile-circle.svg';
static const profileActive = 'assets/icons/profile-circle_active.svg';
// login page
static const logo = 'assets/pngs/logo.png';
@@ -30,6 +35,9 @@ class AssetsManager {
static const shield = 'assets/icons/shield.svg';
static const edit = 'assets/icons/edit.svg';
static const arrowRight = 'assets/icons/arrow-right.svg';
static const notification = 'assets/icons/notification.svg';
static const calendar = 'assets/icons/calendar.svg';
static const menu = 'assets/icons/menu.svg';
//your tenders page
static const tickCircle = 'assets/icons/tick-circle.svg';
+1
View File
@@ -32,6 +32,7 @@ class AppStrings {
static const String tenderValue = 'Tender Value';
static const String thunderStatus = 'Thunder status';
static const String yourTenders = 'Your tenders';
static const String welcome = 'Welcome';
//Tenders
static const String tendersTitle = 'Tenders';
+3 -3
View File
@@ -4,10 +4,10 @@ import 'package:tm_app/views/detail/pages/detail_screen.dart';
import 'package:tm_app/views/home/pages/home_screen.dart';
import 'package:tm_app/views/login/pages/login_screen.dart';
import '../../views/profile/profile_screen.dart';
import '../../views/tenders/tenders_screen.dart';
import '../../views/profile/pages/profile_screen.dart';
import '../../views/tenders/pages/tenders_screen.dart';
import '../../views/your_tenders/your_tenders_screen.dart';
import 'app_shell_screen.dart';
import 'app_shell/app_shell_screen.dart';
part 'app_routes.g.dart';
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:tm_app/core/routes/app_shell/desktop_shell_page.dart';
import 'package:tm_app/core/routes/app_shell/mobile_shell_page.dart';
import 'package:tm_app/core/routes/app_shell/tablet_shell_page.dart';
import 'package:tm_app/views/shared/responsive_builder.dart';
class AppShellScreen extends StatelessWidget {
const AppShellScreen({required this.navigationShell, super.key});
final StatefulNavigationShell navigationShell;
void _gotoBranch(int index) {
navigationShell.goBranch(
index,
initialLocation: index == navigationShell.currentIndex,
);
}
@override
Widget build(BuildContext context) {
return ResponsiveBuilder(
mobile: MobileShellPage(
navigationShell: navigationShell,
onTap: _gotoBranch,
),
tablet: TabletShellPage(
navigationShell: navigationShell,
onTap: _gotoBranch,
),
desktop: DesktopShellPage(
navigationShell: navigationShell,
onTap: _gotoBranch,
),
);
}
}
@@ -0,0 +1,109 @@
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/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
class DesktopShellPage extends StatelessWidget {
const DesktopShellPage({
required this.navigationShell,
required this.onTap,
super.key,
});
final StatefulNavigationShell navigationShell;
final ValueChanged<int> onTap;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [_navigationBar(context), Expanded(child: navigationShell)],
),
);
}
Container _navigationBar(BuildContext context) {
return Container(
height: 64,
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: AppColors.grey30)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(width: 40),
Image.asset(AssetsManager.logo, width: 59, height: 28),
Spacer(),
_bottomNavigationItem(
context: context,
text: 'Home',
isActive: navigationShell.currentIndex == 0,
onTap: () => onTap(0),
iconPath: 'assets/icons/home.svg',
activeIconPath: AssetsManager.homeActive,
),
SizedBox(width: 24),
_bottomNavigationItem(
context: context,
text: 'Tenders',
isActive: navigationShell.currentIndex == 1,
onTap: () => onTap(1),
iconPath: 'assets/icons/task_square.svg',
activeIconPath: 'assets/icons/task-square_active.svg',
),
SizedBox(width: 24),
_bottomNavigationItem(
context: context,
text: 'Profile',
isActive: navigationShell.currentIndex == 2,
onTap: () => onTap(2),
iconPath: 'assets/icons/profile-circle.svg',
activeIconPath: 'assets/icons/profile-circle_active.svg',
),
Spacer(),
SizedBox(width: 59),
],
),
);
}
Widget _bottomNavigationItem({
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,
height: 64,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset(isActive ? activeIconPath : iconPath),
SizedBox(width: 8),
Text(
text,
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
color:
isActive
? const Color(0xFF0164FF)
: const Color(0xFF777777),
),
),
],
),
),
);
}
}
@@ -1,27 +1,22 @@
// Shell screen with bottom navigation
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/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
import '../constants/assets.dart';
import '../theme/colors.dart';
import '../utils/size_config.dart';
class AppShellScreen extends StatelessWidget {
const AppShellScreen({required this.navigationShell, super.key});
class MobileShellPage extends StatelessWidget {
const MobileShellPage({
required this.navigationShell,
required this.onTap,
super.key,
});
final StatefulNavigationShell navigationShell;
void _gotoBranch(int index) {
navigationShell.goBranch(
index,
initialLocation: index == navigationShell.currentIndex,
);
}
final ValueChanged<int> onTap;
@override
Widget build(BuildContext context) {
SizeConfig.init(context);
return Scaffold(
body: navigationShell,
bottomNavigationBar: Container(
@@ -37,7 +32,7 @@ class AppShellScreen extends StatelessWidget {
context: context,
text: 'Home',
isActive: navigationShell.currentIndex == 0,
onTap: () => _gotoBranch(0),
onTap: () => onTap(0),
iconPath: 'assets/icons/home.svg',
activeIconPath: AssetsManager.homeActive,
),
@@ -45,7 +40,7 @@ class AppShellScreen extends StatelessWidget {
context: context,
text: 'Tenders',
isActive: navigationShell.currentIndex == 1,
onTap: () => _gotoBranch(1),
onTap: () => onTap(1),
iconPath: 'assets/icons/task_square.svg',
activeIconPath: 'assets/icons/task-square_active.svg',
),
@@ -53,7 +48,7 @@ class AppShellScreen extends StatelessWidget {
context: context,
text: 'Profile',
isActive: navigationShell.currentIndex == 2,
onTap: () => _gotoBranch(2),
onTap: () => onTap(2),
iconPath: 'assets/icons/profile-circle.svg',
activeIconPath: 'assets/icons/profile-circle_active.svg',
),
@@ -0,0 +1,126 @@
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/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
class TabletShellPage extends StatelessWidget {
TabletShellPage({
required this.navigationShell,
required this.onTap,
super.key,
});
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(
border: Border(
bottom: BorderSide(color: AppColors.grey30, width: 1),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
AssetsManager.logo,
width: 59.0.w(),
height: 28.0.h(),
),
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: 'Home',
isActive: navigationShell.currentIndex == 0,
onTap: () => onTap(0),
iconPath: AssetsManager.home,
activeIconPath: AssetsManager.homeActive,
),
_drawerItem(
context: context,
text: 'Tenders',
isActive: navigationShell.currentIndex == 1,
onTap: () => onTap(1),
iconPath: AssetsManager.tenders,
activeIconPath: AssetsManager.tendersActive,
),
_drawerItem(
context: context,
text: '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
? const Color(0xFF0164FF)
: const Color(0xFF777777),
),
),
],
),
),
),
);
}
}
+2 -1
View File
@@ -3,7 +3,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'colors.dart';
class ThemeProvider extends ChangeNotifier {
class ThemeProvider with ChangeNotifier {
static const String _themeKey = 'theme_mode';
static BuildContext? _context;
@@ -40,6 +40,7 @@ class ThemeProvider extends ChangeNotifier {
// Notify listeners after loading
notifyListeners();
_rebuildAllChildren();
}
Future<void> toggleTheme() async {