Line data Source code
1 : import 'package:amadeus_proto/exercises/lesson/lesson_page_provider.dart';
2 : import 'package:amadeus_proto/exercises/widget/pressable_button.dart';
3 : import 'package:flutter/material.dart';
4 : import 'package:localization/localization.dart';
5 : import 'package:provider/provider.dart';
6 : import 'package:amadeus_proto/constants.dart';
7 :
8 : class EndDialog<T extends LessonProvider> extends StatelessWidget {
9 0 : const EndDialog(
10 : {super.key,
11 : required this.leavingCallback,
12 : required this.resetCallback,
13 : required this.title});
14 :
15 : final VoidCallback leavingCallback;
16 : final VoidCallback resetCallback;
17 : final String title;
18 :
19 0 : @override
20 : Widget build(BuildContext context) {
21 0 : final double height = MediaQuery.of(context).size.height;
22 0 : final double width = MediaQuery.of(context).size.width;
23 :
24 0 : return Consumer<T>(
25 0 : builder: (context, provider, child) {
26 0 : return Material(
27 : type: MaterialType.transparency,
28 0 : child: PopScope(
29 : canPop: false,
30 0 : child: Center(
31 0 : child: Container(
32 0 : height: height / 3,
33 : width: 350,
34 0 : decoration: BoxDecoration(
35 : color: Colors.white,
36 0 : borderRadius: BorderRadius.circular(smallBorderRadius)),
37 0 : child: Padding(
38 : padding: const EdgeInsets.all(smallPadding),
39 0 : child: Column(
40 : mainAxisSize: MainAxisSize.min,
41 : mainAxisAlignment: MainAxisAlignment.spaceBetween,
42 0 : children: [
43 0 : SizedBox(
44 0 : height: height / 4.5,
45 0 : child: Column(
46 : mainAxisAlignment: MainAxisAlignment.spaceAround,
47 0 : children: [
48 0 : SizedBox(
49 0 : child: Column(
50 0 : children: [
51 0 : Text(
52 0 : "lessons.complete".i18n(),
53 : style: const TextStyle(
54 : fontSize: mediumTextSize,
55 : fontWeight: FontWeight.bold),
56 : ),
57 : const SizedBox(
58 : height: 10,
59 : ),
60 0 : Text(title,
61 : style: const TextStyle(
62 : fontSize: mediumTextSize,
63 : fontWeight: FontWeight.normal)),
64 : ],
65 : ),
66 : )
67 : ],
68 : ),
69 : ),
70 0 : Row(
71 : mainAxisAlignment: MainAxisAlignment.spaceBetween,
72 0 : children: [
73 0 : Padding(
74 : padding: const EdgeInsets.only(bottom: smallPadding),
75 0 : child: PressableButton(
76 0 : body: Center(
77 0 : child: Text(
78 0 : "lessons.return".i18n(),
79 : style: const TextStyle(
80 : color: Colors.white,
81 : fontSize: smallTextSize,
82 : fontWeight: FontWeight.bold),
83 : overflow: TextOverflow.fade,
84 : textAlign: TextAlign.center,
85 : ),
86 : ),
87 0 : height: height / 20,
88 0 : width: width / 2.5,
89 : shadowColor:
90 0 : Theme.of(context).colorScheme.primary,
91 : buttonColor:
92 0 : Theme.of(context).colorScheme.primary,
93 : isEnable: true,
94 0 : onPressed: leavingCallback),
95 : ),
96 0 : Padding(
97 : padding: const EdgeInsets.only(bottom: smallPadding),
98 0 : child: PressableButton(
99 0 : body: Center(
100 0 : child: Text(
101 0 : "buttons.review".i18n(),
102 : style: const TextStyle(
103 : color: Colors.white,
104 : fontSize: smallTextSize,
105 : fontWeight: FontWeight.bold),
106 : overflow: TextOverflow.fade,
107 : textAlign: TextAlign.center,
108 : ),
109 : ),
110 0 : height: height / 20,
111 0 : width: width / 2.5,
112 0 : shadowColor: Theme.of(context)
113 0 : .colorScheme
114 0 : .secondary
115 0 : .withOpacity(0.5),
116 : buttonColor:
117 0 : Theme.of(context).colorScheme.primary,
118 : isEnable: true,
119 0 : onPressed: resetCallback),
120 : ),
121 : ],
122 : )
123 : ],
124 : ),
125 : ),
126 : )),
127 : ),
128 : );
129 : },
130 : );
131 : }
132 : }
|