PlGrid class

The main class. Use it like

Inheritance

Constructors

PlGrid({Key key, double width = 320, double height = 220, double headerHeight = 30, List<double> columnWidthsPercentages, @required List headerColumns, @required int maxPages, @required int curPage, EdgeInsets headerCellsPadding = baseHeaderCellsPadding, bool applyZebraEffect = true, EdgeInsets rowCellsPadding = baseRowCellsPadding, TextStyle zebraStyle = baseZebraStyle, bool invertZebra = false, EdgeInsets searchBarPadding = baseSearchBarPadding, InputDecoration searchBarInputDecoration = baseSearchBarInputDecoration, double searchBarHeight = 20, TextStyle searchBarStyle = baseSearchBarStyle, bool showSearchBar = true, WillNotifySearch notifySearchOnlyIf, int searchInterval, ThemeData themeData, bool asCard = true, bool internalGrid = false, TextAlign searchBarTextAlign = TextAlign.start, EdgeInsets asCardPadding = baseAsCardPadding, TextStyle headerStyle = baseHeaderStyle, TextStyle rowsStyle = baseRowStyle, TextStyle paginationStyle = basePaginationStyle, DynamicPaginationStyle paginationDynamicStyle, Alignment headerAlignmentByCells(int), Alignment alignmentByRow(int, int), List<List> data, Future<List<List>> dataAsync(), Widget headerCellRenderer(int, dynamic), Color headerCellsColor(int), double heightByRow(int), Widget noContentWidget, Future<List<List>> onSearch(String), bool searchFieldAutoFocus = false, Future<List<List>> onPaginationItemClick(int), Widget rowsCellRenderer(int row, int cell, dynamic), dynamic onError(dynamic)})
Constructs a grid with the given parameters For many of the constructor input uses static const values that can be used with a copyWith method if it's necessary to change just some of the standard properties like so. It's always a PlGrid.base... something. For example: [...]

Properties

