Skip to content

Commit

Permalink
refactor: Sorted page-view parser properties and added support for on…
Browse files Browse the repository at this point in the history
…PageChanged
  • Loading branch information
i-asimkhan committed Jan 18, 2024
1 parent 7fe8c17 commit 9aaac17
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 67 deletions.
56 changes: 28 additions & 28 deletions examples/mirai_gallery/assets/json/home_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,18 +646,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "table_rows"
"icon": "table_chart"
},
"title": {
"type": "text",
"data": "Mirai Row",
"data": "Mirai PageView",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "Layout a list of child widgets in the horizontal direction",
"data": "A Material Design widget that displays a horizontal row of pages",
"style": {
"fontSize": 12
}
Expand All @@ -668,7 +668,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/row_example.json"
"assetPath": "assets/json/page_view_example.json"
}
}
},
Expand All @@ -677,18 +677,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "widgets"
"icon": "table_rows"
},
"title": {
"type": "text",
"data": "Mirai Scaffold",
"data": "Mirai Row",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "Implements the basic Material Design visual layout structure",
"data": "Layout a list of child widgets in the horizontal direction",
"style": {
"fontSize": 12
}
Expand All @@ -699,7 +699,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/scaffold_example.json"
"assetPath": "assets/json/row_example.json"
}
}
},
Expand All @@ -708,18 +708,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "swipe_down"
"icon": "widgets"
},
"title": {
"type": "text",
"data": "Mirai Scroll View",
"data": "Mirai Scaffold",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A box in which a single widget can be scrolled",
"data": "Implements the basic Material Design visual layout structure",
"style": {
"fontSize": 12
}
Expand All @@ -730,7 +730,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/scroll_view_example.json"
"assetPath": "assets/json/scaffold_example.json"
}
}
},
Expand All @@ -739,18 +739,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "space_bar"
"icon": "swipe_down"
},
"title": {
"type": "text",
"data": "Mirai Sizedbox",
"data": "Mirai Scroll View",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A box with a specified size. If given a child, this widget forces its child to have a specific dimensions.",
"data": "A box in which a single widget can be scrolled",
"style": {
"fontSize": 12
}
Expand All @@ -761,7 +761,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/sized_box_example.json"
"assetPath": "assets/json/scroll_view_example.json"
}
}
},
Expand All @@ -770,18 +770,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "toggle_on"
"icon": "space_bar"
},
"title": {
"type": "text",
"data": "Mirai Switch",
"data": "Mirai Sizedbox",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A switch component that can be toggled via dragging or tapping on it.",
"data": "A box with a specified size. If given a child, this widget forces its child to have a specific dimensions.",
"style": {
"fontSize": 12
}
Expand All @@ -792,7 +792,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/switch_example.json"
"assetPath": "assets/json/sized_box_example.json"
}
}
},
Expand All @@ -801,18 +801,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "space_bar"
"icon": "toggle_on"
},
"title": {
"type": "text",
"data": "Mirai Fractionally Sizedbox",
"data": "Mirai Switch",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A widget that sizes its child to a fraction of the total available space.",
"data": "A switch component that can be toggled via dragging or tapping on it.",
"style": {
"fontSize": 12
}
Expand All @@ -823,7 +823,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/fractionally_sized_box_example.json"
"assetPath": "assets/json/switch_example.json"
}
}
},
Expand All @@ -832,18 +832,18 @@
"leading": {
"type": "icon",
"iconType": "material",
"icon": "table_chart"
"icon": "space_bar"
},
"title": {
"type": "text",
"data": "Mirai PageView",
"data": "Mirai Fractionally Sizedbox",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A Material Design widget that displays a horizontal row of pages",
"data": "A widget that sizes its child to a fraction of the total available space.",
"style": {
"fontSize": 12
}
Expand All @@ -854,7 +854,7 @@
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/page_view_example.json"
"assetPath": "assets/json/fractionally_sized_box_example.json"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ 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(DragStartBehavior.start) DragStartBehavior dragStartBehavior,
@Default(true) bool padEnds,
@Default(0) int initialPage,
@Default(true) keepPage,
String? restorationId,
MiraiScrollPhysics? physics,
@Default(true) bool pageSnapping,
@Default(true) bool padEnds,
@Default(false) bool reverse,
@Default(Axis.horizontal) Axis scrollDirection,
@Default(1.0) double viewportFraction,
@Default([]) List<Map<String, dynamic>> children,
}) = _MiraiPageView;
Expand Down
Loading

0 comments on commit 9aaac17

Please sign in to comment.