Skip to content

Commit

Permalink
Responsive layout (#2834)
Browse files Browse the repository at this point in the history
* fix SplitView stream subscription

* Add TabBarView layout, make AppBar responsive

* Use IndexedStack to keep the platform view alive in the responsive mode

* Show tabBar in embed mode

* Hide title in responsive mode

* Fix split drag behavior

* Add comments

* Add semantics to Tabs

* Show sample icons in mobile mode

* Use const
  • Loading branch information
johnpryan authored Feb 15, 2024
1 parent cff1de0 commit 7375a54
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 220 deletions.
38 changes: 22 additions & 16 deletions pkgs/sketch_pad/lib/execution/execution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ web.Element _iFrameFactory(int viewId) {
class ExecutionWidget extends StatefulWidget {
final AppServices appServices;

/// Whether the iframe ignores pointer events, for when gestures need to be
/// handled by the Flutter app.
final bool ignorePointer;
final AppModel appModel;

ExecutionWidget({
required this.appServices,
this.ignorePointer = false,
required this.appModel,
super.key,
}) {
_initViewFactory();
Expand All @@ -65,18 +63,26 @@ class _ExecutionWidgetState extends State<ExecutionWidget> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
widget.appServices.executionService?.ignorePointer = widget.ignorePointer;

return Container(
color: theme.scaffoldBackgroundColor,
padding: const EdgeInsets.all(denseSpacing),
child: HtmlElementView(
key: _elementViewKey,
viewType: _viewType,
onPlatformViewCreated: (int id) {
widget.appServices.registerExecutionService(executionServiceInstance);
},
),

return ListenableBuilder(
listenable: widget.appModel.splitViewDragState,
builder: (context, _) {
// Ignore pointer events while the Splitter is being dragged.
widget.appServices.executionService?.ignorePointer =
widget.appModel.splitViewDragState.value == SplitDragState.active;
return Container(
color: theme.scaffoldBackgroundColor,
padding: const EdgeInsets.all(denseSpacing),
child: HtmlElementView(
key: _elementViewKey,
viewType: _viewType,
onPlatformViewCreated: (int id) {
widget.appServices
.registerExecutionService(executionServiceInstance);
},
),
);
},
);
}

Expand Down
Loading

0 comments on commit 7375a54

Please sign in to comment.