diff --git a/packages/sanity/flutter_sanity_portable_text/CHANGELOG.md b/packages/sanity/flutter_sanity_portable_text/CHANGELOG.md index 586ca117..d3c1b0a0 100644 --- a/packages/sanity/flutter_sanity_portable_text/CHANGELOG.md +++ b/packages/sanity/flutter_sanity_portable_text/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.3.0 + + - **FEAT**: added control for scrollPhysics in PortableText. + - **FEAT**: adding the FSL license at the top level. + ## 1.2.0 - **FEAT**: switching to the FSL license with future MIT license after 2 years. diff --git a/packages/sanity/flutter_sanity_portable_text/example/pubspec.yaml b/packages/sanity/flutter_sanity_portable_text/example/pubspec.yaml index 93c1fa00..9d5f262b 100644 --- a/packages/sanity/flutter_sanity_portable_text/example/pubspec.yaml +++ b/packages/sanity/flutter_sanity_portable_text/example/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_sanity_portable_text: ^1.0.0 + flutter_sanity_portable_text: ^1.3.0 dev_dependencies: flutter_test: diff --git a/packages/sanity/flutter_sanity_portable_text/lib/ui/portable_text_widget.dart b/packages/sanity/flutter_sanity_portable_text/lib/ui/portable_text_widget.dart index 386d1d58..71513801 100644 --- a/packages/sanity/flutter_sanity_portable_text/lib/ui/portable_text_widget.dart +++ b/packages/sanity/flutter_sanity_portable_text/lib/ui/portable_text_widget.dart @@ -18,17 +18,23 @@ class PortableText extends StatelessWidget { /// only the space it needs. It is true by default. final bool shrinkwrap; + /// The scroll physics to use for the list view. + /// It is [AlwaysScrollableScrollPhysics] by default. + final ScrollPhysics scrollPhysics; + const PortableText({ super.key, required this.blocks, this.usePrimaryScroller = false, this.shrinkwrap = true, + this.scrollPhysics = const AlwaysScrollableScrollPhysics(), }); @override Widget build(final BuildContext context) { return ListView.builder( primary: usePrimaryScroller, + physics: scrollPhysics, shrinkWrap: shrinkwrap, itemCount: blocks.length, padding: EdgeInsets.zero, diff --git a/packages/sanity/flutter_sanity_portable_text/pubspec.yaml b/packages/sanity/flutter_sanity_portable_text/pubspec.yaml index 63c0aa61..9528abd4 100644 --- a/packages/sanity/flutter_sanity_portable_text/pubspec.yaml +++ b/packages/sanity/flutter_sanity_portable_text/pubspec.yaml @@ -1,5 +1,5 @@ name: flutter_sanity_portable_text -version: 1.2.0 +version: 1.3.0 description: | Flutter renderer for the Sanity.io Portable Text format with support for standard and custom blocks, spans, annotations, and styles. diff --git a/packages/sanity/sanity_client/CHANGELOG.md b/packages/sanity/sanity_client/CHANGELOG.md index 5f349ed6..872ce166 100644 --- a/packages/sanity/sanity_client/CHANGELOG.md +++ b/packages/sanity/sanity_client/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.0 + + - **FEAT**: adding the FSL license at the top level. + ## 1.1.0 - **FEAT**: switching to the FSL license with future MIT license after 2 years. diff --git a/packages/sanity/sanity_client/example/pubspec.yaml b/packages/sanity/sanity_client/example/pubspec.yaml index dc88238e..9b7c67bd 100644 --- a/packages/sanity/sanity_client/example/pubspec.yaml +++ b/packages/sanity/sanity_client/example/pubspec.yaml @@ -8,7 +8,7 @@ environment: # Add regular dependencies here. dependencies: - sanity_client: ^1.0.0 + sanity_client: ^1.2.0 dev_dependencies: lints: ^3.0.0 diff --git a/packages/sanity/sanity_client/pubspec.yaml b/packages/sanity/sanity_client/pubspec.yaml index 16bb410d..7990f84d 100644 --- a/packages/sanity/sanity_client/pubspec.yaml +++ b/packages/sanity/sanity_client/pubspec.yaml @@ -1,6 +1,6 @@ name: sanity_client description: Native Dart client to run GROQ queries and fetch documents from Sanity.io -version: 1.1.0 +version: 1.2.0 homepage: https://vyuh.tech repository: https://github.com/vyuh-tech/vyuh/tree/main/packages/sanity/sanity_client diff --git a/packages/system/vyuh_cache/CHANGELOG.md b/packages/system/vyuh_cache/CHANGELOG.md index acad4ad4..770746f7 100644 --- a/packages/system/vyuh_cache/CHANGELOG.md +++ b/packages/system/vyuh_cache/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.0 + + - **FEAT**: adding the FSL license at the top level. + ## 1.1.0 - **FEAT**: switching to the FSL license with future MIT license after 2 years. diff --git a/packages/system/vyuh_cache/pubspec.yaml b/packages/system/vyuh_cache/pubspec.yaml index f48bc926..cd91bd6e 100644 --- a/packages/system/vyuh_cache/pubspec.yaml +++ b/packages/system/vyuh_cache/pubspec.yaml @@ -1,6 +1,6 @@ name: vyuh_cache description: A generic caching package for Vyuh -version: 1.1.0 +version: 1.2.0 homepage: https://vyuh.tech repository: https://github.com/vyuh-tech/vyuh/tree/main/packages/system/vyuh_cache issue_tracker: https://github.com/vyuh-tech/vyuh/issues diff --git a/packages/system/vyuh_core/CHANGELOG.md b/packages/system/vyuh_core/CHANGELOG.md index a2abdb2c..a11f598a 100644 --- a/packages/system/vyuh_core/CHANGELOG.md +++ b/packages/system/vyuh_core/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.7.0 + + - **FEAT**: pulling some go router configuration into the default navigation plugin. + - **FEAT**: adding the FSL license at the top level. + ## 1.6.0 - **FEAT**: pulling some go router configuration into the default navigation plugin. diff --git a/packages/system/vyuh_core/pubspec.yaml b/packages/system/vyuh_core/pubspec.yaml index 0acfb61c..c9d08a8e 100644 --- a/packages/system/vyuh_core/pubspec.yaml +++ b/packages/system/vyuh_core/pubspec.yaml @@ -1,6 +1,6 @@ name: vyuh_core description: The core library for the Vyuh framework which contains the base types and runtime. -version: 1.6.0 +version: 1.7.0 homepage: https://vyuh.tech repository: https://github.com/vyuh-tech/vyuh/tree/main/packages/system/vyuh_core issue_tracker: https://github.com/vyuh-tech/vyuh/issues @@ -28,7 +28,7 @@ dependencies: mobx: ^2.3.0+1 get_it: ^7.6.4 logger: ^2.1.0 - flutter_sanity_portable_text: ^1.2.0 + flutter_sanity_portable_text: ^1.3.0 http: ^1.2.1 dev_dependencies: diff --git a/packages/system/vyuh_extension_content/CHANGELOG.md b/packages/system/vyuh_extension_content/CHANGELOG.md index 8bb7a1ed..3ddf3cf3 100644 --- a/packages/system/vyuh_extension_content/CHANGELOG.md +++ b/packages/system/vyuh_extension_content/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.4.0 + + - **FEAT**: ContentBuilder is no longer abstract, Card layout adjustments, AppBar can be toggled in default route layout, grid layout can now have single column, minor fixes in navigation action. + - **FEAT**: adding the FSL license at the top level. + ## 1.3.0 - **FEAT**: switching to the FSL license with future MIT license after 2 years. diff --git a/packages/system/vyuh_extension_content/lib/content/content_builder.dart b/packages/system/vyuh_extension_content/lib/content/content_builder.dart index 4ff2cfd8..b620d2a6 100644 --- a/packages/system/vyuh_extension_content/lib/content/content_builder.dart +++ b/packages/system/vyuh_extension_content/lib/content/content_builder.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:vyuh_core/vyuh_core.dart'; import 'package:vyuh_extension_content/vyuh_extension_content.dart'; -abstract class ContentBuilder { +class ContentBuilder { final TypeDescriptor content; final LayoutConfiguration defaultLayout; final TypeDescriptor defaultLayoutDescriptor; diff --git a/packages/system/vyuh_extension_content/pubspec.yaml b/packages/system/vyuh_extension_content/pubspec.yaml index f5f9e2f4..805bdbfd 100644 --- a/packages/system/vyuh_extension_content/pubspec.yaml +++ b/packages/system/vyuh_extension_content/pubspec.yaml @@ -1,6 +1,6 @@ name: vyuh_extension_content description: An extension for the Vyuh framework for creating CMS integrations -version: 1.3.0 +version: 1.4.0 homepage: https://vyuh.tech repository: https://github.com/vyuh-tech/vyuh/tree/main/packages/system/vyuh_extension_content issue_tracker: https://github.com/vyuh-tech/vyuh/issues @@ -22,8 +22,8 @@ dependencies: flutter_mobx: ^2.2.0+2 mobx: ^2.3.0+1 json_annotation: ^4.8.1 - vyuh_core: ^1.5.0 - flutter_sanity_portable_text: ^1.2.0 + vyuh_core: ^1.7.0 + flutter_sanity_portable_text: ^1.3.0 dev_dependencies: flutter_test: diff --git a/packages/system/vyuh_feature_developer/CHANGELOG.md b/packages/system/vyuh_feature_developer/CHANGELOG.md index 9e6c097c..3dd45823 100644 --- a/packages/system/vyuh_feature_developer/CHANGELOG.md +++ b/packages/system/vyuh_feature_developer/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.0 + + - **FEAT**: adding the FSL license at the top level. + ## 1.2.0 - **FEAT**: switching to the FSL license with future MIT license after 2 years. diff --git a/packages/system/vyuh_feature_developer/pubspec.yaml b/packages/system/vyuh_feature_developer/pubspec.yaml index a3f48789..a92bb8d5 100644 --- a/packages/system/vyuh_feature_developer/pubspec.yaml +++ b/packages/system/vyuh_feature_developer/pubspec.yaml @@ -1,6 +1,6 @@ name: vyuh_feature_developer description: A Developer-focused feature that shows all the included features in a Vyuh-enabled App -version: 1.2.0 +version: 1.3.0 homepage: https://vyuh.tech repository: https://github.com/vyuh-tech/vyuh/tree/main/packages/system/vyuh_feature_developer issue_tracker: https://github.com/vyuh-tech/vyuh/issues @@ -21,8 +21,8 @@ dependencies: go_router: ^14.0.1 flutter_sticky_header: ^0.6.5 collection: ^1.18.0 - vyuh_core: ^1.5.0 - vyuh_extension_content: ^1.3.0 + vyuh_core: ^1.7.0 + vyuh_extension_content: ^1.4.0 dev_dependencies: flutter_test: diff --git a/packages/system/vyuh_feature_system/CHANGELOG.md b/packages/system/vyuh_feature_system/CHANGELOG.md index 866a54b0..8b045ec3 100644 --- a/packages/system/vyuh_feature_system/CHANGELOG.md +++ b/packages/system/vyuh_feature_system/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.10.0 + + - **FEAT**: ContentBuilder is no longer abstract, Card layout adjustments, AppBar can be toggled in default route layout, grid layout can now have single column, minor fixes in navigation action. + - **FEAT**: adding the FSL license at the top level. + ## 1.9.0 - **FEAT**: switching to the FSL license with future MIT license after 2 years. diff --git a/packages/system/vyuh_feature_system/lib/action/drawer.g.dart b/packages/system/vyuh_feature_system/lib/action/drawer.g.dart index f0faf207..466343da 100644 --- a/packages/system/vyuh_feature_system/lib/action/drawer.g.dart +++ b/packages/system/vyuh_feature_system/lib/action/drawer.g.dart @@ -13,6 +13,7 @@ DrawerAction _$DrawerActionFromJson(Map json) => DrawerAction( DrawerActionType.open, isEndDrawer: json['isEndDrawer'] as bool? ?? false, ); + const _$DrawerActionTypeEnumMap = { DrawerActionType.open: 'open', DrawerActionType.close: 'close', diff --git a/packages/system/vyuh_feature_system/lib/action/navigation.dart b/packages/system/vyuh_feature_system/lib/action/navigation.dart index a169a5b3..c14ea097 100644 --- a/packages/system/vyuh_feature_system/lib/action/navigation.dart +++ b/packages/system/vyuh_feature_system/lib/action/navigation.dart @@ -55,7 +55,7 @@ final class NavigationAction extends ActionConfiguration { final localRoute = vyuh.router.instance.configuration.findMatch(uri.toString()); - var isLocal = localRoute.routes.any((route) => route is CMSRoute) == false; + var isLocal = localRoute.isNotEmpty; if (isLocal) { navigationType.apply(context, uri.toString()); diff --git a/packages/system/vyuh_feature_system/lib/content/card/default_layout.dart b/packages/system/vyuh_feature_system/lib/content/card/default_layout.dart index bedad022..e9c7adf1 100644 --- a/packages/system/vyuh_feature_system/lib/content/card/default_layout.dart +++ b/packages/system/vyuh_feature_system/lib/content/card/default_layout.dart @@ -6,6 +6,12 @@ import 'package:vyuh_feature_system/vyuh_feature_system.dart' as e; part 'default_layout.g.dart'; +enum _CardRenderVariant { + imageOnly, + imageAndText, + textOnly, +} + @JsonSerializable() class DefaultCardLayout extends LayoutConfiguration { static const schemaName = '${e.Card.schemaName}.layout.default'; @@ -25,52 +31,136 @@ class DefaultCardLayout extends LayoutConfiguration { @override Widget build(BuildContext context, e.Card content) { - final theme = Theme.of(context); + final variant = _getVariant(content); + + final child = switch (variant) { + _CardRenderVariant.imageOnly => _buildImageOnly(context, content), + _CardRenderVariant.imageAndText => _buildImageAndText(context, content), + _CardRenderVariant.textOnly => _buildTextOnly(context, content), + }; + + return e.PressEffect( + onTap: content.action != null + ? (context) => content.action!.execute(context) + : null, + child: child); + } + + Widget _buildImageOnly(f.BuildContext context, e.Card content) { + return f.Card( + clipBehavior: Clip.antiAlias, + child: e.ContentImage( + url: content.imageUrl?.toString(), + ref: content.image, + fit: BoxFit.cover, + ), + ); + } + + Widget _buildTextOnly(f.BuildContext context, e.Card content) { + final theme = f.Theme.of(context); final blockLength = content.content?.blocks?.length; final hasBlockContent = blockLength != null && blockLength > 0; - return e.PressEffect( - onTap: content.action != null - ? (context) => content.action!.execute(context) - : null, - child: f.Card( - color: theme.cardColor, - clipBehavior: Clip.antiAlias, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - if (content.image != null || content.imageUrl != null) - Flexible( - child: e.ContentImage( - url: content.imageUrl?.toString(), - ref: content.image, - fit: BoxFit.contain, - ), - ), - f.Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - if (content.title != null) - Text( - content.title!, - style: theme.textTheme.titleMedium, - ), - if (content.description != null) Text(content.description!), - if (hasBlockContent) - Flexible( - child: vyuh.content - .buildContent(context, content.content!)), - ], - ), + return f.Card( + color: theme.cardColor, + clipBehavior: Clip.antiAlias, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + f.Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + if (content.title != null) + Text( + content.title!, + style: theme.textTheme.titleMedium, + ), + if (content.description != null) Text(content.description!), + if (hasBlockContent) + Flexible( + child: + vyuh.content.buildContent(context, content.content!)), + ], ), - ], - ), + ), + ], ), ); } + + _buildImageAndText(f.BuildContext context, e.Card content) { + final theme = f.Theme.of(context); + + final blockLength = content.content?.blocks?.length; + final hasBlockContent = blockLength != null && blockLength > 0; + + return f.Card( + color: theme.cardColor, + clipBehavior: Clip.antiAlias, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Flexible( + child: e.ContentImage( + url: content.imageUrl?.toString(), + ref: content.image, + fit: BoxFit.cover, + ), + ), + f.Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + if (content.title != null) + Text( + content.title!, + style: + theme.textTheme.titleMedium?.apply(fontWeightDelta: 1), + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + if (content.description != null) + Text( + content.description!, + style: theme.textTheme.labelMedium, + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + if (hasBlockContent) + f.LimitedBox( + maxHeight: 50, + child: + vyuh.content.buildContent(context, content.content!)), + ], + ), + ), + ], + ), + ); + } + + _CardRenderVariant _getVariant(e.Card content) { + if (content.image != null || content.imageUrl != null) { + if (content.title != null || + content.description != null || + content.content?.blocks != null) { + return _CardRenderVariant.imageAndText; + } else { + return _CardRenderVariant.imageOnly; + } + } else { + return _CardRenderVariant.textOnly; + } + } } diff --git a/packages/system/vyuh_feature_system/lib/content/group/grid_layout.dart b/packages/system/vyuh_feature_system/lib/content/group/grid_layout.dart index 0e0b7cf9..e1182af3 100644 --- a/packages/system/vyuh_feature_system/lib/content/group/grid_layout.dart +++ b/packages/system/vyuh_feature_system/lib/content/group/grid_layout.dart @@ -19,9 +19,7 @@ final class GridGroupLayout extends LayoutConfiguration { GridGroupLayout( {this.columns = 2, this.aspectRatio = 1.0, this.allowScroll = false}) - : super(schemaType: schemaName) { - assert(columns >= 2, 'Minimum of 2 columns is required'); - } + : super(schemaType: schemaName); factory GridGroupLayout.fromJson(Map json) => _$GridGroupLayoutFromJson(json); diff --git a/packages/system/vyuh_feature_system/lib/content/route/default_layout.dart b/packages/system/vyuh_feature_system/lib/content/route/default_layout.dart index c40302ff..33a2df61 100644 --- a/packages/system/vyuh_feature_system/lib/content/route/default_layout.dart +++ b/packages/system/vyuh_feature_system/lib/content/route/default_layout.dart @@ -48,9 +48,11 @@ class DefaultRouteLayout extends LayoutConfiguration { fromJson: DefaultRouteLayout.fromJson, ); + final bool showAppBar; final List? actions; - DefaultRouteLayout({this.actions}) : super(schemaType: schemaName); + DefaultRouteLayout({this.actions, this.showAppBar = true}) + : super(schemaType: schemaName); factory DefaultRouteLayout.fromJson(Map json) => _$DefaultRouteLayoutFromJson(json); diff --git a/packages/system/vyuh_feature_system/lib/content/route/default_layout.g.dart b/packages/system/vyuh_feature_system/lib/content/route/default_layout.g.dart index de94a97f..f4239c0c 100644 --- a/packages/system/vyuh_feature_system/lib/content/route/default_layout.g.dart +++ b/packages/system/vyuh_feature_system/lib/content/route/default_layout.g.dart @@ -28,4 +28,5 @@ DefaultRouteLayout _$DefaultRouteLayoutFromJson(Map json) => actions: (json['actions'] as List?) ?.map((e) => MenuAction.fromJson(e as Map)) .toList(), + showAppBar: json['showAppBar'] as bool? ?? true, ); diff --git a/packages/system/vyuh_feature_system/lib/ui/default_page_route_layout.dart b/packages/system/vyuh_feature_system/lib/ui/default_page_route_layout.dart index 5642292e..ba0d38a9 100644 --- a/packages/system/vyuh_feature_system/lib/ui/default_page_route_layout.dart +++ b/packages/system/vyuh_feature_system/lib/ui/default_page_route_layout.dart @@ -36,17 +36,19 @@ class DefaultPageRouteLayout extends StatelessWidget { return vf.RouteContainer( content: content, child: Scaffold( - appBar: AppBar( - title: Text(content.title), - scrolledUnderElevation: 1, - shadowColor: theme.colorScheme.shadow, - actions: layout.actions - ?.map( - (e) => IconButton( - onPressed: () => e.action?.execute(context), - icon: Icon(e.icon.iconData)), - ) - .toList(growable: false)), + appBar: layout.showAppBar + ? AppBar( + title: Text(content.title), + scrolledUnderElevation: 1, + shadowColor: theme.colorScheme.shadow, + actions: layout.actions + ?.map( + (e) => IconButton( + onPressed: () => e.action?.execute(context), + icon: Icon(e.icon.iconData)), + ) + .toList(growable: false)) + : null, body: SafeArea( child: ListView.builder( itemCount: bodyItems.length, diff --git a/packages/system/vyuh_feature_system/pubspec.yaml b/packages/system/vyuh_feature_system/pubspec.yaml index 8b34f601..9774092e 100644 --- a/packages/system/vyuh_feature_system/pubspec.yaml +++ b/packages/system/vyuh_feature_system/pubspec.yaml @@ -1,6 +1,6 @@ name: vyuh_feature_system description: Provides the essential building blocks for a CMS-driven UI -version: 1.9.0 +version: 1.10.0 homepage: https://vyuh.tech repository: https://github.com/vyuh-tech/vyuh/tree/main/packages/system/vyuh_feature_system issue_tracker: https://github.com/vyuh-tech/vyuh/issues @@ -27,9 +27,9 @@ dependencies: webview_flutter: ^4.4.3 logger: ^2.0.2+1 go_router: ^14.0.1 - flutter_sanity_portable_text: ^1.2.0 - vyuh_core: ^1.5.0 - vyuh_extension_content: ^1.3.0 + flutter_sanity_portable_text: ^1.3.0 + vyuh_core: ^1.7.0 + vyuh_extension_content: ^1.4.0 json_path: ^0.7.1 url_launcher: ^6.3.0