Created
October 10, 2021 14:50
-
-
Save diamantidis/cd9b809019146f8d9ee102c7e3f63230 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TableOfContents extends StatelessWidget { | |
final List<Section> sections; | |
final void Function(Section) onItemTap; | |
const TableOfContents({ | |
Key? key, | |
this.sections = const <Section>[], | |
required this.onItemTap, | |
}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
margin: const EdgeInsets.all(20), | |
padding: const EdgeInsets.only(left: 16, top: 24, right: 16, bottom: 10), | |
decoration: BoxDecoration( | |
color: Colors.white12.withOpacity(0.3), | |
borderRadius: const BorderRadius.all(Radius.circular(8.0)), | |
border: Border.all( | |
width: 2, | |
color: Colors.grey, | |
), | |
), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: sections | |
.map((e) => SectionLink(section: e, onTap: onItemTap)) | |
.toList(), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment