-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16857 from [BEAM-13662] [Playground] Support mutl…
…ifile examples * [BEAM-13771][Playground] Add multifile value to the response to the frontend * [BEAM-13771][Playground] Regenerate files * [BEAM-13771][Playground] Regenerate files * [BEAM-13662] playground - multifile example support * [BEAM-13662] playground - support multifile * [BEAM-13662] playground - redesign multifile examples * [BEAM-13662] playground - support multifile examples * [BEAM-13662] add licence * [BEAM-13662] refactor popover list for better readability * [BEAM-13662] refactor popover list for better readability Co-authored-by: AydarZaynutdinov <aydar.zaynutdinov@akvelon.com> Co-authored-by: Ilya <ilya.kozyrev@akvelon.com>
- Loading branch information
1 parent
42de462
commit e3e30a7
Showing
19 changed files
with
491 additions
and
73 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
playground/frontend/lib/modules/examples/components/example_list/example_item_actions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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/examples/components/description_popover/description_popover_button.dart'; | ||
import 'package:playground/modules/examples/models/example_model.dart'; | ||
import 'package:playground/modules/examples/models/popover_state.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../multifile_popover/multifile_popover_button.dart'; | ||
|
||
class ExampleItemActions extends StatelessWidget { | ||
final ExampleModel example; | ||
final BuildContext parentContext; | ||
|
||
const ExampleItemActions( | ||
{Key? key, required this.parentContext, required this.example}) | ||
: super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
if (example.isMultiFile) multifilePopover, | ||
descriptionPopover, | ||
], | ||
); | ||
} | ||
|
||
Widget get multifilePopover => MultifilePopoverButton( | ||
parentContext: parentContext, | ||
example: example, | ||
followerAnchor: Alignment.topLeft, | ||
targetAnchor: Alignment.topRight, | ||
onOpen: () => _setPopoverOpen(parentContext, true), | ||
onClose: () => _setPopoverOpen(parentContext, false), | ||
); | ||
|
||
Widget get descriptionPopover => DescriptionPopoverButton( | ||
parentContext: parentContext, | ||
example: example, | ||
followerAnchor: Alignment.topLeft, | ||
targetAnchor: Alignment.topRight, | ||
onOpen: () => _setPopoverOpen(parentContext, true), | ||
onClose: () => _setPopoverOpen(parentContext, false), | ||
); | ||
|
||
void _setPopoverOpen(BuildContext context, bool isOpen) { | ||
Provider.of<PopoverState>(context, listen: false).setOpen(isOpen); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
playground/frontend/lib/modules/examples/components/multifile_popover/multifile_popover.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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:flutter_svg/flutter_svg.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:playground/constants/assets.dart'; | ||
import 'package:playground/constants/font_weight.dart'; | ||
import 'package:playground/constants/sizes.dart'; | ||
import 'package:playground/modules/examples/models/example_model.dart'; | ||
import 'package:url_launcher/url_launcher.dart'; | ||
|
||
const kMultifileWidth = 300.0; | ||
|
||
class MultifilePopover extends StatelessWidget { | ||
final ExampleModel example; | ||
|
||
const MultifilePopover({Key? key, required this.example}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
AppLocalizations appLocale = AppLocalizations.of(context)!; | ||
return SizedBox( | ||
width: kMultifileWidth, | ||
child: Card( | ||
child: Padding( | ||
padding: const EdgeInsets.all(kLgSpacing), | ||
child: Wrap( | ||
runSpacing: kMdSpacing, | ||
children: [ | ||
Text( | ||
appLocale.multifile, | ||
style: const TextStyle( | ||
fontSize: kTitleFontSize, | ||
fontWeight: kBoldWeight, | ||
), | ||
), | ||
Text(appLocale.multifileWarning), | ||
TextButton.icon( | ||
icon: SvgPicture.asset(kGithubIconAsset), | ||
onPressed: () { | ||
launch(example.link ?? ''); | ||
}, | ||
label: Text(appLocale.viewOnGithub), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.