You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
4.5 KiB
Dart
106 lines
4.5 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:tangheem/classes/colors.dart';
|
|
import 'package:tangheem/extensions/int_extensions.dart';
|
|
import 'package:tangheem/extensions/string_extensions.dart';
|
|
import 'package:tangheem/extensions/widget_extensions.dart';
|
|
|
|
class GeneralDialog extends StatelessWidget {
|
|
final String message;
|
|
final String buttonTitle;
|
|
final VoidCallback onTap;
|
|
final bool showCancelButton;
|
|
final Color backgroundColor;
|
|
final Color buttonBorderColor;
|
|
|
|
GeneralDialog({Key key, this.message, this.buttonTitle, this.onTap, this.showCancelButton = false, this.backgroundColor,this.buttonBorderColor}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
|
|
child: Dialog(
|
|
insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(25),
|
|
),
|
|
elevation: 0,
|
|
backgroundColor: Colors.transparent,
|
|
child: Stack(
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 239 / 375,
|
|
decoration: BoxDecoration(
|
|
color: backgroundColor ?? ColorConsts.brownLightColor.withOpacity(0.60),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
padding: EdgeInsets.symmetric(vertical: 24, horizontal: 16),
|
|
margin: EdgeInsets.only(top: 11),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
(message ?? "للحصول على تجربة أفضل ، يرجى إمالة هاتفك واستخدام التطبيق في الوضع الأفقي").toText(17, textAlign: TextAlign.center, height: 22),
|
|
18.height,
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (showCancelButton)
|
|
Expanded(
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
height: 36,
|
|
child: TextButton(
|
|
onPressed: () => Navigator.pop(context),
|
|
style: TextButton.styleFrom(
|
|
primary: Colors.black87,
|
|
padding: EdgeInsets.all(2),
|
|
backgroundColor: ColorConsts.textHintGrey,
|
|
textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(6.0),
|
|
),
|
|
),
|
|
child: Text("لا"),
|
|
),
|
|
),
|
|
),
|
|
if (showCancelButton) SizedBox(width: 16),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 36,
|
|
child: TextButton(
|
|
onPressed: onTap ?? () => Navigator.pop(context),
|
|
style: TextButton.styleFrom(
|
|
// primary: Colors.white,
|
|
padding: EdgeInsets.all(0),
|
|
backgroundColor: Colors.transparent,
|
|
textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25.0), side: BorderSide(color: buttonBorderColor ?? Colors.white, width: 2)),
|
|
),
|
|
child: (buttonTitle ?? "تأكيد").toText(14),
|
|
),
|
|
).paddingOnly(left: 50, right: 50).expanded,
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 22,
|
|
width: 22,
|
|
margin: EdgeInsets.only(left: 16),
|
|
decoration: BoxDecoration(shape: BoxShape.circle, color: ColorConsts.brownLightColor),
|
|
child: Icon(
|
|
Icons.clear,
|
|
size: 16,
|
|
color: Colors.white,
|
|
),
|
|
).onPress(() => Navigator.pop(context)),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|