-
Notifications
You must be signed in to change notification settings - Fork 98
feat(genui): Add padding to some items in core catalog #589
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import 'package:json_schema_builder/json_schema_builder.dart'; | |
| import '../../model/a2ui_schemas.dart'; | ||
| import '../../model/catalog_item.dart'; | ||
| import '../../primitives/simple_items.dart'; | ||
| import 'widget_helpers.dart'; | ||
|
|
||
| final _schema = S.object( | ||
| properties: {'child': A2uiSchemas.componentReference()}, | ||
|
|
@@ -37,10 +38,12 @@ final card = CatalogItem( | |
| final cardData = _CardData.fromMap(itemContext.data as JsonMap); | ||
| return Card( | ||
| color: Theme.of(itemContext.buildContext).colorScheme.surface, | ||
| child: Padding( | ||
| padding: const EdgeInsets.all(8.0), | ||
| child: itemContext.buildChild(cardData.child), | ||
| ), | ||
| child: DebugFlags.enableLeafPadding | ||
| ? itemContext.buildChild(cardData.child) | ||
| : Padding( | ||
| padding: const EdgeInsets.all(8.0), | ||
| child: itemContext.buildChild(cardData.child), | ||
| ), | ||
|
Comment on lines
+41
to
+46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The conditional logic here can be confusing. When |
||
| ); | ||
| }, | ||
| exampleData: [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,15 @@ import '../../model/data_model.dart'; | |
| import '../../primitives/logging.dart'; | ||
| import '../../primitives/simple_items.dart'; | ||
|
|
||
| const EdgeInsets kDefaultLeafComponentPadding = EdgeInsets.symmetric( | ||
| horizontal: 16.0, | ||
| vertical: 12.0, | ||
| ); | ||
|
|
||
| class DebugFlags { | ||
| static bool enableLeafPadding = true; | ||
| } | ||
|
Comment on lines
+17
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a global static mutable variable like |
||
|
|
||
| /// Builder function for creating a widget from a template and a list of data. | ||
| /// | ||
| /// This is used by [ComponentChildrenBuilder] when children are defined by a | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Rowwidget here is redundant because theAppBar'sactionsproperty already arranges its children in a horizontal row. You can simplify the code by placing theTextandSwitchwidgets directly into theactionslist.