From 62ef04ca8eeffa5f061273ad4f0f3e6109aa3ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lui=CC=81s=20Arteiro?= Date: Thu, 27 Apr 2023 22:26:25 +0100 Subject: [PATCH] feat: Adding decoration. #4 --- lib/tiles.dart | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/tiles.dart b/lib/tiles.dart index 93cd68c..8f2d436 100644 --- a/lib/tiles.dart +++ b/lib/tiles.dart @@ -37,32 +37,38 @@ class _MenuItemState extends State { 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); - }, ); } }