浏览代码

update

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
b0bf623b
共有 15 个文件被更改,包括 985 次插入146 次删除
  1. 3
      com.unity.uiwidgets/Runtime/animation/tween_sequence.cs
  2. 2
      com.unity.uiwidgets/Runtime/material/data_table.cs
  3. 38
      com.unity.uiwidgets/Runtime/material/dropdown.cs
  4. 3
      com.unity.uiwidgets/Runtime/material/elevation_overlay.cs
  5. 61
      com.unity.uiwidgets/Runtime/material/input_border.cs
  6. 36
      com.unity.uiwidgets/Runtime/material/list_tile.cs
  7. 46
      com.unity.uiwidgets/Runtime/material/material.cs
  8. 40
      com.unity.uiwidgets/Runtime/material/mergeable_material.cs
  9. 160
      com.unity.uiwidgets/Runtime/material/outline_button.cs
  10. 4
      com.unity.uiwidgets/Runtime/material/page.cs
  11. 224
      com.unity.uiwidgets/Runtime/material/page_transitions_theme.cs
  12. 3
      com.unity.uiwidgets/Runtime/rendering/box.cs
  13. 118
      com.unity.uiwidgets/Runtime/material/grid_tile_bar.cs
  14. 3
      com.unity.uiwidgets/Runtime/material/grid_tile_bar.cs.meta
  15. 390
      com.unity.uiwidgets/Runtime/material/paginated_data_table.cs

3
com.unity.uiwidgets/Runtime/animation/tween_sequence.cs


}
class FlippedTweenSequence : TweenSequence<float> {
FlippedTweenSequence(List<TweenSequenceItem<float>> items)
public FlippedTweenSequence(List<TweenSequenceItem<float>> items)
: base(items) {
D.assert(items != null);
}

2
com.unity.uiwidgets/Runtime/material/data_table.cs


this.onTap = onTap;
}
static readonly DataCell empty = new DataCell(new Container(width: 0.0f, height: 0.0f));
public static readonly DataCell empty = new DataCell(new Container(width: 0.0f, height: 0.0f));
public readonly Widget child;

