Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ tasks.rat {
"playground/frontend/.metadata",
"playground/frontend/pubspec.lock",

// Ignore Flutter autogenerated files for Playground Components
"playground/frontend/playground_components/.metadata",
"playground/frontend/playground_components/pubspec.lock",

// Ignore Flutter autogenerated files for Tour of Beam
"learning/tour-of-beam/frontend/.metadata",
"learning/tour-of-beam/frontend/pubspec.lock",

// Ignore .gitkeep file
"**/.gitkeep",

Expand Down
28 changes: 28 additions & 0 deletions learning/tour-of-beam/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Overview

This folder holds code that supports the user interface for [Tour of Beam](../).

# Requirements

To develop, build and test code in this folder requires the following:

- https://flutter.dev/
30 changes: 30 additions & 0 deletions learning/tour-of-beam/frontend/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: web
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
47 changes: 47 additions & 0 deletions learning/tour-of-beam/frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Tour of Beam
These are the main sources of the Tour of Beam website.

# About

# Getting started
Flutter installation guide: https://docs.flutter.dev/get-started/install
Run the app: `flutter run --web-renderer html`

# Deployment

# Tests
Install ChromeDriver to run integration tests in a browser: https://docs.flutter.dev/testing/integration-tests#running-in-a-browser
Run integration tests:
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/counter_test.dart \
-d web-server

# Packages
`flutter pub get`

# Contribution guide
For checks: `./gradlew rat`

# Additional resources

# Troubleshooting
18 changes: 18 additions & 0 deletions learning/tour-of-beam/frontend/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

include: package:total_lints/app.yaml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions learning/tour-of-beam/frontend/assets/svg/theme-mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions learning/tour-of-beam/frontend/assets/svg/welcome-progress-0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions learning/tour-of-beam/frontend/assets/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

ui:
copyright: '© The Apache Software Foundation'
darkMode: 'Dark Mode'
lightMode: 'Light Mode'
privacyPolicy: 'Privacy Policy'
reportIssue: 'Report Issue in GitHub'
signIn: 'Sign in'
continueGitHub: 'Continue with GitHub'
continueGoogle: 'Continue with Google'
pages:
welcome:
title: 'Welcome to the Tour of Beam!'
ifSaveProgress: 'Your journey is broken down into learning modules. If you would like to save your progress and track completed modules, please'
signIn: ' sign in.'
selectLanguage: 'Please select the default language (you may change the language at any time):'
startLearning: 'Start learning'
dialogs:
signInIf: If you would like to save your progress and track completed modules
complexity:
basic: 'Basic level'
medium: 'Medium level'
advanced: 'Advanced level'
43 changes: 43 additions & 0 deletions learning/tour-of-beam/frontend/integration_test/app_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:tour_of_beam/components/toggle_theme_button.dart';
import 'package:tour_of_beam/main.dart' as app;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('theme', () {
testWidgets('mode toggle', (tester) async {
app.main();
await tester.pumpAndSettle();
final Finder switchToDarkModeButton =
find.widgetWithText(ToggleThemeButton, 'ui.darkMode'.tr());
expect(switchToDarkModeButton, findsOneWidget);
await tester.tap(switchToDarkModeButton);
await tester.pumpAndSettle();
expect(
find.widgetWithText(ToggleThemeButton, 'ui.lightMode'.tr()),
findsOneWidget,
);
});
});
}
65 changes: 65 additions & 0 deletions learning/tour-of-beam/frontend/lib/components/complexity.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import 'package:flutter/material.dart';

import '../constants/colors.dart';
import '../constants/sizes.dart';

enum Complexity { basic, medium, advanced }

class ComplexityWidget extends StatelessWidget {
final Complexity complexity;

const ComplexityWidget({required this.complexity});

@override
Widget build(BuildContext context) {
return Row(children: _dots[complexity]!);
}

static const Map<Complexity, List<Widget>> _dots = {
Complexity.basic: [_Dot.green, _Dot.grey, _Dot.grey],
Complexity.medium: [_Dot.orange, _Dot.orange, _Dot.grey],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I was in dark mode, the two orange dots were not distinguishable from the grey.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do 0x30808080 that fits both light and dark?

image
image
image
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented the above.

Complexity.advanced: [_Dot.red, _Dot.red, _Dot.red],
};
}

class _Dot extends StatelessWidget {
final Color color;

const _Dot({required this.color});

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(left: 1),
width: TobSizes.size4,
height: TobSizes.size4,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: color,
),
);
}

static const grey = _Dot(color: TobColors.grey4);
static const green = _Dot(color: TobColors.green);
static const orange = _Dot(color: TobColors.orange);
static const red = _Dot(color: TobColors.red);
}
Loading