import 'package:flutter/material.dart'; class AboutList extends StatefulWidget { final String title; final List items; AboutList(this.title, this.items); @override _AboutListState createState() => _AboutListState(); } class _AboutListState extends State { bool isExpanded = false; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ GestureDetector( onTap: toggleList(), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( widget.title, style: TextStyle( color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold), ), Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down), ], ), ), if (isExpanded) Padding( padding: const EdgeInsets.only(left: 16.0), child: Column( //children: widget.items.map((item) => Text(item)).toList(), children: [Text(widget.items.join('\n'))]), ), Divider(), ], ); } toggleList() { return () { setState(() { isExpanded = !isExpanded; }); }; } }