alignmentByRow Alignment Function(int, int)
Sets the row cells alignment in a row manually [...]
final
applyZebraEffect bool
Marks to use zebra effect on rows
final
asCard bool
Render the widgetas a Card
final
asCardPadding EdgeInsets
If rendering as a Card, sets the internal padding from the edge of the
final
columnWidthsPercentages List<double>
The percentage of the whole width that the column has to take. If null, will distribute all columns equally
final
curPage int
The current page that is beign ehxibited
final
data List<List>
A List of a List of objects representing rows and column cells. Will accept Strings or Widgets [...]
final
dataAsync Future<List<List>> Function()
The grid now gives you the possibility to pass a asynchronous function to fetch the data instead of passing it directly. Use it if your data will be fetched from an api or if it's going to take some time to load. Use it like so: [...]
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
headerAlignmentByCells Alignment Function(int)
Sets the header cells alignment manually [...]
final
headerCellRenderer Widget Function(int, dynamic)
A function that receives the index of the header cell, the content and returns a widget to render the content of that cell
final
headerCellsColor Color Function(int)
A function that takes in the index of the a header cell and returns a color for it's background [...]
final
headerCellsPadding EdgeInsets
Padding to be applied on every and each header cell
final
headerColumns List
A list of objects representing each header cell. Will accept a simple string and use simple Text with the headerStyle or any Widget since it fits in the headerHeight [...]
final
headerHeight double
The height of the header line
final
headerStyle TextStyle
Custom style to apply to the header cells
final
height double
The whole height of the PlGrid widget
final
heightByRow double Function(int)
Sets the height of each row manually [...]
final
internalGrid bool
Marks if the PlGrid should show or not inner grid lines
final
invertZebra bool
Reverts the zebra effect to apply the effect on odd or even indexes
final
key Key
A key for the Widget
final
maxPages int
Max number of pages starting on page 1
final
noContentWidget Widget
Widget to display when theres no registers to display
final
notifySearchOnlyIf WillNotifySearch
A function that receives what user typed on searchbar and will only notify onSearch event if the condition is satisfied. For example: [...]
final
onError → dynamic Function(dynamic)
Called on asynchronous errors such as on onSearch or onPaginationItemClick methods
final
onPaginationItemClick Future<List<List>> Function(int)
A function that takes an int for the page and performs an action when the user touches or clicks a pagination index. It shall be async and has to return a List. The return is data to update the grid if it returns null, the data inside the grid will not be modified. because the setState method won't be called for the data property. Do not call setState by yourself to change the data inside the grid directly, unless you really want to. To modify the data whithin the grid, just return new data from the onSearch function parameter or the onPaginationItemClick parameter or others that will be implemented in later versions. To implement a simple query in on the data you could use something like this: [...]
final
onSearch Future<List<List>> Function(String)
Callback for searching if the search field is displayed. The callback shall be async and has to return a List. The return is data to update the grid if it returns null, the data inside the grid will not be modified. because the setState method won't be called for the data property. Do not call setState by yourself to change the data inside the grid, unless you really want to. To modify the data in the grid, just return new data from the onSearch function parameter or the onPaginationItemClick parameter or others that will be implemented in later versions. To implement a simple query in on the data you could use something like this: [...]
final
paginationDynamicStyle DynamicPaginationStyle
A function that takes in a page number (starting from 1 not zero), and returns a style to use in the button that triggers that page
final
paginationStyle TextStyle
Custom style to apply to the pagination item buttons
final
rowCellsPadding EdgeInsets
Padding to be applied on every and each row cell
final
rowsCellRenderer Widget Function(int row, int cell, dynamic)
A function that receives the index of the cell, the content and returns a widget to render the content of that cell
final
rowsStyle TextStyle
Custom style to apply to the rows
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
searchBarHeight double
The height for the searchbar widget
final
searchBarInputDecoration InputDecoration
Input decoration for the searchbar widget [...]
final
searchBarPadding EdgeInsets
Padding to be applied on the search bar in case parameter showSearchBar is set to true
final
searchBarStyle TextStyle
A style to apply on the searchbar
final
searchBarTextAlign TextAlign
Searchbar text align property
final
searchFieldAutoFocus bool
Auto focus property for the search field if showSearchBar is set to true
final
searchInterval int
A period to wait from the time the user starts typing to in fact the time the widget will notify an onSearchType event so that it would not update for every character typed or deleted. The period is in milliseconds
final
showSearchBar bool
Wheather to show or not the searchbar
final
themeData ThemeData
Theme to apply to the grid. If it's not supplied will use upper theme's such as the very MaterialApp theme
final
width double
The whole width of the PlGrid widget
final
zebraStyle TextStyle
A style for the "zebra effect affected" rows in case parameter applyZebraEffect is set to true
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
createState() → _PlGridState
Creates the mutable state for this widget at a given location in the tree. [...]
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
inherited
toStringDeep({String prefixLineOne = '', String prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited

Constants

baseAsCardPadding → const EdgeInsets
const EdgeInsets.all(4)
baseHeaderCellsPadding → const EdgeInsets
EdgeInsets.only(left: 10)
baseHeaderStyle → const TextStyle
const TextStyle(fontSize: 14, fontWeight: FontWeight.bold)
basePaginationStyle → const TextStyle
const TextStyle(fontSize: 15, fontWeight: FontWeight.normal)
baseRowCellsPadding → const EdgeInsets
EdgeInsets.only(left: 10, top: 5, bottom: 5)
baseRowStyle → const TextStyle
TextStyle(fontSize: 14, fontWeight: FontWeight.normal)
baseSearchBarInputDecoration → const InputDecoration
InputDecoration(suffixIcon: Icon(Icons.search, size: 16), contentPadding: EdgeInsets.only(bottom: 12, left: 4), hintText: 'Search...', border: UnderlineInputBorder(), filled: true)
baseSearchBarPadding → const EdgeInsets
const EdgeInsets.only(left: 180, top: 5, bottom: 5, right: 0)
baseSearchBarStyle → const TextStyle
const TextStyle(fontSize: 14)
baseZebraStyle → const TextStyle
TextStyle(fontSize: 14, color: Colors.black87, fontWeight: FontWeight.normal)