File tree Expand file tree Collapse file tree 11 files changed +878
-71
lines changed
examples/stac_gallery/assets/json Expand file tree Collapse file tree 11 files changed +878
-71
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "type" : " scaffold" ,
3+ "appBar" : {
4+ "type" : " appBar" ,
5+ "title" : {
6+ "type" : " text" ,
7+ "data" : " Users List"
8+ }
9+ },
10+ "body" : {
11+ "type" : " dynamicView" ,
12+ "request" : {
13+ "url" : " https://dummyjson.com/users" ,
14+ "method" : " get"
15+ },
16+ "targetPath" : " users" ,
17+ "template" : {
18+ "type" : " listView" ,
19+ "ItemTemplate" : {
20+ "type" : " listTile" ,
21+ "title" : {
22+ "type" : " text" ,
23+ "data" : " {{firstName}} {{lastName}}"
24+ },
25+ "subtitle" : {
26+ "type" : " text" ,
27+ "data" : " {{email}}"
28+ },
29+ "leading" : {
30+ "type" : " circleAvatar" ,
31+ "backgroundImage" : " {{image}}"
32+ }
33+ }
34+ }
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ {
2+ "type" : " scaffold" ,
3+ "appBar" : {
4+ "type" : " appBar" ,
5+ "title" : {
6+ "type" : " text" ,
7+ "data" : " User Profile"
8+ }
9+ },
10+ "body" : {
11+ "type" : " dynamicView" ,
12+ "request" : {
13+ "url" : " https://dummyjson.com/users/1" ,
14+ "method" : " get"
15+ },
16+ "template" : {
17+ "type" : " column" ,
18+ "children" : [
19+ {
20+ "type" : " container" ,
21+ "padding" : 16 ,
22+ "child" : {
23+ "type" : " column" ,
24+ "crossAxisAlignment" : " start" ,
25+ "children" : [
26+ {
27+ "type" : " image" ,
28+ "src" : " {{image}}" ,
29+ "width" : 100 ,
30+ "height" : 100
31+ },
32+ {
33+ "type" : " text" ,
34+ "style" : {
35+ "fontSize" : 24 ,
36+ "fontWeight" : " w700"
37+ },
38+ "data" : " {{firstName}} {{lastName}}"
39+ },
40+ {
41+ "type" : " sizedBox" ,
42+ "height" : 8
43+ },
44+ {
45+ "type" : " text" ,
46+ "style" : {
47+ "fontSize" : 16 ,
48+ "color" : " #666666"
49+ },
50+ "data" : " Email: {{email}}"
51+ },
52+ {
53+ "type" : " text" ,
54+ "style" : {
55+ "fontSize" : 16 ,
56+ "color" : " #666666"
57+ },
58+ "data" : " Phone: {{phone}}"
59+ },
60+ {
61+ "type" : " text" ,
62+ "style" : {
63+ "fontSize" : 16 ,
64+ "color" : " #666666"
65+ },
66+ "data" : " Age: {{age}}"
67+ }
68+ ]
69+ }
70+ }
71+ ]
72+ }
73+ }
74+ }
Original file line number Diff line number Diff line change 15641564 "iconType" : " material" ,
15651565 "icon" : " navigation"
15661566 },
1567-
15681567 "title" : {
15691568 "type" : " text" ,
15701569 "data" : " Stac Opacity" ,
15891588 }
15901589 }
15911590 },
1592-
15931591 {
15941592 "type" : " listTile" ,
15951593 "leading" : {
15961594 "type" : " icon" ,
15971595 "iconType" : " material" ,
15981596 "icon" : " apartment"
15991597 },
1600-
16011598 "title" : {
16021599 "type" : " text" ,
16031600 "data" : " Placeholder" ,
16221619 }
16231620 }
16241621 },
1625-
1626-
16271622 {
16281623 "type" : " listTile" ,
16291624 "leading" : {
16631658 "behavior" : " floating"
16641659 }
16651660 },
1666-
16671661 {
16681662 "type" : " listTile" ,
16691663 "leading" : {
16701664 "type" : " icon" ,
16711665 "iconType" : " material" ,
16721666 "icon" : " apartment"
16731667 },
1674-
16751668 "title" : {
16761669 "type" : " text" ,
16771670 "data" : " Stac AspectRatio" ,
16961689 }
16971690 }
16981691 },
1699-
17001692 {
17011693 "type" : " listTile" ,
17021694 "leading" : {
17031695 "type" : " icon" ,
17041696 "iconType" : " material" ,
17051697 "icon" : " apartment"
17061698 },
1707-
17081699 "title" : {
17091700 "type" : " text" ,
17101701 "data" : " Stac FittedBox" ,
17291720 }
17301721 }
17311722 },
1732-
17331723 {
17341724 "type" : " listTile" ,
17351725 "leading" : {
17361726 "type" : " icon" ,
17371727 "iconType" : " material" ,
17381728 "icon" : " apartment"
17391729 },
1740-
17411730 "title" : {
17421731 "type" : " text" ,
17431732 "data" : " Stac LimitedBox" ,
17621751 }
17631752 }
17641753 },
1765-
1766-
17671754 {
1768- "type" : " sizedBox" ,
1769- "height" : 24.0
1755+ "type" : " listTile" ,
1756+ "leading" : {
1757+ "type" : " icon" ,
1758+ "iconType" : " material" ,
1759+ "icon" : " api"
1760+ },
1761+ "title" : {
1762+ "type" : " text" ,
1763+ "data" : " Stac Dynamic View" ,
1764+ "style" : {
1765+ "fontSize" : 21
1766+ }
1767+ },
1768+ "subtitle" : {
1769+ "type" : " text" ,
1770+ "data" : " Fetch data from APIs and render it using templates" ,
1771+ "style" : {
1772+ "fontSize" : 12
1773+ }
1774+ },
1775+ "isThreeLine" : true ,
1776+ "onTap" : {
1777+ "actionType" : " navigate" ,
1778+ "navigationStyle" : " push" ,
1779+ "widgetJson" : {
1780+ "type" : " exampleScreen" ,
1781+ "assetPath" : " assets/json/dynamic_view_example.json"
1782+ }
1783+ }
1784+ },
1785+ {
1786+ "type" : " listTile" ,
1787+ "leading" : {
1788+ "type" : " icon" ,
1789+ "iconType" : " material" ,
1790+ "icon" : " api"
1791+ },
1792+ "title" : {
1793+ "type" : " text" ,
1794+ "data" : " Stac Dynamic List View" ,
1795+ "style" : {
1796+ "fontSize" : 21
1797+ }
1798+ },
1799+ "subtitle" : {
1800+ "type" : " text" ,
1801+ "data" : " Fetch data from APIs and render it using templates" ,
1802+ "style" : {
1803+ "fontSize" : 12
1804+ }
1805+ },
1806+ "isThreeLine" : true ,
1807+ "onTap" : {
1808+ "actionType" : " navigate" ,
1809+ "navigationStyle" : " push" ,
1810+ "widgetJson" : {
1811+ "type" : " exampleScreen" ,
1812+ "assetPath" : " assets/json/dynamic_list_view_example.json"
1813+ }
1814+ }
17701815 }
1771- ]
1816+ ]
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ class Stac {
9898 const StacAspectRatioParser (),
9999 const StacFittedBoxParser (),
100100 const StacLimitedBoxParser (),
101+ const StacDynamicViewParser (),
101102 ];
102103
103104 static final _actionParsers = < StacActionParser > [
Original file line number Diff line number Diff line change @@ -92,3 +92,4 @@ export 'package:stac/src/parsers/stac_text_form_field/stac_text_form_field.dart'
9292export 'package:stac/src/parsers/stac_text_style/stac_text_style.dart' ;
9393export 'package:stac/src/parsers/stac_theme/stac_theme.dart' ;
9494export 'package:stac/src/parsers/stac_wrap/stac_wrap.dart' ;
95+ export 'package:stac/src/parsers/stac_dynamic_view/stac_dynamic_view.dart' ;
Original file line number Diff line number Diff line change 1+ import 'package:freezed_annotation/freezed_annotation.dart' ;
2+ import 'package:stac/src/action_parsers/stac_network_request/stac_network_request.dart' ;
3+
4+ export 'stac_dynamic_view_parser.dart' ;
5+
6+ part 'stac_dynamic_view.freezed.dart' ;
7+ part 'stac_dynamic_view.g.dart' ;
8+
9+ /// A model class for the StacDynamicView parser.
10+ /// This parser fetches data dynamically and renders it using a template.
11+ @freezed
12+ class StacDynamicView with _$StacDynamicView {
13+ const factory StacDynamicView ({
14+ required StacNetworkRequest request,
15+ @Default ('' ) String targetPath,
16+ required Map <String , dynamic > template,
17+ }) = _StacDynamicView ;
18+
19+ factory StacDynamicView .fromJson (Map <String , dynamic > json) =>
20+ _$StacDynamicViewFromJson (json);
21+ }
You can’t perform that action at this time.
0 commit comments