Files
eatvio_app_old/lib/widgets/custom_about_list.dart
2024-06-25 16:05:55 +03:00

57 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
class AboutList extends StatefulWidget {
final String title;
final List<String> items;
AboutList(this.title, this.items);
@override
_AboutListState createState() => _AboutListState();
}
class _AboutListState extends State<AboutList> {
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;
});
};
}
}