refactors on codes
This commit is contained in:
@@ -4,10 +4,10 @@ import 'package:tm_app/core/constants/tender_feedback.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';
|
||||
import 'package:tm_app/views/shared/tablet_desktop_appbar.dart';
|
||||
import 'package:tm_app/views/your_tenders/strings/your_tenders_strings.dart';
|
||||
import 'package:tm_app/views/your_tenders/widgets/filter_button.dart';
|
||||
import 'package:tm_app/views/your_tenders/widgets/liked_disliked_tenders_list.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 '../../shared/desktop_navigation_widget.dart';
|
||||
@@ -48,7 +48,9 @@ class _YourTendersDesktopPageState extends State<YourTendersDesktopPage>
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 64.0.h()),
|
||||
const TabletDesktopAppbar(),
|
||||
const TabletDesktopAppbar(
|
||||
title: YourTendersStrings.yourTenders,
|
||||
),
|
||||
SizedBox(height: 20.0.h()),
|
||||
const FilterButton(platformType: PlatformType.tabletDesktop),
|
||||
|
||||
@@ -106,103 +108,7 @@ class _YourTendersDesktopPageState extends State<YourTendersDesktopPage>
|
||||
Expanded(child: content),
|
||||
SizedBox(height: 10.0.h()),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
Text(
|
||||
YourTendersStrings.page,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0.sp(),
|
||||
fontWeight: FontWeight.w300,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.0.w()),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
final selectedPage = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor:
|
||||
AppColors.backgroundColor,
|
||||
title: const Text(
|
||||
YourTendersStrings.selectPage,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: 200.0.w(),
|
||||
height: 300.0.h(),
|
||||
child: ListView.builder(
|
||||
itemCount: viewModel.totalPages,
|
||||
itemBuilder: (context, index) {
|
||||
final pageNumber = index + 1;
|
||||
return ListTile(
|
||||
title: Text(
|
||||
'${YourTendersStrings.page} $pageNumber',
|
||||
),
|
||||
onTap:
|
||||
() => Navigator.pop(
|
||||
context,
|
||||
pageNumber,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedPage != null) {
|
||||
await viewModel.jumpToPage(selectedPage);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColors.grey30,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.currentPage}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
const Icon(Icons.arrow_drop_down),
|
||||
SizedBox(width: 5.0.w()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
YourTendersStrings.of,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.totalPages}',
|
||||
style: TextStyle(
|
||||
fontSize: 13.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_listPagesControll(context, viewModel),
|
||||
|
||||
SizedBox(height: 30.0.h()),
|
||||
],
|
||||
@@ -218,4 +124,95 @@ class _YourTendersDesktopPageState extends State<YourTendersDesktopPage>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _listPagesControll(
|
||||
BuildContext context,
|
||||
YourTendersViewModel viewModel,
|
||||
) {
|
||||
return Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
Text(
|
||||
YourTendersStrings.page,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0.sp(),
|
||||
fontWeight: FontWeight.w300,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.0.w()),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
final selectedPage = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
title: const Text(YourTendersStrings.selectPage),
|
||||
content: SizedBox(
|
||||
width: 200.0.w(),
|
||||
height: 300.0.h(),
|
||||
child: ListView.builder(
|
||||
itemCount: viewModel.totalPages,
|
||||
itemBuilder: (context, index) {
|
||||
final pageNumber = index + 1;
|
||||
return ListTile(
|
||||
title: Text('${YourTendersStrings.page} $pageNumber'),
|
||||
onTap: () => Navigator.pop(context, pageNumber),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedPage != null) {
|
||||
await viewModel.jumpToPage(selectedPage);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColors.grey30, width: 1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.currentPage}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
const Icon(Icons.arrow_drop_down),
|
||||
SizedBox(width: 5.0.w()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
YourTendersStrings.of,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.totalPages}',
|
||||
style: TextStyle(
|
||||
fontSize: 13.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ import 'package:provider/provider.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';
|
||||
import 'package:tm_app/views/shared/tablet_desktop_appbar.dart';
|
||||
import 'package:tm_app/views/your_tenders/widgets/filter_button.dart';
|
||||
import 'package:tm_app/views/your_tenders/widgets/liked_disliked_tenders_list.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/tender_feedback.dart';
|
||||
@@ -52,7 +52,9 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
|
||||
const SizedBox(height: 64.0),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
child: const TabletDesktopAppbar(),
|
||||
child: const TabletDesktopAppbar(
|
||||
title: YourTendersStrings.yourTenders,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
const FilterButton(platformType: PlatformType.tabletDesktop),
|
||||
@@ -111,103 +113,7 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
|
||||
Expanded(child: content),
|
||||
SizedBox(height: 10.0.h()),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
Text(
|
||||
YourTendersStrings.page,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.0.w()),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
final selectedPage = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor:
|
||||
AppColors.backgroundColor,
|
||||
title: const Text(
|
||||
YourTendersStrings.selectPage,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: 200.0.w(),
|
||||
height: 300.0.h(),
|
||||
child: ListView.builder(
|
||||
itemCount: viewModel.totalPages,
|
||||
itemBuilder: (context, index) {
|
||||
final pageNumber = index + 1;
|
||||
return ListTile(
|
||||
title: Text(
|
||||
'${YourTendersStrings.page} $pageNumber',
|
||||
),
|
||||
onTap:
|
||||
() => Navigator.pop(
|
||||
context,
|
||||
pageNumber,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedPage != null) {
|
||||
await viewModel.jumpToPage(selectedPage);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColors.grey30,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.currentPage}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
const Icon(Icons.arrow_drop_down),
|
||||
SizedBox(width: 5.0.w()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5.0),
|
||||
Text(
|
||||
YourTendersStrings.page,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.totalPages}',
|
||||
style: TextStyle(
|
||||
fontSize: 13.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_listPagesControll(context, viewModel),
|
||||
|
||||
const SizedBox(height: 30.0),
|
||||
],
|
||||
@@ -221,4 +127,95 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _listPagesControll(
|
||||
BuildContext context,
|
||||
YourTendersViewModel viewModel,
|
||||
) {
|
||||
return Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
Text(
|
||||
YourTendersStrings.page,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.0.w()),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
final selectedPage = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
title: const Text(YourTendersStrings.selectPage),
|
||||
content: SizedBox(
|
||||
width: 200.0.w(),
|
||||
height: 300.0.h(),
|
||||
child: ListView.builder(
|
||||
itemCount: viewModel.totalPages,
|
||||
itemBuilder: (context, index) {
|
||||
final pageNumber = index + 1;
|
||||
return ListTile(
|
||||
title: Text('${YourTendersStrings.page} $pageNumber'),
|
||||
onTap: () => Navigator.pop(context, pageNumber),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedPage != null) {
|
||||
await viewModel.jumpToPage(selectedPage);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColors.grey30, width: 1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.currentPage}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
const Icon(Icons.arrow_drop_down),
|
||||
SizedBox(width: 5.0.w()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5.0),
|
||||
Text(
|
||||
YourTendersStrings.page,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.0.w()),
|
||||
Text(
|
||||
'${viewModel.totalPages}',
|
||||
style: TextStyle(
|
||||
fontSize: 13.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user