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:
@@ -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 '../../../data/services/model/tender_data/tender_data.dart';
|
||||
import '../../shared/select_submission_dialog.dart';
|
||||
|
||||
class TenderDetailActions extends StatelessWidget {
|
||||
final bool isScreenBig;
|
||||
@@ -161,12 +162,11 @@ class TenderDetailActions extends StatelessWidget {
|
||||
submissionMode: 'self-apply',
|
||||
);
|
||||
} else {
|
||||
showModalBottomSheet(
|
||||
isDismissible: true,
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectSubmissionBottomSheet(
|
||||
onConfirm: (value) {
|
||||
return SelectSubmissionDialog(
|
||||
onConfirm: (String value) {
|
||||
viewModel.submitTenderApproval(
|
||||
tenderId: detail.id!,
|
||||
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/utils/size_config.dart';
|
||||
import '../../shared/select_submission_bottom_sheet.dart';
|
||||
import '../../shared/select_submission_dialog.dart';
|
||||
|
||||
class TenderActionButtonsRow extends StatelessWidget {
|
||||
final TenderData tender;
|
||||
@@ -122,21 +123,39 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
status: 'submitted',
|
||||
);
|
||||
} else {
|
||||
showModalBottomSheet(
|
||||
isDismissible: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectSubmissionBottomSheet(
|
||||
onConfirm: (value) {
|
||||
viewModel.toggleApprovals(
|
||||
tenderId: tender.id!,
|
||||
submissionMode: value,
|
||||
status: 'submitted',
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
final isMobile = MediaQuery.sizeOf(context).width < 600;
|
||||
if (isMobile) {
|
||||
showModalBottomSheet(
|
||||
isDismissible: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectSubmissionBottomSheet(
|
||||
onConfirm: (value) {
|
||||
viewModel.toggleApprovals(
|
||||
tenderId: tender.id!,
|
||||
submissionMode: value,
|
||||
status: 'submitted',
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectSubmissionDialog(
|
||||
onConfirm: (String value) {
|
||||
viewModel.toggleApprovals(
|
||||
tenderId: tender.id!,
|
||||
submissionMode: value,
|
||||
status: 'submitted',
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user