You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/07/27 18:30:30 UTC

[GitHub] [beam] alexeyinkin opened a new pull request, #22477: [Playground] Share any code feature

alexeyinkin opened a new pull request, #22477:
URL: https://github.com/apache/beam/pull/22477

   Resolves #21978.
   
   In this PR:
   - Added 'share any code' feature.
   - Refactored dropdown offset calculation to accommodate the new button.
   - Refactored color theme handling because the new button did not fit the old theme handling.
   - Added `ExampleModel.sdk` because there are now cases when we can't take it anywhere else, and it also feels natural.
   - Fixed tests, they broke after adding sdk.
   
   Many thanks to @miamihotline who did 70% of the job but was interrupted.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damondouglas commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
damondouglas commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r942939043


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   I saw this:  https://dart.dev/tools/pub/publishing#publishing-is-forever
   So I'm fine.  Thank you for listening.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931473171


##########
playground/frontend/lib/config/theme.dart:
##########
@@ -16,20 +16,46 @@
  * limitations under the License.
  */
 
+import 'package:code_text_field/code_text_field.dart';
 import 'package:flutter/material.dart';
 import 'package:playground/constants/colors.dart';
 import 'package:playground/constants/font_weight.dart';
 import 'package:playground/constants/fonts.dart';
 import 'package:playground/constants/sizes.dart';
+import 'package:playground/modules/editor/components/editor_themes.dart';
 import 'package:provider/provider.dart';
 import 'package:shared_preferences/shared_preferences.dart';
 
 const kThemeMode = 'theme_mode';
 
