Skip to content

Commit

Permalink
YaruSection: allow without headline (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Feb 18, 2022
1 parent 98a61b3 commit 20b0056
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
6 changes: 0 additions & 6 deletions example/lib/pages/section_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ class _SectionPageState extends State<SectionPage> {
DummySection(width: 300),
YaruSection(
width: sectionWidth,
headline: 'Headline',
headerWidget: SizedBox(
child: CircularProgressIndicator(),
height: 20,
width: 20,
),
children: [
YaruRow(
enabled: true,
Expand Down
48 changes: 25 additions & 23 deletions lib/src/yaru_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ class YaruSection extends StatelessWidget {
/// [Widgets] as children.
const YaruSection({
Key? key,
required this.headline,
this.headline,
required this.children,
this.width,
this.headerWidget,
}) : super(key: key);

/// Text that is placed above the list of `children`.
final String headline;
final String? headline;

/// Creates a vertical list of widgets.
/// All children will be of type [Widget],
Expand Down Expand Up @@ -43,28 +43,30 @@ class YaruSection extends StatelessWidget {
),
borderRadius: BorderRadius.circular(6.0),
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: Alignment.topLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
headline,
style: Theme.of(context).textTheme.headline6,
textAlign: TextAlign.left,
child: headline != null && headerWidget != null
? Column(
children: [
Padding(
padding: const EdgeInsets.all(8),
child: Align(
alignment: Alignment.topLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
headline!,
style: Theme.of(context).textTheme.headline6,
textAlign: TextAlign.left,
),
headerWidget ?? const SizedBox()
],
),
),
headerWidget ?? const SizedBox()
],
),
),
),
Column(children: children)
],
),
),
Column(children: children)
],
)
: Column(children: children),
)),
);
}
Expand Down

0 comments on commit 20b0056

Please sign in to comment.