You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
import 'package:flutter/material.dart';
|
|
import 'package:cake_wallet/palette.dart';
|
|
|
|
class FAQItem extends StatefulWidget {
|
|
FAQItem(this.title, this.text);
|
|
|
|
final String title;
|
|
final String text;
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => FAQItemState();
|
|
}
|
|
|
|
class FAQItemState extends State<FAQItem> {
|
|
bool isActive;
|
|
|
|
@override
|
|
void initState() {
|
|
isActive = false;
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final addIcon =
|
|
Icon(Icons.add, color: Theme.of(context).primaryTextTheme.title.color);
|
|
final removeIcon = Icon(Icons.remove, color: Palette.blueCraiola);
|
|
final icon = isActive ? removeIcon : addIcon;
|
|
final color = isActive
|
|
? Palette.blueCraiola
|
|
: Theme.of(context).primaryTextTheme.title.color;
|
|
|
|
return ListTileTheme(
|
|
contentPadding: EdgeInsets.fromLTRB(0, 6, 24, 6),
|
|
child: ExpansionTile(
|
|
title: Text(widget.title,
|
|
style: TextStyle(
|
|
fontSize: 14, fontWeight: FontWeight.w500, color: color)),
|
|
trailing: icon,
|
|
onExpansionChanged: (value) => setState(() => isActive = value),
|
|
children: <Widget>[
|
|
Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(
|
|
right: 24.0,
|
|
),
|
|
child: Text(
|
|
widget.text,
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.normal,
|
|
color: Theme.of(context).primaryTextTheme.title.color),
|
|
),
|
|
))
|
|
])
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|