-class ThemeProvider extends ChangeNotifier {
+class ThemeSwitchNotifier extends ChangeNotifier {

Review Comment:
   The old theme handling was the following. The switch notifier was hanged in the tree by `Provider`. Those who needed colors were getting the switch notifier and then the theme from its `isDark` property. The theme itself was not hanging in the tree so it could not be overridden.
   
   Now we need to partially override theme colors for the semi-transparent sharing button.
   
   For this, I changed the following:
   - Renamed the switch notifier so it is distinguished from theme provider itself.
   - Added a theme provider that listens to the switcher and provides the theme to its children.
   - Combined them into `ThemeSwitchNotifierProvider`.
   - Added `ThemeColors.copyWith` for partial overriding.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damondouglas commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
damondouglas commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r941759906


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   @pabloem  / @alexeyinkin  I think using the package seems reasonable enough but for custom packages should we have them hosted under https://github.com/akvelon instead?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damondouglas commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
damondouglas commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r941759582


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   @pabloem / @alexeyinkin I think using the package seems reasonable enough but for custom packages should we have them hosted under https://github.com/akvelon instead?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] pabloem commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
pabloem commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r942710963


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   the package lgtm being that it's mit-licensed and so on



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931475226


##########
playground/frontend/lib/config/theme.dart:
##########
@@ -174,16 +241,42 @@ final kDarkTheme = ThemeData(
 );
 
 class ThemeColors {
+  final Color? _background;
+  final Color? _dropdownButton;
+
   final bool isDark;
 
-  static ThemeColors of(BuildContext context) {
-    final theme = Provider.of<ThemeProvider>(context);
-    return ThemeColors(theme.isDarkMode);
+  static ThemeColors of(BuildContext context, {bool listen = true}) {
+    return Provider.of<ThemeColors>(context, listen: listen);
+  }
+
+  ThemeColors({
+    required this.isDark,
+    Color? background,
+    Color? dropdownButtonColor,
+  })  : _background = background,
+        _dropdownButton = dropdownButtonColor;
+
+  const ThemeColors.fromBrightness({
+    required this.isDark,
+  })  : _background = null,
+        _dropdownButton = null;
+
+  ThemeColors copyWith({
+    Color? background,
+    Color? dropdownButton,
+  }) {
+    return ThemeColors(
+      isDark: isDark,
+      background: background ?? this.background,
+      dropdownButtonColor: dropdownButton ?? this.dropdownButton,
+    );
   }
 
-  ThemeColors(this.isDark);
+  Color get dropdownButton =>
+      _dropdownButton ?? (isDark ? kDarkGrey : kLightGrey);
 
-  Color get greyColor => isDark ? kDarkGrey : kLightGrey;
+  Color get divider => isDark ? kDarkGrey : kLightGrey;

Review Comment:
   Theme colors should be named after usage and not after the colors. These ones we needed to override, but it makes no sense to override... grey.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931476139


##########
playground/frontend/lib/config/theme.dart:
##########
@@ -198,8 +291,9 @@ class ThemeColors {
   Color get secondaryBackground =>
       isDark ? kDarkSecondaryBackground : kLightSecondaryBackground;
 
-  Color get primaryBackground =>
-      isDark ? kDarkPrimaryBackground : kLightPrimaryBackground;
+  Color get background =>

Review Comment:
   To match Flutter's `ThemeData.background` that we populate with the same constants.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] pabloem commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
pabloem commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r942798041


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   Responding to @damondouglas 
   
   > @pabloem / @alexeyinkin I think using the package seems reasonable enough but for custom packages should we have them hosted under https://github.com/akvelon instead?
   
   I don't know what are the options. This discussion doesn't need to block the PR. We can discuss this next meeting?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931493339


##########
playground/frontend/lib/modules/examples/components/example_list/expansion_panel_item.dart:
##########
@@ -51,7 +51,6 @@ class ExpansionPanelItem extends StatelessWidget {
               AnalyticsService.get(context).trackSelectExample(example);
               final exampleWithInfo = await exampleState.loadExampleInfo(
                 example,
-                playgroundState.sdk,

Review Comment:
   Example now contains `sdk`, remove all duplication.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] pabloem commented on pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
pabloem commented on PR #22477:
URL: https://github.com/apache/beam/pull/22477#issuecomment-1211385310

   lgtm!


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on PR #22477:
URL: https://github.com/apache/beam/pull/22477#issuecomment-1197271808

   R: @damondouglas 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] pabloem merged pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
pabloem merged PR #22477:
URL: https://github.com/apache/beam/pull/22477


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r942097577


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   I made it before starting the work at Akvelon, and it gained 58% popularity before that. We can technically fork it to the Akvelon repo, but then it will split the user base with no clear benefit.
   
   Also we do use other packages by 3rd parties:
   https://pub.dev/packages/aligned_dialog
   https://pub.dev/packages/expansion_widget
   https://pub.dev/packages/highlight
   
   and do not attempt to own them although the last one is nearly abandoned (there's just no alternative).
   Although we are forking https://pub.dev/packages/code_text_field to take ownership of the new text editor features.
   
   I would prefer not using `keyed_collection_widgets` at all than forking, as the fork would weaken maintainability.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #22477:
URL: https://github.com/apache/beam/pull/22477#issuecomment-1197310245

   Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931461274


##########
playground/frontend/lib/components/horizontal_divider.dart:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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 'package:playground/config/theme.dart';
+import 'package:playground/constants/sizes.dart';
+
+/// Replaces the Flutter's Divider which is buggy with HTML renderer,
+/// see https://github.com/flutter/flutter/issues/46339
+class HorizontalDivider extends StatelessWidget {

Review Comment:
   We will soon transition to HTML renderer. The default Flutter's divider is not visible there in our case.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931498364


##########
playground/frontend/lib/modules/sdk/models/sdk.dart:
##########
@@ -28,6 +28,33 @@ enum SDK {
   go,
   python,
   scio,
+  ;
+
+  /// A temporary solution while we wait for the backend to add
+  /// sdk in example responses.

Review Comment:
   @vchunikhin is adding it soon as a part of 'share any code' backend.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931460227


##########
playground/frontend/lib/components/dropdown_button/dropdown_button.dart:
##########
@@ -98,7 +117,11 @@ class _AppDropdownButtonState extends State<AppDropdownButton>
   }
 
   OverlayEntry createDropdown() {
-    SelectorPositionModel posModel = findSelectorPositionData();
+    final dropdownOffset = findDropdownOffset(

Review Comment:
   Removed duplicated offset calculation.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931502084


##########
playground/frontend/lib/pages/playground/components/playground_page_providers.dart:
##########
@@ -102,21 +104,25 @@ class PlaygroundPageProviders extends StatelessWidget {
     ExampleState exampleState,
     PlaygroundState playgroundState,
   ) async {
-    final example = _getEmbeddedExample();

Review Comment:
   I agree this file has become messy. It will be addressed in
   - #22220



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r931486211


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   The use of ordinary `TabController` makes this fragile.
   
   In this file we hardcode the number of tabs as 2.
   Tab headers and tab contents are spread into 3 different widgets: `ShareTabHeaders`, `SnippetShareTabs`, `ExampleShareTabs`.
   These 4 locations should agree on the number of tabs and their order.
   Not that we have plans to change the tabs, but it is still hard to maintain.
   
   To solve such problems, I made this package some time ago:
   https://pub.dev/packages/keyed_collection_widgets
   
   I had been using it with all tab solutions for months, but it needs approval here.
   Can we use it?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] alexeyinkin commented on a diff in pull request #22477: [Playground] Share any code feature frontend

Posted by GitBox <gi...@apache.org>.
alexeyinkin commented on code in PR #22477:
URL: https://github.com/apache/beam/pull/22477#discussion_r942794928


##########
playground/frontend/lib/modules/editor/components/share_dropdown/share_dropdown_body.dart:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 'package:playground/modules/editor/components/share_dropdown/share_tabs/share_tabs.dart';
+import 'package:playground/modules/editor/components/share_dropdown/share_tabs_headers.dart';
+import 'package:playground/modules/output/components/output_header/tab_header.dart';
+
+const _kTabsCount = 2;
+
+class ShareDropdownBody extends StatefulWidget {
+  const ShareDropdownBody({super.key});
+
+  @override
+  State<ShareDropdownBody> createState() => _ShareDropdownBodyState();
+}
+
+class _ShareDropdownBodyState extends State<ShareDropdownBody>
+    with SingleTickerProviderStateMixin {
+  late final tabController = TabController(vsync: this, length: _kTabsCount);
+
+  @override
+  void dispose() {
+    tabController.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        TabHeader(
+          tabController: tabController,
+          tabsWidget: ShareTabsHeaders(tabController: tabController),
+        ),
+        Expanded(
+          child: ShareTabs(tabController: tabController),

Review Comment:
   Then I suggest you merge it as it is when the review is otherwise done, because it is hard to track so many changes.
   I filed a follow-up issue for these tabs: https://github.com/apache/beam/issues/22663



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org