Skip to content

Commit

Permalink
feat: Adding decoration. #4
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Apr 27, 2023
1 parent 9746123 commit 62ef04c
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions lib/tiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,38 @@ class _MenuItemState extends State<MenuItem> {
Widget build(BuildContext context) {
// If the tile's children is empty, we render the leaf tile
if (widget.info.tiles.isEmpty) {
return ListTile(
contentPadding: EdgeInsets.only(left: widget.leftPadding),
title: Text(widget.info.title,
style: const TextStyle(
fontSize: 25,
color: Colors.white,
)));
return Container(
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.white))),
child: ListTile(
contentPadding: EdgeInsets.only(left: widget.leftPadding),
title: Text(widget.info.title,
style: const TextStyle(
fontSize: 25,
color: Colors.white,
))),
);
}

// If the tile has children, we render this as an expandable tile.
else {
return ExpansionTile(
tilePadding: EdgeInsets.only(left: widget.leftPadding),
title: Text(widget.info.title,
style: const TextStyle(
fontSize: 25,
color: Colors.white,
)),
trailing: Icon(
_expanded ? Icons.expand_less : Icons.arrow_drop_down,
color: Colors.white,
return Container(
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.white))),
child: ExpansionTile(
tilePadding: EdgeInsets.only(left: widget.leftPadding),
title: Text(widget.info.title,
style: const TextStyle(
fontSize: 25,
color: Colors.white,
)),
trailing: Icon(
_expanded ? Icons.expand_less : Icons.arrow_drop_down,
color: Colors.white,
),
children: widget.info.tiles.map((tile) => MenuItem(info: tile, leftPadding: widget.leftPadding + 16)).toList(),
onExpansionChanged: (bool expanded) {
setState(() => _expanded = expanded);
},
),
children: widget.info.tiles.map((tile) => MenuItem(info: tile, leftPadding: widget.leftPadding + 16)).toList(),
onExpansionChanged: (bool expanded) {
setState(() => _expanded = expanded);
},
);
}
}
Expand Down

0 comments on commit 62ef04c

Please sign in to comment.