flexprint 0.0.1 copy "flexprint: ^0.0.1" to clipboard
flexprint: ^0.0.1 copied to clipboard

outdated

Dart library allowing flex layout to console print.

FlexPrint - A Dart Library for console printing using flex layout #

Console Printing tabular reports is made easier using this library. Flexprint allows great flexibilty to the programmer to specify the table's appearance.

inport 'package:flexprint/flexprint.dart'

final fp = FlexPrint();
  fp.horizontalLine(doubleLine: true);
  fp.write('Customer Name', flex: 3);
  fp.write('Amount Due', flex: 2, alignment: Alignment.end);
  fp.write('Invoice Details', flex: 3);
  fp.write('Status', flex: 2, alignment: Alignment.center);
  fp.write('\n');
  fp.horizontalLine(doubleLine: true);
  customers.forEach((row) {
    fp.write(row.name, flex: 3);
    fp.write(row.amountDue.toString(), flex: 2, alignment: Alignment.end);
    fp.write(row.invoiceDetail, flex: 3);
    fp.write(row.status, flex: 2, alignment: Alignment.center);
    fp.write('\n');
  });
  fp.horizontalLine(char: '_');

Please see the code in example This will generate the following console output:

================================================================================
Customer Name                Amount Due Invoice Details              Status
================================================================================
John Doe & Co                   6789.12 Inv No 66987 of 06/15/20       Due
M D Rao & Co                   16789.12 Inv No 66989-92 of 08/12    Paid 10/05
________________________________________________________________________________

Line Width, Padding, Overflow #

The default line width is 80 characters long, padding is 1 character, Overflow is truncated. Any or all of these can be set through the construtor.

Adding Columns #

Any number of columns may be added through the write() method. The first column with a newline ('\n') character outputs that row and subsequent writes add to the next row.

Flex #

Each column has a default flex factor of 1. You may specify any flex number.

Alignment #

You may specify that a column be justified left - Alignment.start, center - Alignment.Center, right Alignment,end

Overflow #

If you set overflow to Overflow,wrap, FlexPrint will wrap text within the column, otherwise the overflow text is truncated to the width of column.

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Dart library allowing flex layout to console print.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on flexprint