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
35 changes: 35 additions & 0 deletions examples/mirai_gallery/assets/json/home_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,41 @@
}
}
},

{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "apartment"
},

"title": {
"type": "text",
"data": "Placeholder",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A Material Design Mirai Placeholder widget",
"style": {
"fontSize": 12
}
},
"isThreeLine": true,
"onTap": {
"actionType": "navigate",
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/placeholder_example.json"
}
}
},


{
"type": "sizedBox",
"height": 24.0
Expand Down
37 changes: 37 additions & 0 deletions examples/mirai_gallery/assets/json/placeholder_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"type": "scaffold",
"appBar": {
"type": "appBar",
"title": {
"type": "text",
"data": "Placeholder"
}
},
"body": {
"type": "listView",
"shrinkWrap": true,
"children": [
{
"type": "sizedBox",
"height": 25
},
{
"type": "placeholder",
"color": "#455A64",
"strokeWidth": 2.0,
"fallbackHeight": 400.0,
"fallbackWidth": 400.0
},
{
"type": "sizedBox",
"height": 25
},
{
"color": "#672BFF",
"type": "placeholder",
"strokeWidth": 5.0,
"fallbackHeight": 100.0
}
]
}
}
1 change: 1 addition & 0 deletions packages/mirai/lib/src/framework/mirai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class Mirai {
const MiraiRadioGroupParser(),
const MiraiSliderParser(),
const MiraiOpacityParser(),
const MiraiPlaceholderParser(),
];

static final _actionParsers = <MiraiActionParser>[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:freezed_annotation/freezed_annotation.dart';

export 'package:mirai/src/parsers/mirai_placeholder/mirai_placeholder_parser.dart';

part 'mirai_placeholder.freezed.dart';
part 'mirai_placeholder.g.dart';

@freezed
class MiraiPlaceholder with _$MiraiPlaceholder {
const factory MiraiPlaceholder({
@Default(2.0) double fallbackWidth,
@Default(400.0) double fallbackHeight,
@Default(400.0) double strokeWidth,
@Default('#455A64') String color,
Map<String, dynamic>? child,
}) = _MiraiPlaceholder;

factory MiraiPlaceholder.fromJson(Map<String, dynamic> json) =>
_$MiraiPlaceholderFromJson(json);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading