Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pavan/wonderous #7

Merged
merged 3 commits into from
Jun 28, 2024
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
5 changes: 5 additions & 0 deletions packages/sanity/flutter_sanity_portable_text/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/flutter_sanity_portable_text/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 4 additions & 0 deletions packages/sanity/sanity_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/sanity_client/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/sanity/sanity_client/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions packages/system/vyuh_cache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/system/vyuh_cache/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions packages/system/vyuh_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/system/vyuh_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions packages/system/vyuh_extension_content/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends ContentItem> {
class ContentBuilder<T extends ContentItem> {
final TypeDescriptor<T> content;
final LayoutConfiguration<T> defaultLayout;
final TypeDescriptor<LayoutConfiguration> defaultLayoutDescriptor;
Expand Down
6 changes: 3 additions & 3 deletions packages/system/vyuh_extension_content/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions packages/system/vyuh_feature_developer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions packages/system/vyuh_feature_developer/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions packages/system/vyuh_feature_system/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
170 changes: 130 additions & 40 deletions packages/system/vyuh_feature_system/lib/content/card/default_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<e.Card> {
static const schemaName = '${e.Card.schemaName}.layout.default';
Expand All @@ -25,52 +31,136 @@ class DefaultCardLayout extends LayoutConfiguration<e.Card> {

@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;
}
}
}
Loading
Loading