some refactors
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_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/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
||||
@@ -13,6 +11,7 @@ import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
||||
import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
|
||||
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../shared/tender_app_bar.dart';
|
||||
import '../strings/tender_details_strings.dart';
|
||||
|
||||
class TenderDetailTabletPage extends StatefulWidget {
|
||||
@@ -99,31 +98,11 @@ class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
|
||||
key: key,
|
||||
child: Scaffold(
|
||||
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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
appBar: tabletAppBar(
|
||||
title: TenderDetailsStrings.tenderDetailTitle,
|
||||
key: key,
|
||||
),
|
||||
|
||||
drawer: TabletNavigationWidget(
|
||||
currentIndex: 1, // Home is index 0
|
||||
onTabChanged: (index) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
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/routes/app_routes.dart';
|
||||
@@ -10,6 +9,7 @@ import 'package:tm_app/view_models/home_view_model.dart';
|
||||
import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../shared/tender_app_bar.dart';
|
||||
import '../strings/home_strings.dart';
|
||||
import '../widgets.dart';
|
||||
|
||||
@@ -23,31 +23,8 @@ class TabletHomePage extends StatelessWidget {
|
||||
return Scaffold(
|
||||
key: key,
|
||||
|
||||
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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
appBar: tabletAppBar(title: HomeStrings.home, key: key),
|
||||
|
||||
drawer: TabletNavigationWidget(
|
||||
currentIndex: 0, // Home is index 0
|
||||
onTabChanged: (index) {
|
||||
|
||||
@@ -10,6 +10,7 @@ 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 '../../shared/tender_app_bar.dart';
|
||||
import '../strings/profile_strings.dart';
|
||||
import '../widgets/theme_toggle.dart';
|
||||
import '../widgets/title_description.dart';
|
||||
@@ -72,31 +73,8 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
|
||||
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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
appBar: tabletAppBar(title: ProfileStrings.profileTitle, key: key),
|
||||
|
||||
drawer: TabletNavigationWidget(
|
||||
currentIndex: 2,
|
||||
onTabChanged: (index) {
|
||||
|
||||
@@ -60,3 +60,34 @@ PreferredSizeWidget appBar({
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget tabletAppBar({
|
||||
required String title,
|
||||
required GlobalKey<ScaffoldState> key,
|
||||
}) {
|
||||
return 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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
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/theme/colors.dart';
|
||||
@@ -8,9 +7,10 @@ import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
|
||||
import 'package:tm_app/views/tenders/widgets/main_tenders_slider.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/common_strings.dart';
|
||||
import '../../../core/routes/app_routes.dart';
|
||||
import '../../shared/tender_app_bar.dart';
|
||||
import '../strings/tenders_strings.dart';
|
||||
|
||||
class TabletTendersPage extends StatefulWidget {
|
||||
const TabletTendersPage({super.key});
|
||||
@@ -34,31 +34,7 @@ class _TabletTendersPageState extends State<TabletTendersPage> {
|
||||
return 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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
appBar: tabletAppBar(title: TendersStrings.tendersTitle, key: key),
|
||||
drawer: TabletNavigationWidget(
|
||||
currentIndex: 1,
|
||||
onTabChanged: (index) {
|
||||
|
||||
@@ -94,14 +94,16 @@ class _YourTendersDesktopPageState extends State<YourTendersDesktopPage>
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
|
||||
return TabBarView(
|
||||
controller: controller,
|
||||
children: [
|
||||
// ApprovedTenders(tendersSubmitted: []),
|
||||
TendersSubmitted(approvedTenders: viewModel.data!),
|
||||
],
|
||||
return TendersSubmitted(
|
||||
approvedTenders: viewModel.data!,
|
||||
);
|
||||
// return TabBarView(
|
||||
// controller: controller,
|
||||
// children: [
|
||||
// // ApprovedTenders(tendersSubmitted: []),
|
||||
|
||||
// ],
|
||||
// );
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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/routes/app_routes.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/your_tenders_view_model.dart';
|
||||
@@ -9,8 +9,9 @@ import 'package:tm_app/views/your_tenders/widgets/filter_button.dart';
|
||||
import 'package:tm_app/views/your_tenders/widgets/tablet_desktop_appbar.dart';
|
||||
import 'package:tm_app/views/your_tenders/widgets/tenders_submitted.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../shared/tablet_navigation_widget.dart';
|
||||
import '../../shared/tender_app_bar.dart';
|
||||
import '../strings/your_tenders_strings.dart';
|
||||
|
||||
class YourTendersTabletPage extends StatefulWidget {
|
||||
const YourTendersTabletPage({super.key});
|
||||
@@ -45,30 +46,9 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
|
||||
return 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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
appBar: tabletAppBar(
|
||||
title: YourTendersStrings.yourTendersTitle,
|
||||
key: key,
|
||||
),
|
||||
drawer: TabletNavigationWidget(
|
||||
currentIndex: 1, // Home is index 0
|
||||
@@ -76,14 +56,14 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
|
||||
// Handle navigation to other tabs
|
||||
switch (index) {
|
||||
case 0:
|
||||
Router.neglect(context, () => context.go('/home'));
|
||||
Router.neglect(context, () => HomeRouteData().go(context));
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
// Navigate to profile
|
||||
context.pop();
|
||||
Router.neglect(context, () => context.go('/profile'));
|
||||
Router.neglect(context, () => ProfileRouteData().go(context));
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -122,14 +102,7 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
|
||||
return TabBarView(
|
||||
controller: controller,
|
||||
children: [
|
||||
// ApprovedTenders(tendersSubmitted: []),
|
||||
TendersSubmitted(approvedTenders: viewModel.data!),
|
||||
],
|
||||
);
|
||||
return TendersSubmitted(approvedTenders: viewModel.data!);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -37,29 +37,33 @@ class FilterButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Mobile style: container with icon and text
|
||||
return InkWell(
|
||||
onTap: () => _openFilter(context),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.shade50,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.filter_list, color: Colors.blue),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: InkWell(
|
||||
onTap: () => _openFilter(context),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.shade50,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.filter_list, color: Colors.blue),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user