diff --git a/playground/frontend/lib/components/loading_indicator/loading_indicator.dart b/playground/frontend/lib/components/loading_indicator/loading_indicator.dart new file mode 100644 index 000000000000..8d7fb142a28d --- /dev/null +++ b/playground/frontend/lib/components/loading_indicator/loading_indicator.dart @@ -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. + */ + +import 'package:flutter/material.dart'; +import 'package:playground/constants/colors.dart'; + +class LoadingIndicator extends StatelessWidget { + final double size; + + const LoadingIndicator({Key? key, required this.size}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Center( + child: SizedBox( + height: size, + width: size, + child: const CircularProgressIndicator( + color: kLightPrimary, + ), + ), + ); + } +} diff --git a/playground/frontend/lib/modules/editor/repository/code_repository/code_repository.dart b/playground/frontend/lib/modules/editor/repository/code_repository/code_repository.dart index 9e86f0103e63..8f354ce9e8d6 100644 --- a/playground/frontend/lib/modules/editor/repository/code_repository/code_repository.dart +++ b/playground/frontend/lib/modules/editor/repository/code_repository/code_repository.dart @@ -166,6 +166,7 @@ class CodeRepository { final log = responses[1]; final error = responses[2]; return RunCodeResult( + pipelineUuid: pipelineUuid, status: status, output: prevOutput + output.output + error.output, log: prevLog + log.output, diff --git a/playground/frontend/lib/modules/examples/example_selector.dart b/playground/frontend/lib/modules/examples/example_selector.dart index d2024fd0eb69..be7189a60fc1 100644 --- a/playground/frontend/lib/modules/examples/example_selector.dart +++ b/playground/frontend/lib/modules/examples/example_selector.dart @@ -17,6 +17,7 @@ */ import 'package:flutter/material.dart'; +import 'package:playground/components/loading_indicator/loading_indicator.dart'; import 'package:playground/config/theme.dart'; import 'package:playground/constants/sizes.dart'; import 'package:playground/modules/examples/components/examples_components.dart'; @@ -151,18 +152,10 @@ class _ExampleSelectorState extends State color: Theme.of(context).backgroundColor, borderRadius: BorderRadius.circular(kMdBorderRadius), ), - child: Column( - children: [ - SearchField(controller: textController), - const TypeFilter(), - ExampleList( - controller: scrollController, - selectedExample: playgroundState.selectedExample!, - animationController: animationController, - dropdown: examplesDropdown, - ), - ], - ), + child: exampleState.sdkCategories == null || + playgroundState.selectedExample == null + ? const LoadingIndicator(size: kContainerHeight) + : _buildDropdownContent(playgroundState), ), ), ), @@ -175,6 +168,21 @@ class _ExampleSelectorState extends State ); } + Widget _buildDropdownContent(PlaygroundState playgroundState) { + return Column( + children: [ + SearchField(controller: textController), + const TypeFilter(), + ExampleList( + controller: scrollController, + selectedExample: playgroundState.selectedExample!, + animationController: animationController, + dropdown: examplesDropdown, + ), + ], + ); + } + SelectorPositionModel findSelectorPositionData() { RenderBox? rBox = selectorKey.currentContext?.findRenderObject() as RenderBox;