-
Notifications
You must be signed in to change notification settings - Fork 29
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 #82 from Yash-Khattar/feature/hero
feat: Add Mirai parser for hero widget
- Loading branch information
Showing
12 changed files
with
876 additions
and
1 deletion.
There are no files selected for viewing
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,127 @@ | ||
{ | ||
"type": "scaffold", | ||
"appBar": { | ||
"type": "appBar", | ||
"title": { | ||
"type": "text", | ||
"data": "Hero Example" | ||
} | ||
}, | ||
"body": { | ||
"type": "center", | ||
"child": { | ||
"type": "column", | ||
"mainAxisAlignment": "center", | ||
"children": [ | ||
{ | ||
"type": "hero", | ||
"tag": "hero-icon", | ||
"createRectTween": { | ||
"type": "materialRectArcTween", | ||
"begin": { | ||
"rectType": "fromCenter", | ||
"center": { | ||
"dx": 120.0, | ||
"dy": 140.0 | ||
}, | ||
"width": 100.0, | ||
"height": 100.0 | ||
}, | ||
"end": { | ||
"rectType": "fromCenter", | ||
"center": { | ||
"dx": 200.0, | ||
"dy": 200.0 | ||
}, | ||
"width": 50.0, | ||
"height": 50.0 | ||
} | ||
}, | ||
"child": { | ||
"type": "icon", | ||
"iconType": "material", | ||
"icon": "flight_takeoff", | ||
"size": 150.0 | ||
} | ||
}, | ||
{ | ||
"type": "sizedBox", | ||
"height": 24.0 | ||
}, | ||
{ | ||
"type": "textButton", | ||
"child": { | ||
"type": "text", | ||
"data": "Tap to see Hero Animation" | ||
}, | ||
"onPressed": { | ||
"actionType": "navigate", | ||
"navigationStyle": "push", | ||
"widgetJson": { | ||
"type": "scaffold", | ||
"appBar": { | ||
"type": "appBar", | ||
"title": { | ||
"type": "text", | ||
"data": "Flight Details" | ||
} | ||
}, | ||
"body": { | ||
"type": "center", | ||
"child": { | ||
"type": "column", | ||
"mainAxisAlignment": "center", | ||
"children": [ | ||
{ | ||
"type": "hero", | ||
"tag": "hero-icon", | ||
"createRectTween": { | ||
"type": "materialRectArcTween", | ||
"begin": { | ||
"rectType": "fromCenter", | ||
"center": { | ||
"dx": 120.0, | ||
"dy": 140.0 | ||
}, | ||
"width": 100.0, | ||
"height": 100.0 | ||
}, | ||
"end": { | ||
"rectType": "fromCenter", | ||
"center": { | ||
"dx": 200.0, | ||
"dy": 200.0 | ||
}, | ||
"width": 50.0, | ||
"height": 50.0 | ||
} | ||
}, | ||
"child": { | ||
"type": "icon", | ||
"iconType": "material", | ||
"icon": "flight_takeoff", | ||
"size": 50.0 | ||
} | ||
}, | ||
{ | ||
"type": "sizedBox", | ||
"height": 16.0 | ||
}, | ||
{ | ||
"type": "text", | ||
"data": "Flight AB123", | ||
"style": { | ||
"fontSize": 24.0, | ||
"fontWeight": "w500" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mirai/src/parsers/mirai_rect_tween/mirai_rect_tween.dart'; | ||
export 'package:mirai/src/parsers/mirai_hero/mirai_hero_parser.dart'; | ||
|
||
part 'mirai_hero.freezed.dart'; | ||
part 'mirai_hero.g.dart'; | ||
|
||
@freezed | ||
class MiraiHero with _$MiraiHero { | ||
const factory MiraiHero({ | ||
required Object tag, | ||
required Map<String, dynamic> child, | ||
MiraiRectTween? createRectTween, | ||
Map<String, dynamic>? flightShuttleBuilder, | ||
Map<String, dynamic>? placeholderBuilder, | ||
@Default(false) bool transitionOnUserGestures, | ||
}) = _MiraiHero; | ||
|
||
factory MiraiHero.fromJson(Map<String, dynamic> json) => | ||
_$MiraiHeroFromJson(json); | ||
} |
Oops, something went wrong.