2020-05-06 17:40:36 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-11-17 18:16:58 +00:00
|
|
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2020-05-06 17:40:36 +00:00
|
|
|
|
|
|
|
class AccountTile extends StatelessWidget {
|
|
|
|
AccountTile({
|
|
|
|
@required this.isCurrent,
|
|
|
|
@required this.accountName,
|
2020-11-17 18:16:58 +00:00
|
|
|
@required this.onTap,
|
|
|
|
@required this.onEdit
|
2020-05-06 17:40:36 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
final bool isCurrent;
|
|
|
|
final String accountName;
|
2020-11-17 18:16:58 +00:00
|
|
|
final Function() onTap;
|
|
|
|
final Function() onEdit;
|
2020-05-06 17:40:36 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-08-19 17:57:06 +00:00
|
|
|
final color = isCurrent
|
|
|
|
? Theme.of(context).textTheme.subtitle.decorationColor
|
|
|
|
: Theme.of(context).textTheme.display4.decorationColor;
|
|
|
|
final textColor = isCurrent
|
|
|
|
? Theme.of(context).textTheme.subtitle.color
|
|
|
|
: Theme.of(context).textTheme.display4.color;
|
2020-05-06 17:40:36 +00:00
|
|
|
|
2020-11-17 18:16:58 +00:00
|
|
|
final Widget cell = GestureDetector(
|
2020-05-06 17:40:36 +00:00
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
height: 77,
|
|
|
|
padding: EdgeInsets.only(left: 24, right: 24),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
color: color,
|
|
|
|
child: Text(
|
|
|
|
accountName,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18,
|
2020-09-26 19:17:31 +00:00
|
|
|
fontWeight: FontWeight.w600,
|
2020-11-11 15:55:18 +00:00
|
|
|
fontFamily: 'Lato',
|
2020-05-06 17:40:36 +00:00
|
|
|
color: textColor,
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2020-11-17 18:16:58 +00:00
|
|
|
|
|
|
|
return isCurrent ? cell : Slidable(
|
|
|
|
key: Key(accountName),
|
|
|
|
child: cell,
|
|
|
|
actionPane: SlidableDrawerActionPane(),
|
|
|
|
secondaryActions: <Widget>[
|
|
|
|
IconSlideAction(
|
|
|
|
caption: S.of(context).edit,
|
|
|
|
color: Colors.blue,
|
|
|
|
icon: Icons.edit,
|
|
|
|
onTap: () => onEdit?.call())
|
|
|
|
]);
|
2020-05-06 17:40:36 +00:00
|
|
|
}
|
|
|
|
}
|