38
com.unity.uiwidgets/Runtime/material/dropdown.cs


}
}
class _DropdownMenuItemButton<T> : StatefulWidget where T : class {
class _DropdownMenuItemButton<T> : StatefulWidget {
internal _DropdownMenuItemButton(
Key key = null,
_DropdownRoute<T> route = null,

public override State createState() => new _DropdownMenuItemButtonState<T>();
}
class _DropdownMenuItemButtonState<T> : State<_DropdownMenuItemButton<T>> where T : class {
class _DropdownMenuItemButtonState<T> : State<_DropdownMenuItemButton<T>> {
void _handleFocusChange(bool focused) {
bool inTraditionalMode = false;
switch (FocusManager.instance.highlightMode) {

}
}
class _DropdownMenu<T> : StatefulWidget where T : class {
class _DropdownMenu<T> : StatefulWidget {
public _DropdownMenu(
Key key = null,
EdgeInsets padding = null,

}
}
class _DropdownMenuState<T> : State<_DropdownMenu<T>> where T : class {
class _DropdownMenuState<T> : State<_DropdownMenu<T>> {
CurvedAnimation _fadeOpacity;
CurvedAnimation _resize;

}
}
class _DropdownMenuRouteLayout<T> : SingleChildLayoutDelegate where T : class {
class _DropdownMenuRouteLayout<T> : SingleChildLayoutDelegate {
public _DropdownMenuRouteLayout(
Rect buttonRect,
_DropdownRoute<T> route = null,

}
}
class _DropdownRouteResult<T> where T : class {
class _DropdownRouteResult<T> {
public _DropdownRouteResult(T result) {
this.result = result;
}

}
public bool Equals(_DropdownRouteResult<T> other) {
return result == other.result;
return result.Equals(other.result);
}
public override bool Equals(object obj) {

public readonly float? scrollOffset;
}
class _DropdownRoute<T> : PopupRoute<_DropdownRouteResult<T>> where T : class {
class _DropdownRoute<T> : PopupRoute<_DropdownRouteResult<T>> {
public _DropdownRoute(
List<_MenuItem<T>> items = null,
EdgeInsets padding = null,

}
}
class _DropdownRoutePage<T> : StatelessWidget where T : class {
class _DropdownRoutePage<T> : StatelessWidget {
public _DropdownRoutePage(
Key key = null,
_DropdownRoute<T> route = null,

}
}
class _MenuItem<T> : SingleChildRenderObjectWidget where T : class {
class _MenuItem<T> : SingleChildRenderObjectWidget {
internal _MenuItem(
Key key = null,
ValueChanged<Size> onLayout = null,

}
}
public class DropdownMenuItem<T> : _DropdownMenuItemContainer where T : class {
public class DropdownMenuItem<T> : _DropdownMenuItemContainer {
T value = null,
T value = default,
Widget child = null
) : base(key: key, child: child) {
D.assert(child != null);

}
}
public class DropdownButton<T> : StatefulWidget where T : class {
public class DropdownButton<T> : StatefulWidget{
T value = null,
T value = default,
Widget hint = null,
Widget disabledHint = null,
ValueChanged<T> onChanged = null,

) :
base(key: key) {
D.assert(items == null || items.isEmpty() || value == null ||
items.Where((DropdownMenuItem<T> item) => { return item.value == value; }).Count() == 1,
items.Where((DropdownMenuItem<T> item) => { return item.value.Equals(value); }).Count() == 1,
() => "There should be exactly one item with [DropdownButton]'s value: " +
$"{value}. \n" +
"Either zero or 2 or more [DropdownMenuItem]s were detected " +

}
}
class _DropdownButtonState<T> : State<DropdownButton<T>>, WidgetsBindingObserver where T : class {
class _DropdownButtonState<T> : State<DropdownButton<T>>, WidgetsBindingObserver{
int? _selectedIndex;
_DropdownRoute<T> _dropdownRoute;
Orientation? _lastOrientation;

base.initState();
_updateSelectedIndex();
if (widget.focusNode == null) {
_internalNode = _internalNode?? _createFocusNode();
_internalNode = _internalNode ?? _createFocusNode();
}
_actionMap = new Dictionary<LocalKey, ActionFactory>() {

public void didChangeMetrics() {
_removeDropdownRoute();
}
void _removeDropdownRoute() {
_dropdownRoute?._dismiss();
_dropdownRoute = null;

if (oldWidget is DropdownButton<T> dropdownButton && widget.focusNode != dropdownButton.focusNode) {
dropdownButton.focusNode?.removeListener(_handleFocusChanged);
if (widget.focusNode == null) {
_internalNode =_internalNode?? _createFocusNode();
_internalNode = _internalNode ?? _createFocusNode();
}
_hasPrimaryFocus = focusNode.hasPrimaryFocus;

3
com.unity.uiwidgets/Runtime/material/elevation_overlay.cs


using Unity.UIWidgets.material;
namespace uiwidgets {
namespace Unity.UIWidgets.material {
public class ElevationOverlay {
private ElevationOverlay() {
}

61
com.unity.uiwidgets/Runtime/material/input_border.cs


}
Path _gapBorderPath(Canvas canvas, RRect center, float start, float extent) {
RRect scaledRRect = center.scaleRadii();
center.left,
center.top,
center.tlRadiusX * 2.0f,
center.tlRadiusY * 2.0f
scaledRRect.left,
scaledRRect.top,
scaledRRect.tlRadiusX * 2.0f,
scaledRRect.tlRadiusY * 2.0f
center.right - center.trRadiusX * 2.0f,
center.top,
center.trRadiusX * 2.0f,
center.trRadiusY * 2.0f
scaledRRect.right - scaledRRect.trRadiusX * 2.0f,
scaledRRect.top,
scaledRRect.trRadiusX * 2.0f,
scaledRRect.trRadiusY * 2.0f
center.right - center.brRadiusX * 2.0f,
center.bottom - center.brRadiusY * 2.0f,
center.brRadiusX * 2.0f,
center.brRadiusY * 2.0f
scaledRRect.right - scaledRRect.brRadiusX * 2.0f,
scaledRRect.bottom - scaledRRect.brRadiusY * 2.0f,
scaledRRect.brRadiusX * 2.0f,
scaledRRect.brRadiusY * 2.0f
center.left,
center.bottom - center.brRadiusY * 2.0f,
center.blRadiusX * 2.0f,
center.blRadiusY * 2.0f
scaledRRect.left,
scaledRRect.bottom - scaledRRect.brRadiusY * 2.0f,
scaledRRect.blRadiusX * 2.0f,
scaledRRect.blRadiusY * 2.0f
float tlCornerArcSweep = start < center.tlRadiusX
? Mathf.Asin((start / center.tlRadiusX).clamp(-1.0f, 1.0f))
float tlCornerArcSweep = start < scaledRRect.tlRadiusX
? Mathf.Asin((start / scaledRRect.tlRadiusX).clamp(-1.0f, 1.0f))
path.moveTo(center.left + center.tlRadiusX, center.top);
path.moveTo(scaledRRect.left + scaledRRect.tlRadiusX, scaledRRect.top);
if (start > center.tlRadiusX) {
path.lineTo(center.left + start, center.top);
if (start > scaledRRect.tlRadiusX) {
path.lineTo(scaledRRect.left + start, scaledRRect.top);
if (start + extent < center.width - center.trRadiusX) {
if (start + extent < scaledRRect.width - scaledRRect.trRadiusX) {
path.lineTo(center.right - center.trRadiusX, center.top);
path.lineTo(scaledRRect.right - scaledRRect.trRadiusX, scaledRRect.top);
else if (start + extent < center.width) {
float dx = center.width - (start + extent);
float sweep = Mathf.Acos(dx / center.trRadiusX);
else if (start + extent < scaledRRect.width) {
float dx = scaledRRect.width - (start + extent);
float sweep = Mathf.Acos(dx / scaledRRect.trRadiusX);
path.moveTo(center.right, center.top + center.trRadiusY);
path.lineTo(center.right, center.bottom - center.brRadiusY);
path.moveTo(scaledRRect.right, scaledRRect.top + scaledRRect.trRadiusY);
path.lineTo(scaledRRect.right, scaledRRect.bottom - scaledRRect.brRadiusY);
path.lineTo(center.left + center.blRadiusX, center.bottom);
path.lineTo(scaledRRect.left + scaledRRect.blRadiusX, scaledRRect.bottom);
path.lineTo(center.left, center.top + center.trRadiusY);
path.lineTo(scaledRRect.left, scaledRRect.top + scaledRRect.trRadiusY);
return path;
}

36
com.unity.uiwidgets/Runtime/material/list_tile.cs


drawer
}
public class ListTileTheme : InheritedWidget {
public class ListTileTheme : InheritedTheme {
public ListTileTheme(
Key key = null,
bool dense = false,

public readonly EdgeInsets contentPadding;
public static ListTileTheme of(BuildContext context) {
ListTileTheme result = (ListTileTheme) context.inheritFromWidgetOfExactType(typeof(ListTileTheme));
ListTileTheme result = context.dependOnInheritedWidgetOfExactType<ListTileTheme>();
public override Widget wrap(BuildContext context, Widget child) {
ListTileTheme ancestorTheme = context.findAncestorWidgetOfExactType<ListTileTheme>();
return ReferenceEquals(this, ancestorTheme)
? child
: new ListTileTheme(
dense: dense,
style: style,
selectedColor: selectedColor,
iconColor: iconColor,
textColor: textColor,
contentPadding: contentPadding,
child: child
);
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {
ListTileTheme _oldWidget = (ListTileTheme) oldWidget;
return dense != _oldWidget.dense ||

}
bool _isDenseLayout(ListTileTheme tileTheme) {
return dense != null ? dense ?? false : (tileTheme?.dense ?? false);
return dense ?? tileTheme?.dense ?? false;
}
TextStyle _titleTextStyle(ThemeData theme, ListTileTheme tileTheme) {

case ListTileStyle.drawer:
style = theme.textTheme.body2;
style = theme.textTheme.bodyText1;
style = theme.textTheme.subhead;
style = theme.textTheme.subtitle1;
style = theme.textTheme.subhead;
style = theme.textTheme.subtitle1;
}
Color color = _textColor(theme, tileTheme, style.color);

}
TextStyle _subtitleTextStyle(ThemeData theme, ListTileTheme tileTheme) {
TextStyle style = theme.textTheme.body1;
TextStyle style = theme.textTheme.bodyText2;
Color color = _textColor(theme, tileTheme, theme.textTheme.caption.color);
return _isDenseLayout(tileTheme)
? style.copyWith(color: color, fontSize: 12.0f)

return new InkWell(
onTap: enabled ? onTap : null,
onLongPress: enabled ? onLongPress : null,
canRequestFocus: enabled,
child: new SafeArea(
top: false,
bottom: false,

_ListTileSlot slot = childToSlot[child];
childToSlot.Remove(child);
slotToChild.Remove(slot);
base.forgetChild(child);
}
void _mountChild(Widget widget, _ListTileSlot slot) {

_updateChild(widget.trailing, _ListTileSlot.trailing);
}
void _updateRenderObject(RenderObject child, _ListTileSlot slot) {
void _updateRenderObject(RenderBox child, _ListTileSlot slot) {
switch (slot) {
case _ListTileSlot.leading:
renderObject.leading = (RenderBox) child;

D.assert(child is RenderBox);
D.assert(slotValue is _ListTileSlot);
_ListTileSlot slot = (_ListTileSlot) slotValue;
_updateRenderObject(child, slot);
_updateRenderObject((RenderBox) child, slot);
D.assert(renderObject.childToSlot.Keys.Contains(child));
D.assert(renderObject.slotToChild.Keys.Contains(slot));
}

}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
bool hasLeading = leading != null;
bool hasSubtitle = subtitle != null;
bool hasTrailing = trailing != null;

46
com.unity.uiwidgets/Runtime/material/material.cs


public static MaterialInkController of(BuildContext context) {
_RenderInkFeatures result =
(_RenderInkFeatures) context.ancestorRenderObjectOfType(new TypeMatcher<_RenderInkFeatures>());
(_RenderInkFeatures) context.findAncestorRenderObjectOfType<_RenderInkFeatures>();
return result;
}

base.debugFillProperties(properties);
properties.add(new EnumProperty<MaterialType>("type", type));
properties.add(new FloatProperty("elevation", elevation, defaultValue: 0.0f));
properties.add(new DiagnosticsProperty<Color>("color", color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("shadowColor", shadowColor,
defaultValue: new Color(0xFF000000)));
properties.add(new ColorProperty("color", color, defaultValue: null));
properties.add(new ColorProperty("shadowColor", shadowColor, defaultValue: new Color(0xFF000000)));
textStyle?.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<bool>("borderOnForeground", borderOnForeground,

readonly GlobalKey _inkFeatureRenderer = GlobalKey.key(debugLabel: "ink renderer");
Color _getBackgroundColor(BuildContext context) {
if (widget.color != null) {
return widget.color;
ThemeData theme = Theme.of(context);
Color color = widget.color;
if (color == null) {
switch (widget.type) {
case MaterialType.canvas:
color = theme.canvasColor;
break;
case MaterialType.card:
color = theme.cardColor;
break;
default:
break;
}
switch (widget.type) {
case MaterialType.canvas:
return Theme.of(context).canvasColor;
case MaterialType.card:
return Theme.of(context).cardColor;
default:
return null;
}
return color;
}
public override Widget build(BuildContext context) {

Widget contents = widget.child;
if (contents != null) {
contents = new AnimatedDefaultTextStyle(
style: widget.textStyle ?? Theme.of(context).textTheme.body1,
style: widget.textStyle ?? Theme.of(context).textTheme.bodyText2,
duration: widget.animationDuration,
child: contents
);

_RenderInkFeatures renderer =
(_RenderInkFeatures) _inkFeatureRenderer.currentContext.findRenderObject();
renderer._didChangeLayout();
return true;
return false;
},
child: new _InkFeatures(
key: _inkFeatureRenderer,

clipBehavior: widget.clipBehavior,
borderRadius: BorderRadius.zero,
elevation: widget.elevation,
color: backgroundColor,
color: ElevationOverlay.applyOverlay(context, backgroundColor, widget.elevation),
shadowColor: widget.shadowColor,
animateColor: false,
child: contents

get { return _controller; }
}
public _RenderInkFeatures _controller;
public readonly _RenderInkFeatures _controller;
public readonly RenderBox referenceBox;

base.debugFillProperties(description);
description.add(new DiagnosticsProperty<ShapeBorder>("shape", shape));
description.add(new FloatProperty("elevation", elevation));
description.add(new DiagnosticsProperty<Color>("color", color));
description.add(new DiagnosticsProperty<Color>("shadowColor", shadowColor));
description.add(new ColorProperty("color", color));
description.add(new ColorProperty("shadowColor", shadowColor));
}
}

public override Widget build(BuildContext context) {
ShapeBorder shape = _border.evaluate(animation);
float elevation = _elevation.evaluate(animation);
return new PhysicalShape(
child: new _ShapeBorderPaint(
child: widget.child,

shape: shape),
clipBehavior: widget.clipBehavior,
elevation: _elevation.evaluate(animation),
color: widget.color,
color: ElevationOverlay.applyOverlay(context, widget.color, elevation),
shadowColor: _shadowColor.evaluate(animation)
);
}

40
com.unity.uiwidgets/Runtime/material/mergeable_material.cs


_children.AddRange(widget.children);
for (int i = 0; i < _children.Count; i++) {
if (_children[i] is MaterialGap) {
MergeableMaterialItem child = _children[i];
if (child is MaterialGap) {
_animationTuples[_children[i].key].controller.setValue(1.0f);
_animationTuples[child.key].controller.setValue(1.0f);
}
}

float gapSizeSum = 0.0f;
while (startOld < j) {
if (_children[startOld] is MaterialGap) {
MaterialGap gap = (MaterialGap) _children[startOld];
MergeableMaterialItem child = _children[startOld];
if (child is MaterialGap materialGap) {
MaterialGap gap = materialGap;
gapSizeSum += gap.size;
}

float gapSizeSum = 0.0f;
for (int k = startNew; k < i; k++) {
if (newChildren[k] is MaterialGap) {
MaterialGap gap = (MaterialGap) newChildren[k];
gapSizeSum += gap.size;
MergeableMaterialItem newChild = newChildren[k];
if (newChild is MaterialGap materialGap) {
gapSizeSum += materialGap.size;
if (newChildren[k] is MaterialGap) {
MaterialGap gap = (MaterialGap) newChildren[k];
_animationTuples[gap.key].gapStart = gapSize * gap.size / gapSizeSum;
_animationTuples[gap.key].controller.setValue(0.0f);
_animationTuples[gap.key].controller.forward();
MergeableMaterialItem newChild = newChildren[k];
if (newChild is MaterialGap materialGap) {
_animationTuples[materialGap.key].gapStart =
gapSize * materialGap.size / gapSizeSum;
_animationTuples[materialGap.key].controller.setValue(0.0f);
_animationTuples[materialGap.key].controller.forward();
}
}
}

_insertChild(startOld + k, newChildren[startNew + k]);
MergeableMaterialItem newChild = newChildren[startNew + k];
_insertChild(startOld + k, newChild);
if (newChildren[startNew + k] is MaterialGap) {
MaterialGap gap = (MaterialGap) newChildren[startNew + k];
if (newChild is MaterialGap gap) {
_animationTuples[gap.key].controller.forward();
}
}

float gapSizeSum = 0.0f;
while (startOld < j) {
if (_children[startOld] is MaterialGap) {
MaterialGap gap = (MaterialGap) _children[startOld];
gapSizeSum += gap.size;
MergeableMaterialItem child = _children[startOld];
if (child is MaterialGap materialGap) {
gapSizeSum += materialGap.size;
}
_removeChild(startOld);

160
com.unity.uiwidgets/Runtime/material/outline_button.cs


public OutlineButton(
Key key = null,
VoidCallback onPressed = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
float? highlightElevation = null,

EdgeInsets padding = null,
VisualDensity visualDensity = null,
FocusNode focusNode = null,
bool autofocus = false,
onLongPress: onLongPress,
focusColor: focusColor,
hoverColor: hoverColor,
visualDensity: visualDensity,
focusNode: focusNode,
autofocus: autofocus,
child: child
) {
D.assert(highlightElevation == null || highlightElevation >= 0.0f);

public static OutlineButton icon(
Key key = null,
VoidCallback onPressed = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
float? highlightElevation = null,

EdgeInsets padding = null,
VisualDensity visualDensity = null,
FocusNode focusNode = null,
bool autofocus = false,
key,
onPressed,
textTheme,
textColor,
disabledTextColor,
color,
highlightColor,
splashColor,
highlightElevation,
highlightedBorderColor,
disabledBorderColor,
borderSide,
padding,
shape,
clipBehavior,
icon,
label
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
textTheme: textTheme,
textColor: textColor,
disabledTextColor: disabledTextColor,
color: color,
focusColor: focusColor,
hoverColor: hoverColor,
highlightColor: highlightColor,
splashColor: splashColor,
highlightElevation: highlightElevation,
highlightedBorderColor: highlightedBorderColor,
disabledBorderColor: disabledBorderColor,
borderSide: borderSide,
padding: padding,
visualDensity: visualDensity,
shape: shape,
clipBehavior: clipBehavior,
focusNode: focusNode,
autofocus: autofocus,
label: label
);
}

ButtonThemeData buttonTheme = ButtonTheme.of(context);
return new _OutlineButton(
onPressed: onPressed,
onLongPress: onLongPress,
focusColor: buttonTheme.getFocusColor(this),
hoverColor: buttonTheme.getHoverColor(this),
highlightColor: buttonTheme.getHighlightColor(this),
splashColor: buttonTheme.getSplashColor(this),
highlightElevation: buttonTheme.getHighlightElevation(this),

padding: buttonTheme.getPadding(this),
visualDensity: visualDensity,
focusNode: focusNode,
child: child
);
}

properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", onPressed, ifNull: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", textTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("textColor", textColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledTextColor", disabledTextColor,
defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<float?>("highlightElevation", highlightElevation,
defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledBorderColor", disabledBorderColor,
defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightedBorderColor", highlightedBorderColor,
defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new ColorProperty("disabledBorderColor", disabledBorderColor, defaultValue: null));
properties.add(new ColorProperty("highlightedBorderColor", highlightedBorderColor, defaultValue: null));
}
}

VoidCallback onPressed = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
float? highlightElevation = null,

EdgeInsets padding = null,
VisualDensity visualDensity = null,
FocusNode focusNode = null,
bool autofocus = false,
Widget icon = null,
Widget label = null
) :

onLongPress: onLongPress,
focusColor: focusColor,
hoverColor: hoverColor,
highlightColor: highlightColor,
splashColor: splashColor,
highlightElevation: highlightElevation,

padding: padding,
visualDensity: visualDensity,
focusNode: focusNode,
autofocus: autofocus,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {

public _OutlineButton(
Key key = null,
VoidCallback onPressed = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
Color highlightColor = null,
Color splashColor = null,
float? highlightElevation = null,

EdgeInsets padding = null,
VisualDensity visualDensity = null,
FocusNode focusNode = null,
bool autofocus = false,
this.onLongPress = onLongPress;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.highlightColor = highlightColor;
this.splashColor = splashColor;
this.highlightElevation = highlightElevation;

this.padding = padding;
this.visualDensity = visualDensity;
this.focusNode = focusNode;
this.autofocus = autofocus;
public readonly VoidCallback onLongPress;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly Color highlightColor;
public readonly Color splashColor;
public readonly float? highlightElevation;

public readonly EdgeInsets padding;
public readonly VisualDensity visualDensity;
public readonly FocusNode focusNode;
public readonly bool autofocus;
get { return onPressed != null; }
get { return onPressed != null || onLongPress != null; }
}
public override State createState() {

return colorTween.evaluate(_fillAnimation);
}
Color _outlineColor {
get {
// TODO: what is the meaning of this line?
if (widget.borderSide?.color is MaterialStateProperty<Color>)
return widget.borderSide.color;
if (!widget.enabled)
return widget.disabledBorderColor;
if (_pressed)
return widget.highlightedBorderColor;
return widget.borderSide?.color;
}
}
BorderSide _getOutline() {
if (widget.borderSide?.style == BorderStyle.none) {
return widget.borderSide;

Color themeColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.12f);
return new BorderSide(
color: specifiedColor ?? themeColor,
color: _outlineColor ?? themeColor,
width: widget.borderSide?.width ?? 1.0f
);
}

}
public override Widget build(BuildContext context) {
ThemeData theme = Theme.of(context);
return new AnimatedBuilder(
animation: _controller,
builder: (BuildContext _context, Widget child) => {

color: _getFillColor(),
splashColor: widget.splashColor,
focusColor: widget.focusColor,
hoverColor: widget.hoverColor,
onLongPress: widget.onLongPress,
focusElevation: 0.0f,
hoverElevation: 0.0f,
visualDensity: widget.visualDensity ?? theme.visualDensity,
clipBehavior:
widget.clipBehavior,
clipBehavior: widget.clipBehavior,
focusNode: widget.focusNode,
animationDuration: material_._kElevationDuration,
child:
widget.child

public override int GetHashCode() {
return (shape.GetHashCode() * 397) ^ side.GetHashCode();
}
public ShapeBorder resolve(HashSet<MaterialState> states) {
return new _OutlineBorder(
shape: shape,
side: side.copyWith(color: MaterialStateProperty<Color>.resolveAs(side.color, states)
)
);
}
public static ShapeBorder resolveAs<ShapeBorder>(ShapeBorder value, HashSet<MaterialState> states) {
if (value is MaterialStateProperty<ShapeBorder> materialStateProperty) {
MaterialStateProperty<ShapeBorder> property = materialStateProperty;
return property.resolve(states);
}
return value;
}
public static MaterialStateProperty<ShapeBorder> resolveWith<ShapeBorder>(
material_.MaterialPropertyResolver<ShapeBorder> callback) =>
new _MaterialStateProperty<ShapeBorder>(callback);
}
}

4
com.unity.uiwidgets/Runtime/material/page.cs


get { return null; }
}
public override bool canTransitionFrom(TransitionRoute previousRoute) {
return previousRoute is MaterialPageRoute;
}
public override bool canTransitionTo(TransitionRoute nextRoute) {
return nextRoute is MaterialPageRoute && !((MaterialPageRoute) nextRoute).fullscreenDialog;
}

224
com.unity.uiwidgets/Runtime/material/page_transitions_theme.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.cupertino;
using UnityEngine;
namespace Unity.UIWidgets.material {
public class _FadeUpwardsPageTransition : StatelessWidget {

}
}
class _ZoomPageTransition : StatefulWidget {
internal _ZoomPageTransition(
Key key = null,
Animation<float> animation = null,
Animation<float> secondaryAnimation = null,
Widget child = null
) : base(key: key) {
this.animation = animation;
this.secondaryAnimation = secondaryAnimation;
this.child = child;
}
// The scrim obscures the old page by becoming increasingly opaque.
internal static readonly Tween<float> _scrimOpacityTween = new Tween<float>(
begin: 0.0f,
end: 0.60f
);
// A curve sequence that is similar to the 'fastOutExtraSlowIn' curve used in
// the native transition.
public static readonly List<TweenSequenceItem<float>> fastOutExtraSlowInTweenSequenceItems =
new List<TweenSequenceItem<float>> {
new TweenSequenceItem<float>(
tween: new Tween<float>(begin: 0.0f, end: 0.4f)
.chain(new CurveTween(curve: new Cubic(0.05f, 0.0f, 0.133333f, 0.06f))),
weight: 0.166666f
),
new TweenSequenceItem<float>(
tween: new Tween<float>(begin: 0.4f, end: 1.0f)
.chain(new CurveTween(curve: new Cubic(0.208333f, 0.82f, 0.25f, 1.0f))),
weight: 1.0f - 0.166666f
)
};
internal static readonly TweenSequence<float> _scaleCurveSequence =
new TweenSequence<float>(fastOutExtraSlowInTweenSequenceItems);
internal static readonly FlippedTweenSequence _flippedScaleCurveSequence =
new FlippedTweenSequence(fastOutExtraSlowInTweenSequenceItems);
public readonly Animation<float> animation;
public readonly Animation<float> secondaryAnimation;
public readonly Widget child;
public override State createState() => new __ZoomPageTransitionState();
}
class __ZoomPageTransitionState : State<_ZoomPageTransition> {
AnimationStatus _currentAnimationStatus;
AnimationStatus _lastAnimationStatus;
public override void initState() {
base.initState();
widget.animation.addStatusListener((AnimationStatus animationStatus) => {
_lastAnimationStatus = _currentAnimationStatus;
_currentAnimationStatus = animationStatus;
});
}
// This check ensures that the animation reverses the original animation if
// the transition were interruped midway. This prevents a disjointed
// experience since the reverse animation uses different fade and scaling
// curves.
bool _transitionWasInterrupted {
get {
bool wasInProgress = false;
bool isInProgress = false;
switch (_currentAnimationStatus) {
case AnimationStatus.completed:
case AnimationStatus.dismissed:
isInProgress = false;
break;
case AnimationStatus.forward:
case AnimationStatus.reverse:
isInProgress = true;
break;
}
switch (_lastAnimationStatus) {
case AnimationStatus.completed:
case AnimationStatus.dismissed:
wasInProgress = false;
break;
case AnimationStatus.forward:
case AnimationStatus.reverse:
wasInProgress = true;
break;
}
return wasInProgress && isInProgress;
}
}
public override Widget build(BuildContext context) {
Animation<float> _forwardScrimOpacityAnimation = widget.animation.drive(
_ZoomPageTransition._scrimOpacityTween
.chain(new CurveTween(curve: new Interval(0.2075f, 0.4175f))));
Animation<float> _forwardEndScreenScaleTransition = widget.animation.drive(
new Tween<float>(begin: 0.85f, end: 1.00f)
.chain(_ZoomPageTransition._scaleCurveSequence));
Animation<float> _forwardStartScreenScaleTransition = widget.secondaryAnimation.drive(
new Tween<float>(begin: 1.00f, end: 1.05f)
.chain(_ZoomPageTransition._scaleCurveSequence));
Animation<float> _forwardEndScreenFadeTransition = widget.animation.drive(
new Tween<float>(begin: 0.0f, end: 1.00f)
.chain(new CurveTween(curve: new Interval(0.125f, 0.250f))));
Animation<float> _reverseEndScreenScaleTransition = widget.secondaryAnimation.drive(
new Tween<float>(begin: 1.00f, end: 1.10f)
.chain(_ZoomPageTransition._flippedScaleCurveSequence));
Animation<float> _reverseStartScreenScaleTransition = widget.animation.drive(
new Tween<float>(begin: 0.9f, end: 1.0f)
.chain(_ZoomPageTransition._flippedScaleCurveSequence));
Animation<float> _reverseStartScreenFadeTransition = widget.animation.drive(
new Tween<float>(begin: 0.0f, end: 1.00f)
.chain(new CurveTween(curve: new Interval(1 - 0.2075f, 1 - 0.0825f))));
return new AnimatedBuilder(
animation: widget.animation,
builder: (BuildContext _context, Widget child) => {
if (widget.animation.status == AnimationStatus.forward || _transitionWasInterrupted) {
return new Container(
color: Colors.black.withOpacity(_forwardScrimOpacityAnimation.value),
child: new FadeTransition(
opacity: _forwardEndScreenFadeTransition,
child: new ScaleTransition(
scale: _forwardEndScreenScaleTransition,
child: child
)
)
);
}
else if (widget.animation.status == AnimationStatus.reverse) {
return new ScaleTransition(
scale: _reverseStartScreenScaleTransition,
child: new FadeTransition(
opacity: _reverseStartScreenFadeTransition,
child: child
)
);
}
return child;
},
child: new AnimatedBuilder(
animation: widget.secondaryAnimation,
builder: (BuildContext _context, Widget child) => {
if (widget.secondaryAnimation.status == AnimationStatus.forward || _transitionWasInterrupted) {
return new ScaleTransition(
scale: _forwardStartScreenScaleTransition,
child: child
);
}
else if (widget.secondaryAnimation.status == AnimationStatus.reverse) {
return new ScaleTransition(
scale: _reverseEndScreenScaleTransition,
child: child
);
}
return child;
},
child: widget.child
)
);
}
}
public abstract class PageTransitionsBuilder {
public PageTransitionsBuilder() {
}

Widget child);
}
public class ZoomPageTransitionsBuilder : PageTransitionsBuilder {
public ZoomPageTransitionsBuilder() {
}
public override Widget buildTransitions(
PageRoute route,
BuildContext context,
Animation<float> animation,
Animation<float> secondaryAnimation,
Widget child
) {
return new _ZoomPageTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
child: child
);
}
}
public class FadeUpwardsPageTransitionsBuilder : PageTransitionsBuilder {
public FadeUpwardsPageTransitionsBuilder() {

}
}
public class CupertinoPageTransitionsBuilder : PageTransitionsBuilder {
public CupertinoPageTransitionsBuilder() {
}
public override Widget buildTransitions(
PageRoute route,
BuildContext context,
Animation<float> animation,
Animation<float> secondaryAnimation,
Widget child
) {
return CupertinoPageRoute.buildPageTransitions(route, context, animation, secondaryAnimation, child);
}
}
static readonly Dictionary<RuntimePlatform, PageTransitionsBuilder> _defaultBuilders =
new Dictionary<RuntimePlatform, PageTransitionsBuilder> {
{RuntimePlatform.Android, new FadeUpwardsPageTransitionsBuilder()},
{RuntimePlatform.IPhonePlayer, new CupertinoPageTransitionsBuilder()},
{RuntimePlatform.LinuxEditor, new FadeUpwardsPageTransitionsBuilder()},
{RuntimePlatform.LinuxPlayer, new FadeUpwardsPageTransitionsBuilder()},
{RuntimePlatform.OSXEditor, new CupertinoPageTransitionsBuilder()},
{RuntimePlatform.OSXPlayer, new CupertinoPageTransitionsBuilder()},
{RuntimePlatform.WindowsEditor, new FadeUpwardsPageTransitionsBuilder()},
{RuntimePlatform.WindowsPlayer, new FadeUpwardsPageTransitionsBuilder()}
};
static PageTransitionsBuilder _defaultBuilder = new FadeUpwardsPageTransitionsBuilder();

3
com.unity.uiwidgets/Runtime/rendering/box.cs


information.Add(new DiagnosticsProperty<BoxConstraints>("The constraints that applied to the ${runtimeType} were", constraints, style: DiagnosticsTreeStyle.errorProperty));
information.Add(new DiagnosticsProperty<Size>("The exact size it was given was", _size, style: DiagnosticsTreeStyle.errorProperty));
information.Add(new ErrorHint("See https://flutter.dev/docs/development/ui/layout/box-constraints for more information."));
throw new UIWidgetsError(information);
}

new DiagnosticsProperty<Size>("Size", _size, style: DiagnosticsTreeStyle.errorProperty),
new ErrorHint(
"If you are not writing your own RenderBox subclass, then this is not " +
"your fault. Contact support: https://github.com/flutter/flutter/issues/new?template=BUG.md"
"your fault."
)
});
}

118
com.unity.uiwidgets/Runtime/material/grid_tile_bar.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
class GridTileBar : StatelessWidget {
public GridTileBar(
Key key = null,
Color backgroundColor = null,
Widget leading = null,
Widget title = null,
Widget subtitle = null,
Widget trailing = null
) : base(key: key) {
this.backgroundColor = backgroundColor;
this.leading = leading;
this.title = title;
this.subtitle = subtitle;
this.trailing = trailing;
}
public readonly Color backgroundColor;
public readonly Widget leading;
public readonly Widget title;
public readonly Widget subtitle;
public readonly Widget trailing;
public override Widget build(BuildContext context) {
BoxDecoration decoration = null;
if (backgroundColor != null)
decoration = new BoxDecoration(color: backgroundColor);
EdgeInsetsDirectional padding = EdgeInsetsDirectional.only(
start: leading != null ? 8.0f : 16.0f,
end: trailing != null ? 8.0f : 16.0f
);
ThemeData theme = Theme.of(context);
ThemeData darkTheme = new ThemeData(
brightness: Brightness.dark,
accentColor: theme.accentColor,
accentColorBrightness: theme.accentColorBrightness
);
var expandChildren = new List<widgets.Widget>();
if (leading != null) {
//TODO: EdgeInsetsGeometry
expandChildren.Add(new Padding(
padding: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(end: 8.0f), child:
leading));
}
if (title != null && subtitle != null) {
expandChildren.Add(new Expanded(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget> {
new DefaultTextStyle(
style: darkTheme.textTheme.subtitle1,
softWrap: false,
overflow: TextOverflow.ellipsis,
child: title
),
new DefaultTextStyle(
style: darkTheme.textTheme.caption,
softWrap: false,
overflow: TextOverflow.ellipsis,
child: subtitle
)
}
)
));
}
else if (title != null || subtitle != null)
expandChildren.Add(new Expanded(
child: new DefaultTextStyle(
style: darkTheme.textTheme.subtitle1,
softWrap: false,
overflow: TextOverflow.ellipsis,
child: title ?? subtitle
)
));
if (trailing != null) {
//TODO: EdgeInsetsGeometry
expandChildren.Add(new Padding(
padding: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(start: 8.0f),
child: trailing));
}
return new Container(
//TODO: EdgeInsetsGeometry
padding: (EdgeInsets) (EdgeInsetsGeometry) padding,
decoration: decoration,
height: (title != null && subtitle != null) ? 68.0f : 48.0f,
child: new Theme(
data: darkTheme,
child: IconTheme.merge(
data: new IconThemeData(color: Colors.white),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: expandChildren
)
)
)
);
}
}
}

3
com.unity.uiwidgets/Runtime/material/grid_tile_bar.cs.meta


fileFormatVersion: 2
guid: c7f1b23a6b52430d95ef28b3586542df
timeCreated: 1611735180

390
com.unity.uiwidgets/Runtime/material/paginated_data_table.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class PaginatedDataTable : StatefulWidget {
public PaginatedDataTable(
Key key = null,
Widget header = null,
List<Widget> actions = null,
List<DataColumn> columns = null,
int? sortColumnIndex = null,
bool sortAscending = false,
ValueSetter<bool> onSelectAll = null,
float dataRowHeight = material_.kMinInteractiveDimension,
float headingRowHeight = 56.0f,
float horizontalMargin = 24.0f,
float columnSpacing = 56.0f,
bool showCheckboxColumn = true,
int? initialFirstRowIndex = 0,
ValueChanged<int> onPageChanged = null,
int rowsPerPage = defaultRowsPerPage,
List<int> availableRowsPerPage = null,
ValueChanged<int> onRowsPerPageChanged = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
DataTableSource source = null
) : base(key: key) {
availableRowsPerPage = availableRowsPerPage ?? new List<int> {
defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10
};
D.assert(columns.isNotEmpty);
D.assert(() => {
if (onRowsPerPageChanged != null)
D.assert(availableRowsPerPage != null && availableRowsPerPage.Contains(rowsPerPage));
return true;
});
D.assert(source != null);
this.header = header;
this.actions = actions;
this.columns = columns;
this.sortColumnIndex = sortColumnIndex;
this.sortAscending = sortAscending;
this.onSelectAll = onSelectAll;
this.dataRowHeight = dataRowHeight;
this.headingRowHeight = headingRowHeight;
this.horizontalMargin = horizontalMargin;
this.columnSpacing = columnSpacing;
this.showCheckboxColumn = showCheckboxColumn;
this.initialFirstRowIndex = initialFirstRowIndex;
this.onPageChanged = onPageChanged;
this.rowsPerPage = rowsPerPage;
this.availableRowsPerPage = availableRowsPerPage;
this.onRowsPerPageChanged = onRowsPerPageChanged;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Widget header;
public readonly List<Widget> actions;
public readonly List<DataColumn> columns;
public readonly int? sortColumnIndex;
public readonly bool sortAscending;
public readonly ValueSetter<bool> onSelectAll;
public readonly float dataRowHeight;
public readonly float headingRowHeight;
public readonly float horizontalMargin;
public readonly float columnSpacing;
public readonly bool showCheckboxColumn;
public readonly int? initialFirstRowIndex;
public readonly ValueChanged<int> onPageChanged;
public readonly int rowsPerPage;
public const int defaultRowsPerPage = 10;
public readonly List<int> availableRowsPerPage;
public readonly ValueChanged<int> onRowsPerPageChanged;
public readonly DataTableSource source;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() => new PaginatedDataTableState();
}
class PaginatedDataTableState : State<PaginatedDataTable> {
int _firstRowIndex;
int _rowCount;
bool _rowCountApproximate;
int _selectedRowCount;
public readonly Dictionary<int, DataRow> _rows = new Dictionary<int, DataRow>();
public override void initState() {
base.initState();
_firstRowIndex = (PageStorage.of(context)?.readState(context)) as int? ?? widget.initialFirstRowIndex ?? 0;
widget.source.addListener(_handleDataSourceChanged);
_handleDataSourceChanged();
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
if (oldWidget is PaginatedDataTable painPaginatedDataTable) {
if (painPaginatedDataTable.source != widget.source) {
painPaginatedDataTable.source.removeListener(_handleDataSourceChanged);
widget.source.addListener(_handleDataSourceChanged);
_handleDataSourceChanged();
}
}
}
public override void dispose() {
widget.source.removeListener(_handleDataSourceChanged);
base.dispose();
}
void _handleDataSourceChanged() {
setState(() => {
_rowCount = widget.source.rowCount;
_rowCountApproximate = widget.source.isRowCountApproximate;
_selectedRowCount = widget.source.selectedRowCount;
_rows.Clear();
});
}
void pageTo(int rowIndex) {
int oldFirstRowIndex = _firstRowIndex;
setState(() => {
int rowsPerPage = widget.rowsPerPage;
_firstRowIndex = ((int) (1.0f * rowIndex / rowsPerPage)) * rowsPerPage;
});
if ((widget.onPageChanged != null) &&
(oldFirstRowIndex != _firstRowIndex))
widget.onPageChanged(_firstRowIndex);
}
DataRow _getBlankRowFor(int index) {
return DataRow.byIndex(
index: index,
cells: widget.columns.Select((DataColumn column) => DataCell.empty).ToList()
);
}
DataRow _getProgressIndicatorRowFor(int index) {
bool haveProgressIndicator = false;
List<DataCell> cells = widget.columns.Select((DataColumn column) => {
if (!column.numeric) {
haveProgressIndicator = true;
return new DataCell(new CircularProgressIndicator());
}
return DataCell.empty;
}).ToList();
if (!haveProgressIndicator) {
haveProgressIndicator = true;
cells[0] = new DataCell(new CircularProgressIndicator());
}
return DataRow.byIndex(
index: index,
cells: cells
);
}
List<DataRow> _getRows(int firstRowIndex, int rowsPerPage) {
List<DataRow> result = new List<DataRow>();
int nextPageFirstRowIndex = firstRowIndex + rowsPerPage;
bool haveProgressIndicator = false;
for (int index = firstRowIndex;
index < nextPageFirstRowIndex;
index += 1) {
DataRow row = null;
if (index < _rowCount || _rowCountApproximate) {
row = _rows.putIfAbsent(index, () => widget.source.getRow(index));
if (row == null && !haveProgressIndicator) {
row = row ?? _getProgressIndicatorRowFor(index);
haveProgressIndicator = true;
}
}
row = row ?? _getBlankRowFor(index);
result.Add(row);
}
return result;
}
void _handlePrevious() {
pageTo(Mathf.Max(_firstRowIndex - widget.rowsPerPage, 0));
}
void _handleNext() {
pageTo(_firstRowIndex + widget.rowsPerPage);
}
public readonly GlobalKey _tableKey = GlobalKey.key();
public override Widget build(BuildContext context) {
D.assert(material_.debugCheckHasMaterialLocalizations(context));
ThemeData themeData = Theme.of(context);
MaterialLocalizations localizations = MaterialLocalizations.of(context);
List<Widget> headerWidgets = new List<Widget>();
float startPadding = 24.0f;
if (_selectedRowCount == 0) {
headerWidgets.Add(new Expanded(child: widget.header));
if (widget.header is ButtonBar) {
startPadding = 12.0f;
}
}
else {
headerWidgets.Add(new Expanded(
child: new Text(localizations.selectedRowCountTitle(_selectedRowCount))
));
}
if (widget.actions != null) {
headerWidgets.AddRange(
widget.actions.Select((Widget action) => {
return new Padding(
// TODO: up EdgeInsetsGeometry
padding: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(
start: 24.0f - 8.0f * 2.0f),
child: action
);
}).ToList()
);
}
TextStyle footerTextStyle = themeData.textTheme.caption;
List<Widget> footerWidgets = new List<Widget>();
if (widget.onRowsPerPageChanged != null) {
List<Widget> availableRowsPerPage = widget.availableRowsPerPage
.Where((int value) => value <= _rowCount || value == widget.rowsPerPage)
.Select((int value) => {
return (Widget) new DropdownMenuItem<int>(
value: value,
child: new Text($"{value}")
);
}).ToList();
footerWidgets.AddRange(new List<Widget>() {
new Container(width: 14.0f), // to match trailing padding in case we overflow and end up scrolling
new Text(localizations.rowsPerPageTitle),
new ConstrainedBox(
constraints: new BoxConstraints(minWidth: 64.0f), // 40.0 for the text, 24.0 for the icon
child: new Align(
alignment: AlignmentDirectional.centerEnd,
child: new DropdownButtonHideUnderline(
child: new DropdownButton<int>(
items: availableRowsPerPage.Cast<DropdownMenuItem<int>>().ToList(),
value: widget.rowsPerPage,
onChanged: widget.onRowsPerPageChanged,
style: footerTextStyle,
iconSize: 24.0f
)
)
)
),
});
}
footerWidgets.AddRange(new List<Widget>() {
new Container(width: 32.0f),
new Text(
localizations.pageRowsInfoTitle(
_firstRowIndex + 1,
_firstRowIndex + widget.rowsPerPage,
_rowCount,
_rowCountApproximate
)
),
new Container(width: 32.0f),
new IconButton(
icon: new Icon(Icons.chevron_left),
padding: EdgeInsets.zero,
tooltip:
localizations.previousPageTooltip,
onPressed: _firstRowIndex <= 0 ? (VoidCallback) null : _handlePrevious),
new Container(width: 24.0f),
new IconButton(
icon: new Icon(Icons.chevron_right),
padding: EdgeInsets.zero,
tooltip:
localizations.nextPageTooltip,
onPressed: (!_rowCountApproximate && (_firstRowIndex + widget.rowsPerPage >= _rowCount))
? (VoidCallback) null
: _handleNext
),
new Container(width: 14.0f),
});
return new LayoutBuilder(
builder: (BuildContext _context, BoxConstraints constraints) => {
return new Card(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: new List<Widget> {
new DefaultTextStyle(
style: _selectedRowCount > 0
? themeData.textTheme.subtitle1.copyWith(color: themeData.accentColor)
: themeData.textTheme.headline6.copyWith(fontWeight: FontWeight.w400),
child: IconTheme.merge(
data: new IconThemeData(
opacity: 0.54f
),
child: new Ink(
height: 64.0f,
color: _selectedRowCount > 0 ? themeData.secondaryHeaderColor : null,
child: new Padding(
//TODO: update EdgeInsets
padding: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(
start: startPadding, end: 14.0f),
child: new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: headerWidgets
)
)
)
)
),
new SingleChildScrollView(
scrollDirection: Axis.horizontal,
dragStartBehavior: widget.dragStartBehavior,
child: new ConstrainedBox(
constraints: new BoxConstraints(minWidth: constraints.minWidth),
child: new DataTable(
key: _tableKey,
columns: widget.columns,
sortColumnIndex: widget.sortColumnIndex,
sortAscending: widget.sortAscending,
onSelectAll: widget.onSelectAll,
dataRowHeight: widget.dataRowHeight,
headingRowHeight: widget.headingRowHeight,
horizontalMargin: widget.horizontalMargin,
columnSpacing: widget.columnSpacing,
rows: _getRows(_firstRowIndex, widget.rowsPerPage)
)
)
),
new DefaultTextStyle(
style: footerTextStyle,
child: IconTheme.merge(
data: new IconThemeData(
opacity: 0.54f
),
child:
new Container(
height: 56.0f,
child: new SingleChildScrollView(
dragStartBehavior: widget.dragStartBehavior,
scrollDirection: Axis.horizontal,
reverse: true,
child: new Row(
children: footerWidgets
)
)
)
)
)
}
)
);
}
);
}
}
}
正在加载...
取消
保存