Renders style-able flex ascii tables.
main() {
final Table tab = table(['Player', 'Team', 'Goals'])
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
print(tab);
}
┌──────────────────┬────────────┬─────┐
│Player │Team │Goals│
┝━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━┿━━━━━┥
│Messi │Barcelona FC│80 │
├──────────────────┼────────────┼─────┤
│Christiano Ronaldo│Real Madrid │30 │
├──────────────────┼────────────┼─────┤
│Luiz Suarez │Barcelona FC│50 │
└──────────────────┴────────────┴─────┘
final Table tab = table(['Player', 'Team', 'Goals'],
colWidths: [fixed(25), fixed(25), fixed(10)], globalAlign: Align.center)
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
┌─────────────────────────┬─────────────────────────┬──────────┐
│ Player │ Team │ Goals │
┝━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━┥
│ Messi │ Barcelona FC │ 80 │
├─────────────────────────┼─────────────────────────┼──────────┤
│ Christiano Ronaldo │ Real Madrid │ 30 │
├─────────────────────────┼─────────────────────────┼──────────┤
│ Luiz Suarez │ Barcelona FC │ 50 │
└─────────────────────────┴─────────────────────────┴──────────┘
final Table tab = table(['Player', 'Team', 'Goals'],
colWidths: [fixed(25), fixed(25), fixed(10)],
aligns: [Align.left, Align.center, Align.right])
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
┌─────────────────────────┬─────────────────────────┬──────────┐
│Player │ Team │ Goals│
┝━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━┥
│Messi │ Barcelona FC │ 80│
├─────────────────────────┼─────────────────────────┼──────────┤
│Christiano Ronaldo │ Real Madrid │ 30│
├─────────────────────────┼─────────────────────────┼──────────┤
│Luiz Suarez │ Barcelona FC │ 50│
└─────────────────────────┴─────────────────────────┴──────────┘
final Table tab = table(['Player', 'Team', 'Goals'],
globalPadding: pad(before: 2, after: 2))
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
┌──────────────────────┬────────────────┬─────────┐
│ Player │ Team │ Goals │
┝━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━┿━━━━━━━━━┥
│ Messi │ Barcelona FC │ 80 │
├──────────────────────┼────────────────┼─────────┤
│ Christiano Ronaldo │ Real Madrid │ 30 │
├──────────────────────┼────────────────┼─────────┤
│ Luiz Suarez │ Barcelona FC │ 50 │
└──────────────────────┴────────────────┴─────────┘
final Table tab = table(['Player', 'Team', 'Goals'])
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
tab.maxColWidths[0] = fixed(10);
tab.minColWidths[2] = fixed(10);
┌──────────┬────────────┬──────────┐
│Player │Team │Goals │
┝━━━━━━━━━━┿━━━━━━━━━━━━┿━━━━━━━━━━┥
│Messi │Barcelona FC│80 │
├──────────┼────────────┼──────────┤
│Christi...│Real Madrid │30 │
├──────────┼────────────┼──────────┤
│Luiz Su...│Barcelona FC│50 │
└──────────┴────────────┴──────────┘
final Table tab = table(['Player', 'Team', 'Goals'],
globalPadding: pad(after: 5), border: Border.compact)
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
Player Team Goals
--------------------------------------------------
Messi Barcelona FC 80
Christiano Ronaldo Real Madrid 30
Luiz Suarez Barcelona FC 50
final Table tab = table(
['Player', 'Team', 'Goals'],
border: Border.doubleLines,
)
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
╔══════════════════╤════════════╤═════╗
║Player │Team │Goals║
╠══════════════════╪════════════╪═════╣
║Messi │Barcelona FC│80 ║
╟──────────────────┼────────────┼─────╢
║Christiano Ronaldo│Real Madrid │30 ║
╟──────────────────┼────────────┼─────╢
║Luiz Suarez │Barcelona FC│50 ║
╚══════════════════╧════════════╧═════╝
TODO
final Table tab = table(['Player', 'Team', 'Goals'],
width: 90,
colWidths: [flex(2), flex(1), fixed(5)],
maxColWidths: [fixed(22)],
globalPadding: padEven(1))
..row(['Messi', 'Barcelona FC', 80])
..row(['Christiano Ronaldo', 'Real Madrid', 30])
..row(['Luiz Suarez', 'Barcelona FC', 50]);
┌────────────────────────┬───────────────────────────────────────────────────────┬───────┐
│ Player │ Team │ Goals │
┝━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━┥
│ Messi │ Barcelona FC │ 80 │
├────────────────────────┼───────────────────────────────────────────────────────┼───────┤
│ Christiano Ronaldo │ Real Madrid │ 30 │
├────────────────────────┼───────────────────────────────────────────────────────┼───────┤
│ Luiz Suarez │ Barcelona FC │ 50 │
└────────────────────────┴───────────────────────────────────────────────────────┴───────┘
Add this to your package's pubspec.yaml file:
dependencies:
text_table: ^2.5.4
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:text_table/text_table.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
2.5.4 | Apr 9, 2018 |
|
|
2.5.3 | Mar 24, 2018 |
|
|
2.5.2 | Mar 19, 2018 |
|
|
2.5.1 | Jan 2, 2018 |
|
|
1.0.0 | Jan 2, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
0
|
Health:
Code health derived from static analysis.
[more]
|
--
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
--
|
Overall:
Weighted score of the above.
[more]
|
0
|
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in pubspec.yaml
.
The SDK constraint in pubspec.yaml
doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
Make sure dartdoc
successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.20.1 <2.0.0 |