Merge pull request 'submission dialog for tablet and web' (#72) from submission_dialog into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/72
This commit is contained in:
@@ -51,5 +51,6 @@ class AuthService {
|
|||||||
Future<void> localLogout() async {
|
Future<void> localLogout() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.remove('bearer');
|
await prefs.remove('bearer');
|
||||||
|
await prefs.remove('refresh_token');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:tm_app/views/shared/base_button.dart';
|
|||||||
import 'package:tm_app/views/shared/select_submission_bottom_sheet.dart';
|
import 'package:tm_app/views/shared/select_submission_bottom_sheet.dart';
|
||||||
|
|
||||||
import '../../../data/services/model/tender_data/tender_data.dart';
|
import '../../../data/services/model/tender_data/tender_data.dart';
|
||||||
|
import '../../shared/select_submission_dialog.dart';
|
||||||
|
|
||||||
class TenderDetailActions extends StatelessWidget {
|
class TenderDetailActions extends StatelessWidget {
|
||||||
final bool isScreenBig;
|
final bool isScreenBig;
|
||||||
@@ -161,12 +162,11 @@ class TenderDetailActions extends StatelessWidget {
|
|||||||
submissionMode: 'self-apply',
|
submissionMode: 'self-apply',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showModalBottomSheet(
|
showDialog(
|
||||||
isDismissible: true,
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return SelectSubmissionBottomSheet(
|
return SelectSubmissionDialog(
|
||||||
onConfirm: (value) {
|
onConfirm: (String value) {
|
||||||
viewModel.submitTenderApproval(
|
viewModel.submitTenderApproval(
|
||||||
tenderId: detail.id!,
|
tenderId: detail.id!,
|
||||||
submissionMode: value,
|
submissionMode: value,
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
|
|
||||||
|
import '../../core/theme/colors.dart';
|
||||||
|
|
||||||
|
class SelectSubmissionDialog extends StatefulWidget {
|
||||||
|
const SelectSubmissionDialog({required this.onConfirm, super.key});
|
||||||
|
final ValueChanged<String> onConfirm;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SelectSubmissionDialog> createState() => _SelectSubmissionDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectSubmissionDialogState extends State<SelectSubmissionDialog> {
|
||||||
|
int selectedType = 0;
|
||||||
|
String type = 'self-apply';
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Dialog(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
side: BorderSide.none,
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
width: 560,
|
||||||
|
height: 300,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w(), vertical: 16.0.h()),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Select Submission',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.0.sp(),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColors.grey70,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
_submissionType(
|
||||||
|
title: 'self-apply',
|
||||||
|
isSelected: type == 'self-apply',
|
||||||
|
onTap: () {
|
||||||
|
selectedType = 0;
|
||||||
|
type = 'self-apply';
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
_submissionType(
|
||||||
|
title: 'Partnership',
|
||||||
|
isSelected: type == 'partnership',
|
||||||
|
onTap: () {
|
||||||
|
selectedType = 1;
|
||||||
|
type = 'partnership';
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onConfirm(type);
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 150,
|
||||||
|
height: 56.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.primary20,
|
||||||
|
borderRadius: BorderRadius.circular(100),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Confirm',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0.sp(),
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColors.mainBlue,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _submissionType({
|
||||||
|
required VoidCallback onTap,
|
||||||
|
required String title,
|
||||||
|
required bool isSelected,
|
||||||
|
}) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: onTap,
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 56.0.h(),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 20.0.w(),
|
||||||
|
height: 20.0.w(),
|
||||||
|
margin: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0.w(),
|
||||||
|
vertical: 10.0.h(),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(3),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: isSelected ? AppColors.mainBlue : AppColors.grey70,
|
||||||
|
width: 2.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: isSelected ? AppColors.mainBlue : Colors.transparent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0.sp(),
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: AppColors.grey80,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import '../../../core/constants/assets.dart';
|
|||||||
import '../../../core/theme/colors.dart';
|
import '../../../core/theme/colors.dart';
|
||||||
import '../../../core/utils/size_config.dart';
|
import '../../../core/utils/size_config.dart';
|
||||||
import '../../shared/select_submission_bottom_sheet.dart';
|
import '../../shared/select_submission_bottom_sheet.dart';
|
||||||
|
import '../../shared/select_submission_dialog.dart';
|
||||||
|
|
||||||
class TenderActionButtonsRow extends StatelessWidget {
|
class TenderActionButtonsRow extends StatelessWidget {
|
||||||
final TenderData tender;
|
final TenderData tender;
|
||||||
@@ -122,6 +123,8 @@ class TenderActionButtonsRow extends StatelessWidget {
|
|||||||
status: 'submitted',
|
status: 'submitted',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
final isMobile = MediaQuery.sizeOf(context).width < 600;
|
||||||
|
if (isMobile) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
isDismissible: true,
|
isDismissible: true,
|
||||||
context: context,
|
context: context,
|
||||||
@@ -137,6 +140,22 @@ class TenderActionButtonsRow extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return SelectSubmissionDialog(
|
||||||
|
onConfirm: (String value) {
|
||||||
|
viewModel.toggleApprovals(
|
||||||
|
tenderId: tender.id!,
|
||||||
|
submissionMode: value,
|
||||||
|
status: 'submitted',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
Reference in New Issue
Block a user