import 'package:fcs/domain/entities/carton.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; typedef OnRemove(Carton carton); class CartonRow extends StatelessWidget { final Carton box; final OnRemove onRemove; CartonRow({Key key, this.box, this.onRemove}) : super(key: key); final double dotSize = 15.0; final DateFormat dateFormat = new DateFormat("dd MMM yyyy"); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( border: Border( bottom: BorderSide(color: Colors.grey[300]), ), ), child: Row( children: [ Expanded( child: new Padding( padding: const EdgeInsets.symmetric(vertical: 13.0), child: new Row( children: [ Container( padding: EdgeInsets.only(left: 5, right: 10), child: Icon( MaterialCommunityIcons.package, color: primaryColor, size: 30, ), ), new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8.0), child: new Text( box.cartonNumber ?? "", style: new TextStyle( fontSize: 15.0, color: Colors.black), ), ), Padding( padding: const EdgeInsets.only(left: 10.0, top: 10), child: new Text( box.userName ?? "", style: new TextStyle( fontSize: 15.0, color: Colors.grey), ), ) ], ), ), ], ), ), ), Column( children: [ onRemove == null ? Container() : IconButton( icon: Icon( Icons.remove_circle, color: primaryColor, ), onPressed: () { if (onRemove != null) onRemove(box); }), box.actualWeight == 0 ? Container() : Padding( padding: const EdgeInsets.only(left: 8.0, bottom: 5), child: Row( children: [ new Text( "${box.actualWeight?.toStringAsFixed(2) ?? ''} lb", style: new TextStyle( fontSize: 15.0, color: Colors.grey), ), ], ), ), ], ), ], ), ); } }