import 'package:fcs/domain/entities/discount.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; import 'package:intl/intl.dart'; typedef OnSelect(Discount discount); class DiscountListRow extends StatelessWidget { final OnSelect? onSelect; final Discount discount; DiscountListRow({Key? key, required this.discount, this.onSelect}) : super(key: key); final DateFormat dateFormat = new DateFormat("dd MMM yyyy"); @override Widget build(BuildContext context) { return InkWell( onTap: () { onSelect!(discount); }, child: Container( padding: EdgeInsets.only(left: 15, right: 15), child: Row( children: [ Expanded( child: new Padding( padding: const EdgeInsets.symmetric(vertical: 13), child: new Row( children: [ Icon(Entypo.price_ribbon, color: primaryColor, size: 30), new Expanded( child: Padding( padding: const EdgeInsets.only(left: 15), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ new Text( discount.code ?? "", style: new TextStyle( fontSize: 15.0, color: Colors.black), ), Padding( padding: const EdgeInsets.only(top: 5), child: new Text( discount.customerName ?? "", style: new TextStyle( fontSize: 15.0, color: Colors.grey), ), ) ], ), ), ), ], ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text(discount.status ?? ''), Padding( padding: const EdgeInsets.only( top: 5, ), child: Row( children: [ new Text( "${discount.amount.toStringAsFixed(2)}", style: new TextStyle(fontSize: 15.0, color: Colors.grey), ), ], ), ), ], ) ], ), ), ); } }