Skip to content

Commit 17b8c42

Browse files
author
darkhan.nausharipov
committed
comment fixes (apache#25255)
1 parent bc4d930 commit 17b8c42

5 files changed

Lines changed: 60 additions & 140 deletions

File tree

learning/tour-of-beam/frontend/lib/components/profile/user_menu.dart

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,17 @@ class _Buttons extends StatelessWidget {
129129
closeOverlayCallback();
130130
showDialog(
131131
context: context,
132-
builder: (context) => Dialog(
133-
backgroundColor: Colors.transparent,
134-
child: BeamAlertDialog(
135-
body: 'dialogs.deleteAccountWarning'.tr(),
136-
continueLabel: 'ui.deleteMyAccount'.tr(),
137-
title: 'ui.deleteTobAccount'.tr(),
138-
onContinue: () {
139-
authNotifier.deleteAccount().then(
140-
(_) {
141-
Navigator.pop(context);
142-
},
143-
);
144-
},
145-
),
132+
builder: (context) => BeamAlertDialog(
133+
text: 'dialogs.deleteAccountWarning'.tr(),
134+
continueLabel: 'ui.deleteMyAccount'.tr(),
135+
title: 'ui.deleteTobAccount'.tr(),
136+
onContinue: () {
137+
authNotifier.deleteAccount().then(
138+
(_) {
139+
Navigator.pop(context);
140+
},
141+
);
142+
},
146143
),
147144
);
148145
},

learning/tour-of-beam/frontend/lib/pages/tour/widgets/solution_button.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,13 @@ class SolutionButton extends StatelessWidget {
4747
// TODO(nausharipov): resolve the conflict with save user code
4848
showDialog(
4949
context: context,
50-
builder: (context) => Dialog(
51-
backgroundColor: Colors.transparent,
52-
child: BeamAlertDialog(
53-
continueLabel: 'pages.tour.showSolution'.tr(),
54-
title: 'pages.tour.solveYourself'.tr(),
55-
onContinue: () {
56-
tourNotifier.toggleShowingSolution();
57-
Navigator.pop(context);
58-
},
59-
),
50+
builder: (context) => BeamAlertDialog(
51+
continueLabel: 'pages.tour.showSolution'.tr(),
52+
title: 'pages.tour.solveYourself'.tr(),
53+
onContinue: () {
54+
tourNotifier.toggleShowingSolution();
55+
Navigator.pop(context);
56+
},
6057
),
6158
);
6259
},

playground/frontend/playground_components/assets/translations/en.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
dialogs:
19+
cancel: Cancel
20+
1821
errors:
1922
error: 'Error'
2023
loading: 'Error while loading.'
@@ -35,7 +38,6 @@ intents:
3538
reset: 'Reset Code'
3639

3740
widgets:
38-
3941
codeEditor:
4042
label: 'Code Text Area'
4143

playground/frontend/playground_components/lib/src/widgets/dialogs/alert_dialog.dart

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,64 @@
1616
* limitations under the License.
1717
*/
1818

19+
import 'package:easy_localization/easy_localization.dart';
1920
import 'package:flutter/material.dart';
2021

2122
import '../../../playground_components.dart';
2223

2324
class BeamAlertDialog extends StatelessWidget {
24-
final String? body;
25+
final String? text;
2526
final String continueLabel;
2627
final VoidCallback onContinue;
2728
final String title;
2829

2930
const BeamAlertDialog({
30-
this.body,
3131
required this.continueLabel,
3232
required this.onContinue,
3333
required this.title,
34+
this.text,
3435
});
3536

3637
@override
3738
Widget build(BuildContext context) {
38-
return OverlayBody(
39-
child: Container(
40-
width: BeamSizes.popupWidth,
41-
padding: const EdgeInsets.all(BeamSizes.size16),
42-
child: Column(
43-
crossAxisAlignment: CrossAxisAlignment.start,
44-
mainAxisSize: MainAxisSize.min,
45-
children: [
46-
Text(
47-
title,
48-
style: Theme.of(context).textTheme.headlineMedium,
49-
),
50-
if (body != null)
51-
Padding(
52-
padding: const EdgeInsets.only(top: BeamSizes.size8),
53-
child: Text(body!),
39+
return Dialog(
40+
backgroundColor: Colors.transparent,
41+
child: OverlayBody(
42+
child: Container(
43+
width: BeamSizes.popupWidth,
44+
padding: const EdgeInsets.all(BeamSizes.size16),
45+
child: Column(
46+
crossAxisAlignment: CrossAxisAlignment.start,
47+
mainAxisSize: MainAxisSize.min,
48+
children: [
49+
Text(
50+
title,
51+
style: Theme.of(context).textTheme.headlineMedium,
5452
),
55-
const SizedBox(height: BeamSizes.size8),
56-
Row(
57-
mainAxisAlignment: MainAxisAlignment.end,
58-
children: [
59-
TextButton(
60-
onPressed: () {
61-
Navigator.pop(context);
62-
},
63-
// TODO(nausharipov): review: translate in PGC?
64-
child: const Text('Cancel'),
53+
if (text != null)
54+
Padding(
55+
padding: const EdgeInsets.only(top: BeamSizes.size8),
56+
child: Text(text!),
6557
),
66-
const SizedBox(width: BeamSizes.size8),
67-
TextButton(
68-
onPressed: onContinue,
69-
child: Text(continueLabel),
70-
),
71-
],
72-
),
73-
],
58+
const SizedBox(height: BeamSizes.size8),
59+
Row(
60+
mainAxisAlignment: MainAxisAlignment.end,
61+
children: [
62+
TextButton(
63+
onPressed: () {
64+
Navigator.pop(context);
65+
},
66+
child: const Text('dialogs.cancel').tr(),
67+
),
68+
const SizedBox(width: BeamSizes.size8),
69+
TextButton(
70+
onPressed: onContinue,
71+
child: Text(continueLabel),
72+
),
73+
],
74+
),
75+
],
76+
),
7477
),
7578
),
7679
);

playground/frontend/playground_components/lib/src/widgets/popups/alert_dialog.dart

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)