8 changed files with 224 additions and 23 deletions
-
4lib/core/widgets/dialog/about_us_dialog.dart
-
103lib/core/widgets/dialog/exit_dialog.dart
-
4lib/core/widgets/dialog/hadith_dialog.dart
-
11lib/core/widgets/dialog/styles/dialog_background.dart
-
81lib/core/widgets/dialog/styles/dialog_button.dart
-
8lib/features/home/presentation/bloc/home_bloc.dart
-
34lib/features/home/presentation/ui/home_page.dart
-
2lib/features/question/presentation/bloc/question_bloc.dart
@ -0,0 +1,103 @@ |
|||
import 'dart:ui'; |
|||
|
|||
import 'package:flutter/material.dart'; |
|||
import 'package:flutter/services.dart'; |
|||
import 'package:go_router/go_router.dart'; |
|||
import 'package:hadi_hoda_flutter/common_ui/resources/my_colors.dart'; |
|||
import 'package:hadi_hoda_flutter/common_ui/resources/my_spaces.dart'; |
|||
import 'package:hadi_hoda_flutter/common_ui/resources/my_text_style.dart'; |
|||
import 'package:hadi_hoda_flutter/core/utils/set_platform_size.dart'; |
|||
import 'package:hadi_hoda_flutter/core/widgets/dialog/styles/dialog_background.dart'; |
|||
import 'package:hadi_hoda_flutter/core/widgets/dialog/styles/dialog_button.dart'; |
|||
|
|||
Future<void> showExitDialog({required BuildContext context}) async { |
|||
await showDialog( |
|||
context: context, |
|||
builder: (context) => ExitDialog(), |
|||
barrierColor: MyColors.purple.withValues(alpha: 0.82), |
|||
useSafeArea: false, |
|||
); |
|||
} |
|||
|
|||
class ExitDialog extends StatelessWidget { |
|||
const ExitDialog({super.key}); |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
return Scaffold( |
|||
backgroundColor: MyColors.transparent, |
|||
body: BackdropFilter( |
|||
filter: ImageFilter.blur(sigmaX: 6, sigmaY: 6), |
|||
child: Center( |
|||
child: Padding( |
|||
padding: EdgeInsets.symmetric( |
|||
horizontal: setSize(context: context, mobile: 18, tablet: 160) ?? 0, |
|||
), |
|||
child: DialogBackground( |
|||
height: 260, |
|||
child: Column( |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: [ |
|||
Text( |
|||
'want To Exit?', |
|||
style: MYTextStyle.titr0.copyWith(color: Color(0XFF322386)), |
|||
), |
|||
Text( |
|||
'Come back, hero!\nThe adventure isn’t over yet', |
|||
style: MYTextStyle.titr3.copyWith(color: Color(0XFF6272A9)), |
|||
textAlign: TextAlign.center, |
|||
), |
|||
Row( |
|||
spacing: MySpaces.s20, |
|||
children: [ |
|||
Expanded( |
|||
child: DialogButton( |
|||
onTap: () { |
|||
context.pop(); |
|||
}, |
|||
height: 72, |
|||
color: Color(0XFFC0BDD3), |
|||
child: Text( |
|||
'Cancel', |
|||
style: MYTextStyle.button2.copyWith( |
|||
shadows: [ |
|||
BoxShadow( |
|||
color: Color(0XFF9895AE), |
|||
offset: Offset(0, 3.32), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
), |
|||
), |
|||
Expanded( |
|||
child: DialogButton( |
|||
onTap: () { |
|||
SystemNavigator.pop(); |
|||
}, |
|||
height: 72, |
|||
color: Color(0XFFD42427), |
|||
child: Text( |
|||
'Exit', |
|||
style: MYTextStyle.button2.copyWith( |
|||
shadows: [ |
|||
BoxShadow( |
|||
color: Color(0XFFC82020), |
|||
offset: Offset(0, 3.32), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
), |
|||
), |
|||
], |
|||
), |
|||
], |
|||
), |
|||
), |
|||
), |
|||
), |
|||
), |
|||
); |
|||
} |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
import 'package:flutter/material.dart'; |
|||
|
|||
class DialogButton extends StatelessWidget { |
|||
const DialogButton({ |
|||
super.key, |
|||
this.color, |
|||
this.height = 72.0, |
|||
this.child, |
|||
this.onTap, |
|||
}); |
|||
|
|||
final Color? color; |
|||
final double height; |
|||
final Widget? child; |
|||
final VoidCallback? onTap; |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
return ClipPath( |
|||
clipper: ButtonDialogClipper(), |
|||
child: Material( |
|||
type: MaterialType.transparency, |
|||
child: InkWell( |
|||
onTap: onTap, |
|||
child: Ink( |
|||
height: height, |
|||
color: color, |
|||
child: Center( |
|||
child: child, |
|||
), |
|||
), |
|||
), |
|||
), |
|||
); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
class ButtonDialogClipper extends CustomClipper<Path> { |
|||
@override |
|||
Path getClip(Size size) { |
|||
final path = Path(); |
|||
path.moveTo(size.width * 0.01841077, size.height * 0.8753694); |
|||
path.cubicTo( |
|||
size.width * 0.05368083, |
|||
size.height * 1.03396, |
|||
size.width * 0.888405, |
|||
size.height * 1.04665, |
|||
size.width * 0.961125, |
|||
size.height * 0.881918); |
|||
path.cubicTo( |
|||
size.width * 1.02749, |
|||
size.height * 0.732121, |
|||
size.width * 1.00029, |
|||
size.height * 0.195965, |
|||
size.width * 0.943774, |
|||
size.height * 0.0891425); |
|||
path.cubicTo( |
|||
size.width * 0.866786, |
|||
size.height * -0.0565611, |
|||
size.width * 0.122135, |
|||
size.height * -0.00478720, |
|||
size.width * 0.0598435, |
|||
size.height * 0.109607); |
|||
path.cubicTo( |
|||
size.width * 0.00172381, |
|||
size.height * 0.216429, |
|||
size.width * -0.0181157, |
|||
size.height * 0.711249, |
|||
size.width * 0.01841077, |
|||
size.height * 0.8753694); |
|||
path.close(); |
|||
return path; |
|||
} |
|||
|
|||
@override |
|||
bool shouldReclip(CustomClipper<Path> oldClipper) { |
|||
return true; |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue