Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions examples/stac_gallery/assets/json/drawer_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"type": "scaffold",
"appBar": {
"type": "appBar",
"title": {
"type": "text",
"data": "Drawer Example",
"style": {
"color": "#ffffff",
"fontSize": 21
}
},
"backgroundColor": "#4D00E9"
},
"drawerEnableOpenDragGesture": true,
"drawerEdgeDragWidth": 20.0,
"drawer": {
"type": "drawer",
"backgroundColor": "#f5f5f5",
"elevation": 16.0,
"width": 280.0,
"child": {
"type": "column",
"children": [
{
"type": "container",
"height": 120,
"color": "#4D00E9",
"child": {
"type": "center",
"child": {
"type": "text",
"data": "Drawer Header",
"style": {
"color": "#ffffff",
"fontSize": 20,
"fontWeight": "bold"
}
}
}
},
{
"type": "expanded",
"child": {
"type": "listView",
"children": [
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "home",
"size": 24
},
"title": {
"type": "text",
"data": "Home"
},
"onTap": {
"actionType": "snackBar",
"content": "Home tapped!"
}
},
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "settings",
"size": 24
},
"title": {
"type": "text",
"data": "Settings"
},
"onTap": {
"actionType": "snackBar",
"content": "Settings tapped!"
}
},
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "info",
"size": 24
},
"title": {
"type": "text",
"data": "About"
},
"onTap": {
"actionType": "snackBar",
"content": "About tapped!"
}
}
]
}
}
]
}
},
"body": {
"type": "center",
"child": {
"type": "column",
"mainAxisAlignment": "center",
"children": [
{
"type": "text",
"data": "Welcome to Drawer Example",
"style": {
"fontSize": 24,
"fontWeight": "bold"
}
},
{
"type": "sizedBox",
"height": 16
},
{
"type": "text",
"data": "Swipe from left edge or tap the menu icon to open the drawer",
"style": {
"fontSize": 16,
"color": "#666666"
}
}
]
}
}
}
23 changes: 23 additions & 0 deletions examples/stac_gallery/assets/json/home_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@
}
}
},
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "menu"
},
"title": {
"type": "text",
"data": "Stac Drawer"
},
"subtitle": {
"type": "text",
"data": "A Material Design panel that slides in horizontally from the edge of a Scaffold"
},
"onTap": {
"actionType": "navigate",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/drawer_example.json"
}
}
},
{
"type": "listTile",
"leading": {
Expand Down
1 change: 1 addition & 0 deletions packages/stac/lib/src/framework/stac.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class Stac {
const StacCarouselViewParser(),
const StacColoredBoxParser(),
const StacDividerParser(),
const StacDrawerParser(),
const StacCircularProgressIndicatorParser(),
const StacLinearProgressIndicatorParser(),
const StacHeroParser(),
Expand Down
27 changes: 27 additions & 0 deletions packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart';
import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart';

export 'stac_drawer_parser.dart';

part 'stac_drawer.freezed.dart';
part 'stac_drawer.g.dart';

@freezed
abstract class StacDrawer with _$StacDrawer {
const factory StacDrawer({
String? backgroundColor,
StacDouble? elevation,
String? shadowColor,
String? surfaceTintColor,
StacShapeBorder? shape,
StacDouble? width,
Map<String, dynamic>? child,
String? semanticLabel,
Clip? clipBehavior,
}) = _StacDrawer;

factory StacDrawer.fromJson(Map<String, dynamic> json) =>
_$StacDrawerFromJson(json);
}
Loading