alexeyinkin commented on code in PR #22794: URL: https://github.com/apache/beam/pull/22794#discussion_r954739337
########## learning/tour-of-beam/frontend/lib/pages/welcome/screen.dart: ########## @@ -0,0 +1,348 @@ +/* + * 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/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +import '../../components/complexity.dart'; +import '../../components/page_container.dart'; +import '../../config/theme/colors_provider.dart'; +import '../../constants/assets.dart'; +import '../../constants/colors.dart'; +import '../../constants/sizes.dart'; + +class WelcomeScreen extends StatelessWidget { + const WelcomeScreen(); + + @override + Widget build(BuildContext context) { + return PageContainer( + child: SingleChildScrollView( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: const [ + Expanded(child: _SdkSelection()), + Expanded(child: _TourSummary()), + ], + ), + ), + ); + } +} + +class _SdkSelection extends StatelessWidget { + const _SdkSelection(); + + @override + Widget build(BuildContext context) { + return _SdkSelectionBody( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(50, 60, 50, 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: const [ + _IntroText(), + SizedBox(height: TobSizes.size32), + _Buttons(), + ], + ), + ), + Image.asset(TobAssets.welcomeLaptop), + ], + ), + ); + } +} + +class _TourSummary extends StatelessWidget { + const _TourSummary(); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric( + vertical: TobSizes.size20, + horizontal: 27, + ), + child: Column( + children: _modules + .map( + (module) => _Module( + title: module, + isLast: module == _modules.last, + ), + ) + .toList(), + ), + ); + } + + static const List<String> _modules = [ + 'Core Transforms', + 'Common Transforms', + 'IO', + 'Windowing', + 'Triggers', + ]; +} + +class _SdkSelectionBody extends StatelessWidget { + final Widget child; + const _SdkSelectionBody({required this.child}); + + @override + Widget build(BuildContext context) { + return DecoratedBox( + decoration: BoxDecoration( + color: ThemeColors.of(context).background, + border: Border( + right: BorderSide( + color: ThemeColors.of(context).divider, + ), + ), + ), + child: child, + ); + } +} + +class _IntroText extends StatelessWidget { + const _IntroText(); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'pages.home.title', + style: Theme.of(context).textTheme.displayMedium, + ).tr(), + Container( + margin: const EdgeInsets.symmetric(vertical: 32), + height: 2, + color: TobColors.grey2, + constraints: const BoxConstraints(maxWidth: 150), + ), + RichText( + text: TextSpan( + style: Theme.of(context).textTheme.bodyLarge, + children: [ + TextSpan( + text: 'pages.home.ifSaveProgress'.tr(), + ), + TextSpan( + text: 'pages.home.signIn'.tr(), + style: Theme.of(context) + .textTheme + .bodyLarge! + .copyWith(color: ThemeColors.of(context).primary), + recognizer: TapGestureRecognizer() + ..onTap = () { + // TODO(nausharipov): sign in + }, + ), + TextSpan(text: '\n\n${'pages.home.selectLanguage'.tr()}'), + ], + ), + ), + ], + ); + } +} + +class _Buttons extends StatelessWidget { + const _Buttons(); + + void _onSdkChanged(String value) { + // TODO(nausharipov): select the language + } + + @override + Widget build(BuildContext context) { + return Wrap( + children: [ + Wrap( + children: ['Java', 'Python', 'Go'] + .map( + (e) => _SdkButton( + value: e, + groupValue: _sdk, + onChanged: _onSdkChanged, + ), + ) + .toList(), + ), + ElevatedButton( Review Comment: When "Start leaning" is below, it is off a module grid and is not aligned to anything, i.e. it is wider than Java and narrower than Java + Python. It is not that much of a problem, but one line looks better. So I prefer to break only when we have to. Compare:   Also I don't think many people notice the switch as they do not normally resize splash screens like this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
