Commit d9d17121 authored by Dio Maulana's avatar Dio Maulana

modal dialog global

parent 00c8153b
import 'package:flutter/material.dart';
import 'package:tour_travel_agr/helper/components_widget/widget_button.dart';
import 'package:tour_travel_agr/resource/font.dart';
import 'package:tour_travel_agr/resource/style.dart';
Future<dynamic> modalDialogGlobal({
required BuildContext context,
Size? size,
required String title,
required String contentBody,
required String buttonText,
required void Function() tapButton,
bool isActiveCancelButton = false,
bool isCustomSecondButton = false,
String customSecondButtonText = '',
Widget? navigateToCustomButton,
}) async {
return showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext ctxDialog) => AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15))),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: getBoldStyle(
color: Colors.black,
fontFamily: FontConstants.inter,
fontSize: FontSize.s24,
),
),
const SizedBox(
height: 16,
),
Text(
contentBody,
style: getMediumStyle(
color: Colors.black,
fontFamily: FontConstants.openSans,
fontSize: FontSize.s16,
),
),
const SizedBox(
height: 42,
),
InkWell(
onTap: () {
tapButton();
},
child: CustomButton(
text: buttonText,
),
),
(isActiveCancelButton)
? InkWell(
onTap: () {
Navigator.pop(context);
},
child: const CustomButton(
text: "Cancel",
colorButton: Colors.transparent,
colorText: Colors.black,
),
)
: const SizedBox(),
(isCustomSecondButton)
? Column(
children: [
const SizedBox(
height: 10,
),
InkWell(
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => navigateToCustomButton!),
);
},
child: CustomButton(
text: customSecondButtonText,
),
),
],
)
: const SizedBox()
],
),
),
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment