Skip to content

Commit a34b170

Browse files
author
darkhan.nausharipov
committed
hint warning (apache#25116)
2 parents aee2c84 + f9f8c3a commit a34b170

2 files changed

Lines changed: 69 additions & 3 deletions

File tree

learning/tour-of-beam/frontend/assets/translations/en.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
ui:
1919
about: About Tour of Beam
2020
builtWith: Built with Apache Beam
21+
cancel: Cancel
2122
continueGitHub: Continue with GitHub
2223
continueGoogle: Continue with Google
2324
copyright: © The Apache Software Foundation
@@ -27,7 +28,6 @@ ui:
2728
reportIssue: Report Issue in GitHub
2829
signIn: Sign in
2930
signOut: Sign out
30-
solution: Solution
3131
toWebsite: To Apache Beam website
3232

3333
pages:
@@ -38,7 +38,11 @@ pages:
3838
startTour: Start your tour
3939
title: Welcome to the Tour of Beam!
4040
tour:
41+
assignment: Assignment
4142
completeUnit: Complete Unit
43+
showSolution: Show
44+
solution: Solution
45+
solveYourself: Before revealing the solution, try solving the challenge on your own. Remember, the more you practice, the better you will become. Give it a shot and see how far you can get.
4246
summaryTitle: Table of Contents
4347

4448
dialogs:

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

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
import 'package:easy_localization/easy_localization.dart';
2020
import 'package:flutter/material.dart';
2121
import 'package:flutter_svg/svg.dart';
22+
import 'package:playground_components/playground_components.dart';
2223

2324
import '../../../assets/assets.gen.dart';
25+
import '../../../constants/sizes.dart';
2426
import '../state.dart';
2527

2628
class SolutionButton extends StatelessWidget {
@@ -42,9 +44,69 @@ class SolutionButton extends StatelessWidget {
4244
: null,
4345
),
4446
),
45-
onPressed: tourNotifier.toggleShowingSolution,
47+
onPressed: () {
48+
showDialog(
49+
context: context,
50+
builder: (context) => Dialog(
51+
backgroundColor: Colors.transparent,
52+
child: _Popup(tourNotifier: tourNotifier),
53+
),
54+
);
55+
},
4656
icon: SvgPicture.asset(Assets.svg.solution),
47-
label: const Text('ui.solution').tr(),
57+
label: Text(
58+
tourNotifier.isShowingSolution
59+
? 'pages.tour.assignment'
60+
: 'pages.tour.solution',
61+
).tr(),
62+
),
63+
);
64+
}
65+
}
66+
67+
class _Popup extends StatelessWidget {
68+
final TourNotifier tourNotifier;
69+
70+
const _Popup({
71+
required this.tourNotifier,
72+
});
73+
74+
@override
75+
Widget build(BuildContext context) {
76+
return OverlayBody(
77+
child: Container(
78+
width: TobSizes.hintPopupWidth,
79+
padding: const EdgeInsets.all(BeamSizes.size16),
80+
child: Column(
81+
crossAxisAlignment: CrossAxisAlignment.start,
82+
mainAxisSize: MainAxisSize.min,
83+
children: [
84+
Text(
85+
'pages.tour.solveYourself',
86+
style: Theme.of(context).textTheme.headlineMedium,
87+
).tr(),
88+
const SizedBox(height: BeamSizes.size8),
89+
Row(
90+
mainAxisAlignment: MainAxisAlignment.end,
91+
children: [
92+
TextButton(
93+
onPressed: () {
94+
Navigator.pop(context);
95+
},
96+
child: const Text('ui.cancel').tr(),
97+
),
98+
const SizedBox(width: BeamSizes.size8),
99+
TextButton(
100+
onPressed: () {
101+
tourNotifier.toggleShowingSolution();
102+
Navigator.pop(context);
103+
},
104+
child: const Text('pages.tour.showSolution').tr(),
105+
),
106+
],
107+
),
108+
],
109+
),
48110
),
49111
);
50112
}

0 commit comments

Comments
 (0)