Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Row and Column Spacing #6

Merged
merged 3 commits into from
Dec 24, 2024
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
238 changes: 41 additions & 197 deletions examples/mirai_gallery/assets/json/column_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,218 +8,62 @@
}
},
"body": {
"type": "column",
"mainAxisAlignment": "start",
"crossAxisAlignment": "start",
"children": [
{
"type": "sizedBox",
"height": 12
},
{
"type": "card",
"elevation": 20,
"borderOnForeground": true,
"margin": {
"top": 12,
"bottom": 12,
"right": 8,
"left": 8
},
"child": {
"type": "listTile",
"leading": {
"type": "image",
"src": "https://images.pexels.com/photos/2115367/pexels-photo-2115367.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
},
"title": {
"type": "padding",
"padding": {
"top": 10
},
"type": "singleChildScrollView",
"child": {
"type": "column",
"mainAxisAlignment": "center",
"crossAxisAlignment": "center",
"spacing": 12,
"children": [
{
"type": "container",
"width": 2000,
"height": 200,
"color": "#FFCDD2",
"child": {
"type": "center",
"child": {
"type": "text",
"data": "BURJ KHALIFA",
"data": "Red Container",
"style": {
"fontSize": 18
"color": "#B71C1C"
}
}
},
"subtitle": {
"type": "padding",
"padding": {
"top": 10,
"bottom": 10
},
"child": {
"type": "column",
"children": [
{
"type": "text",
"data": "Get a chance to go on the top of Burj Khalifa.",
"align": "center",
"style": {
"fontSize": 12
}
},
{
"type": "row",
"children": [
{
"type": "outlinedButton",
"style": {
"padding": {
"top": 8,
"left": 12,
"right": 12,
"bottom": 8
}
},
"onPressed": {},
"child": {
"type": "text",
"data": "Explore",
"align": "left",
"style": {
"fontSize": 12
}
}
},
{
"type": "sizedBox",
"width": 8
},
{
"type": "outlinedButton",
"style": {
"padding": {
"top": 8,
"left": 12,
"right": 12,
"bottom": 8
}
},
"onPressed": {},
"child": {
"type": "text",
"data": "Share",
"align": "center",
"style": {
"fontSize": 12
}
}
}
]
}
]
}
}
}
},
{
"type": "sizedBox",
"height": 12
},
{
"type": "card",
"elevation": 20,
"borderOnForeground": true,
"margin": {
"top": 12,
"bottom": 12,
"right": 8,
"left": 8
},
"child": {
"type": "listTile",
"leading": {
"type": "image",
"src": "https://images.pexels.com/photos/7199830/pexels-photo-7199830.png?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
},
"title": {
"type": "padding",
"padding": {
"top": 10
},
{
"type": "container",
"width": 2000,
"height": 200,
"color": "#C8E6C9",
"child": {
"type": "center",
"child": {
"type": "text",
"data": "MUSEUM OF FUTURE",
"data": "Green Container",
"style": {
"fontSize": 18
"color": "#1B5E20"
}
}
},
"subtitle": {
"type": "padding",
"padding": {
"top": 10,
"bottom": 10
},
}
},
{
"type": "container",
"width": 2000,
"height": 200,
"color": "#BBDEFB",
"child": {
"type": "center",
"child": {
"type": "column",
"children": [
{
"type": "text",
"data": "Museum Of Future is open now.",
"align": "center",
"style": {
"fontSize": 12
}
},
{
"type": "row",
"children": [
{
"type": "outlinedButton",
"style": {
"padding": {
"top": 8,
"left": 12,
"right": 12,
"bottom": 8
}
},
"onPressed": {},
"child": {
"type": "text",
"data": "Explore",
"align": "left",
"style": {
"fontSize": 12
}
}
},
{
"type": "sizedBox",
"width": 8
},
{
"type": "outlinedButton",
"style": {
"padding": {
"top": 8,
"left": 12,
"right": 12,
"bottom": 8
}
},
"onPressed": {},
"child": {
"type": "text",
"data": "Share",
"align": "center",
"style": {
"fontSize": 12
}
}
}
]
}
]
"type": "text",
"data": "Blue Container",
"style": {
"color": "#0D47A1"
}
}
}
}
}
]
]
}
}
}
9 changes: 1 addition & 8 deletions examples/mirai_gallery/assets/json/row_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,18 @@
"type": "row",
"mainAxisAlignment": "center",
"crossAxisAlignment": "center",
"spacing": 12,
"children": [
{
"type": "image",
"src": "https://images.pexels.com/photos/2718416/pexels-photo-2718416.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
"width": 100
},
{
"type": "sizedBox",
"width": 12
},
{
"type": "image",
"src": "https://images.pexels.com/photos/121629/pexels-photo-121629.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
"width": 100
},
{
"type": "sizedBox",
"width": 12
},
{
"type": "image",
"src": "https://images.pexels.com/photos/1414642/pexels-photo-1414642.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ mixin _$MiraiDialogAction {
TraversalEdgeBehavior? get traversalEdgeBehavior =>
throw _privateConstructorUsedError;

/// Serializes this MiraiDialogAction to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)

/// Create a copy of MiraiDialogAction
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$MiraiDialogActionCopyWith<MiraiDialogAction> get copyWith =>
throw _privateConstructorUsedError;
}
Expand Down Expand Up @@ -65,6 +69,8 @@ class _$MiraiDialogActionCopyWithImpl<$Res, $Val extends MiraiDialogAction>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of MiraiDialogAction
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -113,6 +119,8 @@ class _$MiraiDialogActionCopyWithImpl<$Res, $Val extends MiraiDialogAction>
) as $Val);
}

/// Create a copy of MiraiDialogAction
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MiraiNetworkRequestCopyWith<$Res>? get request {
Expand Down Expand Up @@ -156,6 +164,8 @@ class __$$MiraiDialogActionImplCopyWithImpl<$Res>
$Res Function(_$MiraiDialogActionImpl) _then)
: super(_value, _then);

/// Create a copy of MiraiDialogAction
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -275,7 +285,7 @@ class _$MiraiDialogActionImpl implements _MiraiDialogAction {
other.traversalEdgeBehavior == traversalEdgeBehavior));
}

@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
Expand All @@ -288,7 +298,9 @@ class _$MiraiDialogActionImpl implements _MiraiDialogAction {
useSafeArea,
traversalEdgeBehavior);

@JsonKey(ignore: true)
/// Create a copy of MiraiDialogAction
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$MiraiDialogActionImplCopyWith<_$MiraiDialogActionImpl> get copyWith =>
Expand Down Expand Up @@ -334,8 +346,11 @@ abstract class _MiraiDialogAction implements MiraiDialogAction {
bool get useSafeArea;
@override
TraversalEdgeBehavior? get traversalEdgeBehavior;

/// Create a copy of MiraiDialogAction
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$MiraiDialogActionImplCopyWith<_$MiraiDialogActionImpl> get copyWith =>
throw _privateConstructorUsedError;
}
Loading
Loading