Skip to content

Commit

Permalink
feat: adding repaint boundaries and fixing grid and single item layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanpodila committed Jun 29, 2024
1 parent de612a7 commit d50a40e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final defaultPlatformWidgetBuilder = PlatformWidgetBuilder(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
CircularProgressIndicator(),
RepaintBoundary(child: CircularProgressIndicator()),
PoweredByWidget(),
],
),
Expand Down Expand Up @@ -123,9 +123,11 @@ class _DefaultRouteLoaderState extends State<_DefaultRouteLoader> {
children: [
FractionallySizedBox(
widthFactor: 0.5,
child: LinearProgressIndicator(
backgroundColor: progressColor.withOpacity(0.25),
color: progressColor,
child: RepaintBoundary(
child: LinearProgressIndicator(
backgroundColor: progressColor.withOpacity(0.25),
color: progressColor,
),
),
),
const PoweredByWidget(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ final class GridGroupLayout extends LayoutConfiguration<Group> {
@JsonKey(defaultValue: 1.0)
final double aspectRatio;

final bool allowScroll;
final bool scrollable;

GridGroupLayout(
{this.columns = 2, this.aspectRatio = 1.0, this.allowScroll = false})
{this.columns = 2, this.aspectRatio = 1.0, this.scrollable = false})
: super(schemaType: schemaName);

factory GridGroupLayout.fromJson(Map<String, dynamic> json) =>
Expand All @@ -30,7 +30,7 @@ final class GridGroupLayout extends LayoutConfiguration<Group> {
final gridContent = GridView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: allowScroll
physics: scrollable
? const AlwaysScrollableScrollPhysics()
: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
Expand All @@ -56,7 +56,7 @@ final class GridGroupLayout extends LayoutConfiguration<Group> {
padding: const EdgeInsets.only(left: 4.0, right: 4.0, bottom: 4.0),
child: Text(content.description!, style: theme.textTheme.bodySmall),
),
if (allowScroll) Expanded(child: gridContent) else gridContent,
if (scrollable) Expanded(child: gridContent) else gridContent,
],
);
}
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 @@ -23,27 +23,34 @@ final class ListGroupLayout extends LayoutConfiguration<Group> {
@override
Widget build(BuildContext context, Group content) {
final theme = Theme.of(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (content.title != null)
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(content.title!, style: theme.textTheme.titleMedium),
),
if (content.description != null)
Padding(
padding: const EdgeInsets.only(left: 4.0, right: 4.0, bottom: 4.0),
child: Text(content.description!, style: theme.textTheme.bodySmall),
),
Expanded(
child: ListView.builder(
itemCount: content.items.length,
itemBuilder: (context, index) =>
vyuh.content.buildContent(context, content.items[index]),
final maxScreenHeight = MediaQuery.sizeOf(context).height * 0.8;

return LimitedBox(
maxHeight: maxScreenHeight,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (content.title != null)
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(content.title!, style: theme.textTheme.titleMedium),
),
if (content.description != null)
Padding(
padding:
const EdgeInsets.only(left: 4.0, right: 4.0, bottom: 4.0),
child:
Text(content.description!, style: theme.textTheme.bodySmall),
),
Expanded(
child: ListView.builder(
itemCount: content.items.length,
itemBuilder: (context, index) =>
vyuh.content.buildContent(context, content.items[index]),
),
),
),
],
],
),
);
}
}

0 comments on commit d50a40e

Please sign in to comment.