refactor in notification and liked tenders page
This commit is contained in:
@@ -6,10 +6,11 @@ import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/data/services/model/tender_approvals_data/tender_approvals_data.dart';
|
||||
import 'package:tm_app/view_models/liked_tenders_view_model.dart';
|
||||
import 'package:tm_app/views/liked_tenders/widgets/liked_tenders_filter_drawer.dart';
|
||||
import 'package:tm_app/views/liked_tenders/widgets/liked_tenders_list_item.dart';
|
||||
import 'package:tm_app/views/shared/page_selection_dialog.dart';
|
||||
|
||||
import '../../../core/utils/app_toast.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
import '../../shared/desktop_navigation_widget.dart';
|
||||
import '../strings/liked_tenders_strings.dart';
|
||||
|
||||
@@ -54,46 +55,7 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
endDrawer: Drawer(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 30.0.h()),
|
||||
Text(
|
||||
LikedTendersStrings.filter,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
fontSize: 20.0.sp(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.0.h()),
|
||||
_buildFilterOption('Industry'),
|
||||
_buildFilterOption('Finance'),
|
||||
_buildFilterOption('Business'),
|
||||
_buildFilterOption('IT'),
|
||||
_buildFilterOption('Software'),
|
||||
const Spacer(),
|
||||
BaseButton(
|
||||
backgroundColor: AppColors.primary2,
|
||||
borderRadius: 24,
|
||||
isEnabled: true,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
text: LikedTendersStrings.apply,
|
||||
textColor: AppColors.textBlue,
|
||||
),
|
||||
SizedBox(height: 20.0.h()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
endDrawer: const LikedTendersFilterDrawer(isTablet: false,),
|
||||
body: Column(
|
||||
children: [
|
||||
const DesktopNavigationWidget(currentIndex: 1, haveFilter: true),
|
||||
@@ -198,35 +160,10 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
|
||||
onTap: () async {
|
||||
final selectedPage = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor:
|
||||
AppColors.backgroundColor,
|
||||
title: const Text(
|
||||
LikedTendersStrings.selectPage,
|
||||
builder:
|
||||
(context) => PageSelectionDialog(
|
||||
totalPages: totalPages,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: 200,
|
||||
height: 300,
|
||||
child: ListView.builder(
|
||||
itemCount: totalPages,
|
||||
itemBuilder: (context, index) {
|
||||
final pageNumber = index + 1;
|
||||
return ListTile(
|
||||
title: Text(
|
||||
'${LikedTendersStrings.page} $pageNumber',
|
||||
),
|
||||
onTap:
|
||||
() => Navigator.pop(
|
||||
context,
|
||||
pageNumber,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedPage != null) {
|
||||
@@ -295,21 +232,4 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildFilterOption(String title) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8.0.h()),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
color: AppColors.grey80,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,9 @@ import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/liked_tenders_view_model.dart';
|
||||
import 'package:tm_app/views/liked_tenders/strings/liked_tenders_strings.dart';
|
||||
import 'package:tm_app/views/liked_tenders/widgets/liked_tenders_filter_drawer.dart';
|
||||
import 'package:tm_app/views/liked_tenders/widgets/liked_tenders_list_item.dart';
|
||||
import 'package:tm_app/views/shared/base_button.dart';
|
||||
import 'package:tm_app/views/shared/page_selection_dialog.dart';
|
||||
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
||||
|
||||
import '../../../core/utils/app_toast.dart';
|
||||
@@ -176,66 +177,7 @@ class _LikedTendersTabletPageState extends State<LikedTendersTabletPage> {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: SvgPicture.asset(
|
||||
AssetsManager.filter,
|
||||
height: 24.0.w(),
|
||||
width: 24.0.w(),
|
||||
),
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(20),
|
||||
),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width,
|
||||
maxHeight: MediaQuery.of(context).size.height,
|
||||
),
|
||||
builder: (context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 10.0.h()),
|
||||
Text(
|
||||
LikedTendersStrings.filter,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
fontSize: 20.0.sp(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.0.h()),
|
||||
_buildFilterOption('Industry'),
|
||||
_buildFilterOption('Finance'),
|
||||
_buildFilterOption('Business'),
|
||||
_buildFilterOption('IT'),
|
||||
_buildFilterOption('Software'),
|
||||
SizedBox(height: 20.0.h()),
|
||||
BaseButton(
|
||||
backgroundColor: AppColors.primary2,
|
||||
borderRadius: 24,
|
||||
isEnabled: true,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
text: 'Apply',
|
||||
textColor: AppColors.textBlue,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
const LikedTendersFilterDrawer(isTablet: true,),
|
||||
SizedBox(width: 16.0.w()),
|
||||
],
|
||||
),
|
||||
@@ -347,35 +289,10 @@ class _LikedTendersTabletPageState extends State<LikedTendersTabletPage> {
|
||||
onTap: () async {
|
||||
final selectedPage = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor:
|
||||
AppColors.backgroundColor,
|
||||
title: const Text(
|
||||
LikedTendersStrings.selectPage,
|
||||
builder:
|
||||
(context) => PageSelectionDialog(
|
||||
totalPages: totalPages,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: 200,
|
||||
height: 300,
|
||||
child: ListView.builder(
|
||||
itemCount: totalPages,
|
||||
itemBuilder: (context, index) {
|
||||
final pageNumber = index + 1;
|
||||
return ListTile(
|
||||
title: Text(
|
||||
'${LikedTendersStrings.page} $pageNumber',
|
||||
),
|
||||
onTap:
|
||||
() => Navigator.pop(
|
||||
context,
|
||||
pageNumber,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedPage != null) {
|
||||
@@ -448,19 +365,3 @@ class _LikedTendersTabletPageState extends State<LikedTendersTabletPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildFilterOption(String title) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8.0.h()),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
color: AppColors.grey80,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.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/views/liked_tenders/strings/liked_tenders_strings.dart';
|
||||
|
||||
import '../../shared/base_button.dart';
|
||||
|
||||
class LikedTendersFilterDrawer extends StatelessWidget {
|
||||
const LikedTendersFilterDrawer({required this.isTablet, super.key});
|
||||
|
||||
final bool isTablet;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return isTablet
|
||||
? IconButton(
|
||||
icon: SvgPicture.asset(
|
||||
AssetsManager.filter,
|
||||
height: 24.0.w(),
|
||||
width: 24.0.w(),
|
||||
),
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width,
|
||||
maxHeight: MediaQuery.of(context).size.height,
|
||||
),
|
||||
builder: (context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 10.0.h()),
|
||||
Text(
|
||||
LikedTendersStrings.filter,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
fontSize: 20.0.sp(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.0.h()),
|
||||
_buildFilterOption('Industry'),
|
||||
_buildFilterOption('Finance'),
|
||||
_buildFilterOption('Business'),
|
||||
_buildFilterOption('IT'),
|
||||
_buildFilterOption('Software'),
|
||||
SizedBox(height: 20.0.h()),
|
||||
BaseButton(
|
||||
backgroundColor: AppColors.primary2,
|
||||
borderRadius: 24,
|
||||
isEnabled: true,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
text: 'Apply',
|
||||
textColor: AppColors.textBlue,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: Drawer(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 30.0.h()),
|
||||
Text(
|
||||
LikedTendersStrings.filter,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
fontSize: 20.0.sp(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.0.h()),
|
||||
|
||||
_buildFilterOption('Industry'),
|
||||
_buildFilterOption('Finance'),
|
||||
_buildFilterOption('Business'),
|
||||
_buildFilterOption('IT'),
|
||||
_buildFilterOption('Software'),
|
||||
|
||||
const Spacer(),
|
||||
|
||||
BaseButton(
|
||||
backgroundColor: AppColors.primary2,
|
||||
borderRadius: 24,
|
||||
isEnabled: true,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
text: LikedTendersStrings.apply,
|
||||
textColor: AppColors.textBlue,
|
||||
),
|
||||
|
||||
SizedBox(height: 20.0.h()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFilterOption(String title) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8.0.h()),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
color: AppColors.grey80,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user