-
Notifications
You must be signed in to change notification settings - Fork 67
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 #239 from Securrency-OSS/asim/page-view
feat: Added `PageView` widget parser in `mirai` widget parsers
- Loading branch information
Showing
9 changed files
with
738 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
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,60 @@ | ||
{ | ||
"type": "scaffold", | ||
"appBar": { | ||
"type": "appBar", | ||
"title": { | ||
"type": "text", | ||
"data": "PageView" | ||
} | ||
}, | ||
"body": { | ||
"type": "pageView", | ||
"children": [ | ||
{ | ||
"type": "container", | ||
"color": "#D9D9D9", | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Page 1", | ||
"style": { | ||
"fontSize": 23, | ||
"fontWeight": "w400" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "container", | ||
"color": "#FC3F1B", | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Page 2", | ||
"style": { | ||
"fontSize": 23, | ||
"fontWeight": "w400" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "container", | ||
"color": "#D9D9D9", | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Page 3", | ||
"style": { | ||
"fontSize": 23, | ||
"fontWeight": "w400" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.dart
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,32 @@ | ||
import 'package:flutter/gestures.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mirai/mirai.dart'; | ||
|
||
export 'package:mirai/src/parsers/mirai_page_view/mirai_page_view_parser.dart'; | ||
|
||
part 'mirai_page_view.freezed.dart'; | ||
part 'mirai_page_view.g.dart'; | ||
|
||
@freezed | ||
class MiraiPageView with _$MiraiPageView { | ||
const factory MiraiPageView({ | ||
@Default(Axis.horizontal) Axis scrollDirection, | ||
@Default(false) bool reverse, | ||
MiraiScrollPhysics? physics, | ||
@Default(true) bool pageSnapping, | ||
Map<String, dynamic>? onPageChanged, | ||
@Default(DragStartBehavior.start) DragStartBehavior dragStartBehavior, | ||
@Default(false) bool allowImplicitScrolling, | ||
String? restorationId, | ||
@Default(Clip.hardEdge) Clip clipBehavior, | ||
@Default(true) bool padEnds, | ||
@Default(0) int initialPage, | ||
@Default(true) keepPage, | ||
@Default(1.0) double viewportFraction, | ||
@Default([]) List<Map<String, dynamic>> children, | ||
}) = _MiraiPageView; | ||
|
||
factory MiraiPageView.fromJson(Map<String, dynamic> json) => | ||
_$MiraiPageViewFromJson(json); | ||
} |
Oops, something went wrong.