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.
HMG_Patient_App/lib/new_ui/exception_widget/ExceptionBottomSheet.dart

127 lines
5.3 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils.dart';
import 'package:hmg_patient_app/uitl/font_utils.dart';
import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';
import '../../theme/colors.dart';
import '../otp/otp_validation_bootmsheet_widget.dart';
class ExceptionBottomSheet extends StatefulWidget {
String message;
bool showOKButton;
bool showCancel;
Function() onOkPressed;
Function()? onCancelPressed;
ExceptionBottomSheet({Key? key, required this.message, this.showOKButton = true, this.showCancel = false, required this.onOkPressed, this.onCancelPressed}) : super(key: key);
@override
_ExceptionBottomSheetState createState() => _ExceptionBottomSheetState();
}
class _ExceptionBottomSheetState extends State<ExceptionBottomSheet> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return SafeArea(
bottom: Platform.isIOS ? false : true, // Adjust for iOS to avoid bottom padding
child: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus(); // Dismiss the keyboard when tapping outside
},
child: Builder(builder: (context) {
return Directionality(
textDirection: Directionality.of(context),
child: Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Color(0xFFF8F8FA),
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(TranslationBase.of(context).notice, fontSize: 28, letterSpacing: -2, color: Color(0xFF2E3039), fontWeight: FontWeight.w600),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: SvgPicture.asset("assets/images/svg/cross-circle.svg", width: 24, height: 24)),
],
),
const SizedBox(height: 10),
AppText(widget.message ?? "", fontSize: 16, color: Color(0xFF2E3039), fontWeight: FontWeight.w500),
const SizedBox(height: 10),
SizedBox(height: 24),
if (widget.showOKButton && widget.showCancel)
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 8),
child: CustomButton(
text: TranslationBase.of(context).cancel,
onPressed: widget.onCancelPressed != null
? widget.onCancelPressed!
: () {
Navigator.of(context).pop();
},
backgroundColor: CustomColors.bgRedLightColor,
borderColor: CustomColors.bgRedLightColor,
textColor: CustomColors.bgRedColor,
icon: "assets/images/svg/cancel.svg",
),
),
),
SizedBox(
width: 16,
),
Expanded(
child: CustomButton(
text: widget.showCancel ? TranslationBase.of(context).confirm : TranslationBase.of(context).ok,
onPressed: widget.onOkPressed,
backgroundColor: CustomColors.bgRedColor,
borderColor: CustomColors.bgRedBorderColor,
textColor: Colors.white,
icon: "assets/images/svg/confirm.svg",
),
),
],
),
if (widget.showOKButton && !widget.showCancel)
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: TranslationBase.of(context).ok,
onPressed: widget.onOkPressed,
backgroundColor: CustomColors.bgRedColor,
borderColor: CustomColors.bgRedBorderColor,
textColor: Colors.white,
icon: "assets/images/svg/confirm.svg",
),
),
],
),
),
);
}),
),
);
}
}