Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: Adding SliverAppBar & CustomScrollView #203

Merged
merged 5 commits into from
Feb 26, 2025
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
2 changes: 1 addition & 1 deletion examples/counter_example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ packages:
path: "../../packages/stac"
relative: true
source: path
version: "0.9.3"
version: "0.10.0"
stac_framework:
dependency: "direct overridden"
description:
Expand Down
34 changes: 34 additions & 0 deletions examples/stac_gallery/assets/json/home_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,40 @@
}
}
},
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "cupertino",
"icon": "app_fill"
},
"title": {
"type": "text",
"data": "Stac Sliver App Bar",
"align": "center",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A Material Design Sliver App Bar widget",
"align": "center",
"style": {
"fontSize": 12
}
},
"isThreeLine": true,
"style": "list",
"onTap": {
"actionType": "navigate",
"navigationStyle": "push",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/sliver_app_bar_example.json"
}
}
},
{
"type": "listTile",
"leading": {
Expand Down
54 changes: 54 additions & 0 deletions examples/stac_gallery/assets/json/sliver_app_bar_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"type": "scaffold",
"body": {
"type": "customScrollView",
"slivers": [
{
"type": "sliverAppBar",
"title": {
"type": "text",
"data": "SliverAppBar"
},
"leading": {
"type": "iconButton",
"icon": {
"type": "icon",
"iconType": "material",
"icon": "menu"
},
"onPressed": {}
},
"backgroundColor": "primary",
"actions": [
{
"type": "iconButton",
"icon": {
"type": "icon",
"iconType": "cupertino",
"icon": "heart_solid"
},
"onPressed": {}
},
{
"type": "iconButton",
"icon": {
"type": "icon",
"iconType": "material",
"icon": "search"
},
"onPressed": {}
},
{
"type": "iconButton",
"icon": {
"type": "icon",
"iconType": "material",
"icon": "more_horiz"
},
"onPressed": {}
}
]
}
]
}
}
2 changes: 1 addition & 1 deletion examples/stac_gallery/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ packages:
path: "../../packages/stac"
relative: true
source: path
version: "0.9.3"
version: "0.10.0"
stac_framework:
dependency: "direct overridden"
description:
Expand Down
4 changes: 4 additions & 0 deletions packages/stac/lib/src/framework/stac.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:stac/src/action_parsers/action_parsers.dart';
import 'package:stac/src/action_parsers/stac_network_request/stac_network_request_parser.dart';
import 'package:stac/src/framework/stac_registry.dart';
import 'package:stac/src/parsers/parsers.dart';
import 'package:stac/src/parsers/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart';
import 'package:stac/src/parsers/stac_sliver_app_bar/stac_sliver_app_bar_parser.dart';
import 'package:stac/src/services/stac_network_service.dart';
import 'package:stac/src/utils/log.dart';
import 'package:stac_framework/stac_framework.dart';
Expand Down Expand Up @@ -37,6 +39,7 @@ class Stac {
const StacCenterParser(),
const StacRowParser(),
const StacColumnParser(),
const StacCustomScrollViewParser(),
const StacStackParser(),
const StacPositionedParser(),
const StacIconButtonParser(),
Expand Down Expand Up @@ -89,6 +92,7 @@ class Stac {
const StacRadioParser(),
const StacRadioGroupParser(),
const StacSliderParser(),
const StacSliverAppBarParser(),
const StacOpacityParser(),
const StacPlaceholderParser(),
const StacAspectRatioParser(),
Expand Down
2 changes: 2 additions & 0 deletions packages/stac/lib/src/parsers/parsers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export 'package:stac/src/parsers/stac_circular_progress_indicator/stac_circular_
export 'package:stac/src/parsers/stac_colored_box/stac_colored_box.dart';
export 'package:stac/src/parsers/stac_column/stac_column.dart';
export 'package:stac/src/parsers/stac_container/stac_container.dart';
export 'package:stac/src/parsers/stac_custom_scroll_view/stac_custom_scroll_view.dart';
export 'package:stac/src/parsers/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller.dart';
export 'package:stac/src/parsers/stac_default_tab_controller/stac_default_tab_controller.dart';
export 'package:stac/src/parsers/stac_dialog_theme/stac_dialog_theme.dart';
Expand Down Expand Up @@ -74,6 +75,7 @@ export 'package:stac/src/parsers/stac_single_child_scroll_view/stac_single_child
export 'package:stac/src/parsers/stac_size/stac_size.dart';
export 'package:stac/src/parsers/stac_sized_box/stac_sized_box.dart';
export 'package:stac/src/parsers/stac_slider/stac_slider.dart';
export 'package:stac/src/parsers/stac_sliver_app_bar/stac_sliver_app_bar.dart';
export 'package:stac/src/parsers/stac_spacer/stac_spacer.dart';
export 'package:stac/src/parsers/stac_stack/stac_stack.dart';
export 'package:stac/src/parsers/stac_switch/stac_switch.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:stac/src/utils/stac_scroll_physics.dart';

part 'stac_custom_scroll_view.freezed.dart';
part 'stac_custom_scroll_view.g.dart';

@freezed
class StacCustomScrollView with _$StacCustomScrollView {
const factory StacCustomScrollView({
@Default([]) List<Map<String, dynamic>> slivers,
@Default(Axis.vertical) Axis scrollDirection,
@Default(false) bool reverse,
bool? primary,
StacScrollPhysics? physics,
@Default(false) bool shrinkWrap,
@Default(0.0) double anchor,
double? cacheExtent,
int? semanticChildCount,
@Default(DragStartBehavior.start) DragStartBehavior dragStartBehavior,
@Default(ScrollViewKeyboardDismissBehavior.manual)
ScrollViewKeyboardDismissBehavior keyboardDismissBehavior,
String? restorationId,
@Default(Clip.hardEdge) Clip clipBehavior,
@Default(HitTestBehavior.opaque) HitTestBehavior hitTestBehavior,
}) = _StacCustomScrollView;

factory StacCustomScrollView.fromJson(Map<String, dynamic> json) =>
_$StacCustomScrollViewFromJson(json);
}
Loading