示例#1
0
        Widget _buildCheckbox(
            Color color           = null,
            bool isChecked        = false,
            VoidCallback onRowTap = null,
            ValueChanged <bool?> onCheckboxChanged = null
            )
        {
            Widget contents = new Padding(
                padding: EdgeInsetsDirectional.only(start: horizontalMargin,
                                                    end: horizontalMargin / 2.0f),
                child: new Center(
                    child: new Checkbox(
                        activeColor: color,
                        value: isChecked,
                        onChanged: onCheckboxChanged
                        )
                    )
                );

            if (onRowTap != null)
            {
                contents = new TableRowInkWell(
                    onTap: () => onRowTap(),
                    child: contents
                    );
            }

            return(new TableCell(
                       verticalAlignment: TableCellVerticalAlignment.fill,
                       child: contents
                       ));
        }
示例#2
0
        Widget _buildDataCell(
            BuildContext context,
            EdgeInsetsGeometry padding,
            Widget label,
            bool numeric,
            bool placeholder,
            bool showEditIcon,
            VoidCallback onTap,
            VoidCallback onSelectChanged
            )
        {
            bool isLightTheme = Theme.of(context).brightness == Brightness.light;

            if (showEditIcon)
            {
                Widget icon = new Icon(Icons.edit, size: 18.0f);
                label = new Expanded(child: label);
                label = new Row(
                    textDirection: numeric ? TextDirection.rtl : (TextDirection?)null,
                    children: new List <Widget> {
                    label, icon
                }
                    );
            }

            label = new Container(
                padding: padding,
                height: dataRowHeight,
                alignment: numeric ? Alignment.centerRight : (AlignmentGeometry)AlignmentDirectional.centerStart,
                child: new DefaultTextStyle(
                    style: new TextStyle(
                        // TODO(ianh): font family should be Roboto; see https://github.com/flutter/flutter/issues/3116
                        fontSize: 13.0f,
                        color: isLightTheme
                            ? (placeholder ? Colors.black38 : Colors.black87)
                            : (placeholder ? Colors.white38 : Colors.white70)
                        ),
                    child: IconTheme.merge(
                        data: new IconThemeData(
                            color: isLightTheme ? Colors.black54 : Colors.white70
                            ),
                        child: new DropdownButtonHideUnderline(child: label)
                        )
                    )
                );
            if (onTap != null)
            {
                label = new InkWell(
                    onTap: () => onTap(),
                    child: label
                    );
            }
            else if (onSelectChanged != null)
            {
                label = new TableRowInkWell(
                    onTap: () => onSelectChanged(),
                    child: label
                    );
            }

            return(label);
        }