浏览代码

Merge branch 'siyaoH/1.17/material' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/1.17/material

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
4173e467
共有 26 个文件被更改,包括 1590 次插入414 次删除
  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. 44
      com.unity.uiwidgets/Runtime/material/expand_icon.cs
  6. 104
      com.unity.uiwidgets/Runtime/material/expansion_panel.cs
  7. 7
      com.unity.uiwidgets/Runtime/material/expansion_tile.cs
  8. 22
      com.unity.uiwidgets/Runtime/material/feedback.cs
  9. 69
      com.unity.uiwidgets/Runtime/material/flat_button.cs
  10. 215
      com.unity.uiwidgets/Runtime/material/flexible_space_bar.cs
  11. 179
      com.unity.uiwidgets/Runtime/material/floating_action_button.cs
  12. 35
      com.unity.uiwidgets/Runtime/material/floating_action_button_location.cs
  13. 114
      com.unity.uiwidgets/Runtime/material/floatting_action_button_theme.cs
  14. 74
      com.unity.uiwidgets/Runtime/material/icon_button.cs
  15. 61
      com.unity.uiwidgets/Runtime/material/input_border.cs
  16. 36
      com.unity.uiwidgets/Runtime/material/list_tile.cs
  17. 46
      com.unity.uiwidgets/Runtime/material/material.cs
  18. 40
      com.unity.uiwidgets/Runtime/material/mergeable_material.cs
  19. 160
      com.unity.uiwidgets/Runtime/material/outline_button.cs
  20. 4
      com.unity.uiwidgets/Runtime/material/page.cs
  21. 224
      com.unity.uiwidgets/Runtime/material/page_transitions_theme.cs
  22. 10
      com.unity.uiwidgets/Runtime/material/scaffold.cs
  23. 3
      com.unity.uiwidgets/Runtime/rendering/box.cs
  24. 118
      com.unity.uiwidgets/Runtime/material/grid_tile_bar.cs
  25. 3
      com.unity.uiwidgets/Runtime/material/grid_tile_bar.cs.meta
  26. 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() {
}

44
com.unity.uiwidgets/Runtime/material/expand_icon.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
public class ExpandIcon : StatefulWidget {

float size = 24.0f,
ValueChanged<bool> onPressed = null,
EdgeInsets padding = null) : base(key: key) {
EdgeInsets padding = null,
Color color = null,
Color disabledColor = null,
Color expandedColor = null
) : base(key: key) {
this.color = color;
this.disabledColor = disabledColor;
this.expandedColor = expandedColor;
}
public readonly bool isExpanded;

public readonly ValueChanged<bool> onPressed;
public readonly EdgeInsets padding;
public readonly Color color;
public readonly Color disabledColor;
public readonly Color expandedColor;
public override State createState() {
return new _ExpandIconState();

}
}
Color _iconColor {
get {
if (widget.isExpanded && widget.expandedColor != null) {
return widget.expandedColor;
}
if (widget.color != null) {
return widget.color;
}
switch (Theme.of(context).brightness) {
case Brightness.light:
return Colors.black54;
case Brightness.dark:
return Colors.white60;
}
D.assert(false);
return null;
}
}
ThemeData theme = Theme.of(context);
D.assert(material_.debugCheckHasMaterialLocalizations(context));
color: theme.brightness == Brightness.dark ? Colors.white54 : Colors.black54,
iconSize: widget.size,
color: _iconColor,
disabledColor: widget.disabledColor,
onPressed: widget.onPressed == null ? (VoidCallback) null : _handlePressed,
icon: new RotationTransition(
turns: _iconTurns,

104
com.unity.uiwidgets/Runtime/material/expansion_panel.cs


using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
static class ExpansionPanelUtils {
public const float _kPanelHeaderCollapsedHeight = 48.0f;
public const float _kPanelHeaderExpandedHeight = 64.0f;
public partial class material_ {
public const float _kPanelHeaderCollapsedHeight = kMinInteractiveDimension;
public static readonly EdgeInsets _kPanelHeaderExpandedDefaultPadding = EdgeInsets.symmetric(
vertical: 64.0f - _kPanelHeaderCollapsedHeight);
}

Key key = null,
List<ExpansionPanel> children = null,
ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null) : base(key: key) {
TimeSpan? animationDuration = null,
EdgeInsets expandedHeaderPadding = null
) : base(key: key) {
this.expandedHeaderPadding = expandedHeaderPadding ?? material_._kPanelHeaderExpandedDefaultPadding;
_allowOnlyOnePanelOpen = false;
initialOpenPanelValue = null;
}

List<ExpansionPanel> children = null,
ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null,
object initialOpenPanelValue = null) : base(key: key) {
object initialOpenPanelValue = null,
EdgeInsets expandedHeaderPadding = null
) : base(key: key) {
this.expandedHeaderPadding = expandedHeaderPadding ?? material_._kPanelHeaderExpandedDefaultPadding;
_allowOnlyOnePanelOpen = true;
this.initialOpenPanelValue = initialOpenPanelValue;
}

public readonly object initialOpenPanelValue;
public readonly EdgeInsets expandedHeaderPadding;
public override State createState() {
return new _ExpansionPanelListState();
}

public override void initState() {
base.initState();
if (widget._allowOnlyOnePanelOpen) {
D.assert(_allIdentifierUnique(), () => "All object identifiers are not unique!");
D.assert(_allIdentifierUnique(), () => "All ExpansionPanelRadio identifier values must be unique.");
if (widget.initialOpenPanelValue != null &&
child.value == widget.initialOpenPanelValue) {
_currentOpenPanel = child;
if (widget.initialOpenPanelValue != null) {
_currentOpenPanel =
searchPanelByValue(widget.children.Cast<ExpansionPanelRadio>().ToList(),
widget.initialOpenPanelValue);
}
}
}

base.didUpdateWidget(oldWidget);
ExpansionPanelList _oldWidget = (ExpansionPanelList) oldWidget;
if (widget._allowOnlyOnePanelOpen) {
D.assert(_allIdentifierUnique(), () => "All object identifiers are not unique!");
foreach (ExpansionPanelRadio newChild in widget.children) {
if (widget.initialOpenPanelValue != null &&
newChild.value == widget.initialOpenPanelValue) {
_currentOpenPanel = newChild;
}
D.assert(_allIdentifierUnique(), () => "All ExpansionPanelRadio identifier values must be unique.");
if (!_oldWidget._allowOnlyOnePanelOpen) {
_currentOpenPanel =
searchPanelByValue(widget.children.Cast<ExpansionPanelRadio>().ToList(),
widget.initialOpenPanelValue);
else if (_oldWidget._allowOnlyOnePanelOpen) {
else {
_currentOpenPanel = null;
}
}

foreach (ExpansionPanelRadio child in widget.children) {
foreach (ExpansionPanelRadio child in widget.children.Cast<ExpansionPanelRadio>()) {
identifierMap[child.value] = true;
}

}
}
_currentOpenPanel = isExpanded ? null : pressedChild;
setState(() => { _currentOpenPanel = isExpanded ? null : pressedChild; });
}
setState(() => { });
public ExpansionPanelRadio searchPanelByValue(List<ExpansionPanelRadio> panels, Object value) {
foreach (ExpansionPanelRadio panel in panels) {
if (panel.value == value)
return panel;
}
return null;
EdgeInsets kExpandedEdgeInsets = EdgeInsets.symmetric(
vertical: ExpansionPanelUtils._kPanelHeaderExpandedHeight -
ExpansionPanelUtils._kPanelHeaderCollapsedHeight);
for (int index = 0; index < widget.children.Count; index++) {
int expandIndex = index;

context,
_isChildExpanded(index)
);
Row header = new Row(
Widget expandIconContainer = new Container(
//TODO: update to EdgeInsetsGeometry
margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(end: 8.0f),
child: new ExpandIcon(
isExpanded: _isChildExpanded(index),
padding: EdgeInsets.all(16.0f),
onPressed: !child.canTapOnHeader
? (bool isExpanded) => _handlePressed(isExpanded, index)
: (ValueChanged<bool>) null
)
);
Widget header = new Row(
margin: _isChildExpanded(index) ? kExpandedEdgeInsets : EdgeInsets.zero,
margin: _isChildExpanded(index) ? widget.expandedHeaderPadding : EdgeInsets.zero,
minHeight: ExpansionPanelUtils._kPanelHeaderCollapsedHeight),
minHeight: material_._kPanelHeaderCollapsedHeight),
new Container(
margin: EdgeInsets.fromLTRB(0, 0, 8, 0),
child: new ExpandIcon(
isExpanded: _isChildExpanded(index),
padding: EdgeInsets.all(16.0f),
onPressed: !child.canTapOnHeader
? (ValueChanged<bool>) ((bool isExpanded) => {
_handlePressed(isExpanded, expandIndex);
})
: null
)
)
expandIconContainer,
if (child.canTapOnHeader) {
header = new InkWell(
onTap: () => _handlePressed(_isChildExpanded(index), index),
child: header
);
}
child.canTapOnHeader
? (Widget) new InkWell(
onTap: () =>
_handlePressed(_isChildExpanded(expandIndex), expandIndex),
child: header
)
: header,
header,
new AnimatedCrossFade(
firstChild: new Container(height: 0.0f),
secondChild: child.body,

7
com.unity.uiwidgets/Runtime/material/expansion_tile.cs


Key key = null,
Widget leading = null,
Widget title = null,
Widget subtitle = null,
Color backgroundColor = null,
ValueChanged<bool> onExpansionChanged = null,
List<Widget> children = null,

D.assert(title != null);
this.leading = leading;
this.title = title;
this.subtitle = subtitle;
this.backgroundColor = backgroundColor;
this.onExpansionChanged = onExpansionChanged;
this.children = children ?? new List<Widget>();

public readonly Widget leading;
public readonly Widget title;
public readonly Widget subtitle;
public readonly ValueChanged<bool> onExpansionChanged;

onTap: _handleTap,
leading: widget.leading,
title: widget.title,
subtitle: widget.subtitle,
trailing: widget.trailing ?? new RotationTransition(
turns: _iconTurns,
child: new Icon(Icons.expand_more)

public override void didChangeDependencies() {
ThemeData theme = Theme.of(context);
_borderColorTween.end = theme.dividerColor;
_headerColorTween.begin = theme.textTheme.subhead.color;
_headerColorTween.begin = theme.textTheme.subtitle1.color;
_headerColorTween.end = theme.accentColor;
_iconColorTween.begin = theme.unselectedWidgetColor;
_iconColorTween.end = theme.accentColor;

22
com.unity.uiwidgets/Runtime/material/feedback.cs


using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.widgets;
using UnityEngine;

case RuntimePlatform.Android:
return
Future.value(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
default:
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
D.assert(false, () => $"Unhandled TargetPlatform {_platform(context)}");
return Future.value();
}
public static GestureTapCallback wrapForTap(GestureTapCallback callback, BuildContext context) {

switch (_platform(context)) {
case RuntimePlatform.Android:
return Future.value(); // HapticFeedback.vibrate(); TODO
default:
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
D.assert(false, ()=>$"Unhandled TargetPlatform {_platform(context)}");
return Future.value();
}
public static GestureLongPressCallback

69
com.unity.uiwidgets/Runtime/material/flat_button.cs


Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
VisualDensity visualDensity = null,
Clip? clipBehavior = Clip.none,
Clip clipBehavior = Clip.none,
FocusNode focusNode = null,
bool autofocus = false,
onLongPress: onLongPress,
focusColor: focusColor,
hoverColor: hoverColor,
color: color,
disabledColor: disabledColor,
highlightColor: highlightColor,

visualDensity: visualDensity,
focusNode: focusNode,
autofocus: autofocus,
materialTapTargetSize: materialTapTargetSize,
child: child) {
}

VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
Clip? clipBehavior = null,
Clip clipBehavior = Clip.none,
FocusNode focusNode = null,
bool autofocus = false,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget icon = null,
Widget label = null) {

return new _FlatButtonWithIcon(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
onHighlightChanged: onHighlightChanged,
textTheme: textTheme,
textColor: textColor,

focusColor: focusColor,
hoverColor: hoverColor,
highlightColor: highlightColor,
splashColor: splashColor,
colorBrightness: colorBrightness,

focusNode: focusNode,
autofocus: autofocus,
materialTapTargetSize: materialTapTargetSize,
icon: icon,
label: label

return new RawMaterialButton(
onPressed: onPressed,
onLongPress: () => onLongPress(),
clipBehavior: clipBehavior ?? Clip.none,
focusColor: buttonTheme.getFocusColor(this),
hoverColor: buttonTheme.getHoverColor(this),
focusElevation: buttonTheme.getFocusElevation(this),
hoverElevation: buttonTheme.getHoverElevation(this),
visualDensity: visualDensity ?? theme.visualDensity,
clipBehavior: clipBehavior ?? Clip.none,
focusNode: focusNode,
autofocus: autofocus ?? false,
materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
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>("disabledColor", disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("colorBrightness", colorBrightness,
defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
materialTapTargetSize, defaultValue: null));
}
}
class _FlatButtonWithIcon : FlatButton, MaterialButtonWithIconMixin {

ValueChanged<bool> onHighlightChanged = null,
VoidCallback onLongPress = null,
Color focusColor = null,
Color hoverColor = null,
Clip? clipBehavior = null,
Clip clipBehavior = Clip.none,
FocusNode focusNode = null,
bool autofocus = false,
onLongPress: onLongPress,
onHighlightChanged: onHighlightChanged,
textTheme: textTheme,
textColor: textColor,

focusColor: focusColor,
hoverColor: hoverColor,
highlightColor: highlightColor,
splashColor: splashColor,
colorBrightness: colorBrightness,

focusNode: focusNode,
autofocus: autofocus,
materialTapTargetSize: materialTapTargetSize,
child: new Row(
mainAxisSize: MainAxisSize.min,

215
com.unity.uiwidgets/Runtime/material/flexible_space_bar.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

none
}
public enum StretchMode {
zoomBackground,
blurBackground,
fadeTitle,
}
public class FlexibleSpaceBar : StatefulWidget {
public FlexibleSpaceBar(
Key key = null,

EdgeInsets titlePadding = null,
CollapseMode collapseMode = CollapseMode.parallax
CollapseMode collapseMode = CollapseMode.parallax,
List<StretchMode> stretchModes = null
) : base(key: key) {
this.title = title;
this.background = background;

this.stretchModes = stretchModes ?? new List<StretchMode> {StretchMode.zoomBackground};
}
public readonly Widget title;

public readonly bool? centerTitle;
public readonly List<StretchMode> stretchModes;
public readonly EdgeInsets titlePadding;

switch (themeData.platform) {
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
return true;
default:
return false;

}
public override Widget build(BuildContext context) {
FlexibleSpaceBarSettings settings =
(FlexibleSpaceBarSettings) context.inheritFromWidgetOfExactType(typeof(FlexibleSpaceBarSettings));
D.assert(settings != null,
() => "A FlexibleSpaceBar must be wrapped in the widget returned by FlexibleSpaceBar.createSettings().");
return new LayoutBuilder(
builder: (BuildContext _context, BoxConstraints constraints) => {
FlexibleSpaceBarSettings settings =
_context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
D.assert(settings != null,
() =>
"A FlexibleSpaceBar must be wrapped in the widget returned by FlexibleSpaceBar.createSettings().");
List<Widget> children = new List<Widget>();
float deltaExtent = settings.maxExtent.Value - settings.minExtent.Value;
List<Widget> children = new List<Widget>();
float deltaExtent = settings.maxExtent.Value - settings.minExtent.Value;
float t = (1.0f - (settings.currentExtent.Value - settings.minExtent.Value) / deltaExtent)
.clamp(0.0f, 1.0f);
float t = (1.0f - (settings.currentExtent.Value - settings.minExtent.Value) / deltaExtent)
.clamp(0.0f, 1.0f);
if (widget.background != null) {
float fadeStart = Mathf.Max(0.0f, 1.0f - material_.kToolbarHeight / deltaExtent);
float fadeEnd = 1.0f;
D.assert(fadeStart <= fadeEnd);
if (widget.background != null) {
float fadeStart = Mathf.Max(0.0f, 1.0f - material_.kToolbarHeight / deltaExtent);
float fadeEnd = 1.0f;
D.assert(fadeStart <= fadeEnd);
float opacity = 1.0f - new Interval(fadeStart, fadeEnd).transform(t);
if (opacity > 0.0f) {
children.Add(new Positioned(
top: _getCollapsePadding(t, settings),
left: 0.0f,
right: 0.0f,
height: settings.maxExtent,
child: new Opacity(
opacity: opacity,
child: widget.background)
)
);
}
}
float opacity = 1.0f - new Interval(fadeStart, fadeEnd).transform(t);
if (opacity > 0.0f) {
float height = settings.maxExtent ?? 0;
if (widget.stretchModes.Contains(StretchMode.zoomBackground) &&
constraints.maxHeight > height) {
height = constraints.maxHeight;
}
children.Add(new Positioned(
top: _getCollapsePadding(t, settings),
left: 0.0f,
right: 0.0f,
height: height,
child: new Opacity(
opacity: opacity,
child: widget.background)
)
);
if (widget.stretchModes.Contains(StretchMode.blurBackground) &&
constraints.maxHeight > settings.maxExtent) {
float blurAmount = (constraints.maxHeight - settings.maxExtent) / 10 ?? 0;
children.Add(Positioned.fill(
child: new BackdropFilter(
child: new Container(
color: Colors.transparent
),
filter: ui.ImageFilter.blur(
sigmaX: blurAmount,
sigmaY: blurAmount
)
)
));
}
}
}
Widget title = null;
if (widget.title != null) {
switch (Application.platform) {
case RuntimePlatform.IPhonePlayer:
title = widget.title;
break;
default:
title = widget.title;
break;
}
}
Widget title = null;
if (widget.title != null) {
switch (Application.platform) {
case RuntimePlatform.IPhonePlayer:
title = widget.title;
break;
default:
title = widget.title;
break;
}
}
if (widget.stretchModes.Contains(StretchMode.fadeTitle) &&
constraints.maxHeight > settings.maxExtent) {
float stretchOpacity =
1 - (((constraints.maxHeight - settings.maxExtent) / 100)?.clamp(0.0f, 1.0f) ?? 0);
title = new Opacity(
opacity: stretchOpacity,
child: title
);
}
ThemeData theme = Theme.of(context);
float toolbarOpacity = settings.toolbarOpacity.Value;
if (toolbarOpacity > 0.0f) {
TextStyle titleStyle = theme.primaryTextTheme.title;
titleStyle = titleStyle.copyWith(
color: titleStyle.color.withOpacity(toolbarOpacity));
ThemeData theme = Theme.of(_context);
float toolbarOpacity = settings.toolbarOpacity.Value;
if (toolbarOpacity > 0.0f) {
TextStyle titleStyle = theme.primaryTextTheme.title;
titleStyle = titleStyle.copyWith(
color: titleStyle.color.withOpacity(toolbarOpacity));
bool effectiveCenterTitle = _getEffectiveCenterTitle(theme).Value;
EdgeInsets padding = widget.titlePadding ??
EdgeInsets.only(
left: effectiveCenterTitle ? 0.0f : 72.0f,
bottom: 16.0f
);
float scaleValue = new FloatTween(begin: 1.5f, end: 1.0f).lerp(t);
Matrix4 scaleTransform = Matrix4.diagonal3Values(scaleValue, scaleValue, 1);
Alignment titleAlignment = _getTitleAlignment(effectiveCenterTitle);
bool effectiveCenterTitle = _getEffectiveCenterTitle(theme).Value;
EdgeInsets padding = widget.titlePadding ??
EdgeInsets.only(
left: effectiveCenterTitle ? 0.0f : 72.0f,
bottom: 16.0f
);
float scaleValue = new FloatTween(begin: 1.5f, end: 1.0f).lerp(t);
Matrix4 scaleTransform = Matrix4.diagonal3Values(scaleValue, scaleValue, 1);
Alignment titleAlignment = _getTitleAlignment(effectiveCenterTitle);
children.Add(new Container(
padding: padding,
child: new Transform(
alignment: titleAlignment,
transform: scaleTransform,
child: new Align(
alignment: titleAlignment,
child: new DefaultTextStyle(
style: titleStyle,
child: title)
children.Add(new Container(
padding: padding,
child: new Transform(
alignment: titleAlignment,
transform: scaleTransform,
child: new Align(
alignment: titleAlignment,
child: new DefaultTextStyle(
style: titleStyle,
child: new LayoutBuilder(
builder: (BuildContext __context, BoxConstraints _constraints) => {
return new Container(
width: _constraints.maxWidth / scaleValue,
alignment: titleAlignment,
child: title
);
}
)
)
)
)
)
)
);
}
);
}
return new ClipRect(
child: new Stack(
children: children)
return new ClipRect(
child: new Stack(
children: children)
);
}
);
}
}

float? currentExtent = null,
Widget child = null
) : base(key: key, child: child) {
D.assert(currentExtent != null);
D.assert(child != null);
D.assert(toolbarOpacity != null);
D.assert(minExtent != null && minExtent >= 0);
D.assert(maxExtent != null && maxExtent >= 0);
D.assert(currentExtent != null && currentExtent >= 0);
D.assert(toolbarOpacity >= 0.0);
D.assert(minExtent <= maxExtent);
D.assert(minExtent <= currentExtent);
D.assert(currentExtent <= maxExtent);
this.toolbarOpacity = toolbarOpacity;
this.minExtent = minExtent;
this.maxExtent = maxExtent;

179
com.unity.uiwidgets/Runtime/material/floating_action_button.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
static class FloatActionButtonUtils {
public partial class material_ {
public static readonly BoxConstraints _kSizeConstraints = BoxConstraints.tightFor(width: 56.0f, height: 56.0f);
public static readonly BoxConstraints _kMiniSizeConstraints =

}
public class FloatingActionButton : StatelessWidget {
FloatingActionButton(
public FloatingActionButton(
Color focusColor = null,
Color hoverColor = null,
Color splashColor = null,
float? focusElevation = null,
float? hoverElevation = null,
float? highlightElevation = null,
float? disabledElevation = null,
VoidCallback onPressed = null,

FocusNode focusNode = null,
bool autofocus = false,
D.assert(focusElevation == null || focusElevation >= 0.0);
D.assert(hoverElevation == null || hoverElevation >= 0.0);
D.assert(highlightElevation == null || highlightElevation >= 0.0f);
D.assert(disabledElevation == null || disabledElevation >= 0.0f);
heroTag = heroTag ?? new _DefaultHeroTag();

this.backgroundColor = backgroundColor;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.splashColor = splashColor;
this.focusElevation = focusElevation;
this.hoverElevation = hoverElevation;
this.focusNode = focusNode;
this.autofocus = autofocus;
? FloatActionButtonUtils._kMiniSizeConstraints
: FloatActionButtonUtils._kSizeConstraints);
}
public FloatingActionButton(
Key key = null,
Widget child = null,
string tooltip = null,
Color foregroundColor = null,
Color backgroundColor = null,
object heroTag = null,
float elevation = 6.0f,
float highlightElevation = 12.0f,
VoidCallback onPressed = null,
bool mini = false,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
bool isExtended = false
) : this(key: key,
child: child,
tooltip: tooltip,
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
heroTag: heroTag,
elevation: elevation,
highlightElevation: highlightElevation,
onPressed: onPressed,
mini: mini,
shape: shape,
clipBehavior: clipBehavior,
materialTapTargetSize: materialTapTargetSize,
isExtended: isExtended,
_sizeConstraints: null) {
? material_._kMiniSizeConstraints
: material_._kSizeConstraints);
}
public static FloatingActionButton extended(

Color backgroundColor = null,
Color focusColor = null,
Color hoverColor = null,
float? focusElevation = null,
float? hoverElevation = null,
float? splashColor = null,
float? highlightElevation = null,
float? disabledElevation = null,
VoidCallback onPressed = null,

Clip clipBehavior = Clip.none,
FocusNode focusNode = null,
bool autofocus = false,
D.assert(focusElevation == null || focusElevation >= 0.0);
D.assert(hoverElevation == null || hoverElevation >= 0.0);
BoxConstraints _sizeConstraints = FloatActionButtonUtils._kExtendedSizeConstraints;
BoxConstraints _sizeConstraints = material_._kExtendedSizeConstraints;
bool mini = false;
Widget child = new _ChildOverflowBox(
child: new Row(

public readonly Color backgroundColor;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly Color splashColor;
public readonly object heroTag;
public readonly VoidCallback onPressed;

public readonly float? focusElevation;
public readonly float? hoverElevation;
public readonly float? highlightElevation;
public readonly float? disabledElevation;

public readonly bool isExtended;
public readonly FocusNode focusNode;
public readonly bool autofocus;
const float _defaultFocusElevation = 8;
const float _defaultHoverElevation = 10;
const float _defaultElevation = 6;
const float _defaultHighlightElevation = 12;
readonly ShapeBorder _defaultShape = new CircleBorder();

ThemeData theme = Theme.of(context);
FloatingActionButtonThemeData floatingActionButtonTheme = theme.floatingActionButtonTheme;
if (this.foregroundColor == null && floatingActionButtonTheme.foregroundColor == null) {
bool accentIsDark = theme.accentColorBrightness == Brightness.dark;
Color defaultAccentIconThemeColor = accentIsDark ? Colors.white : Colors.black;
if (theme.accentIconTheme.color != defaultAccentIconThemeColor) {
Debug.Log(
"Warning: " +
"The support for configuring the foreground color of " +
"FloatingActionButtons using ThemeData.accentIconTheme " +
"has been deprecated. Please use ThemeData.floatingActionButtonTheme " +
"instead. "
);
}
}
Color foregroundColor = this.foregroundColor
?? floatingActionButtonTheme.foregroundColor
?? theme.colorScheme.onSecondary;
Color foregroundColor = this.foregroundColor
?? floatingActionButtonTheme.foregroundColor
?? theme.accentIconTheme.color
?? theme.colorScheme.onSecondary;
Color focusColor = this.focusColor
?? floatingActionButtonTheme.focusColor
?? theme.focusColor;
Color hoverColor = this.hoverColor
?? floatingActionButtonTheme.hoverColor
?? theme.hoverColor;
Color splashColor = this.splashColor
?? floatingActionButtonTheme.splashColor
?? theme.splashColor;
float focusElevation = this.focusElevation
?? floatingActionButtonTheme.focusElevation
?? _defaultFocusElevation;
float hoverElevation = this.hoverElevation
?? floatingActionButtonTheme.hoverElevation
?? _defaultHoverElevation;
TextStyle textStyle = theme.accentTextTheme.button.copyWith(
TextStyle textStyle = theme.textTheme.button.copyWith(
color: foregroundColor,
letterSpacing: 1.2f
);

Widget result = null;
if (child != null) {
result = IconTheme.merge(
data: new IconThemeData(
color: foregroundColor),
child: child
);
}
result = new RawMaterialButton(
Widget result = new RawMaterialButton(
focusElevation: focusElevation,
hoverElevation: hoverElevation,
focusColor: focusColor,
hoverColor: hoverColor,
splashColor: splashColor,
child: result);
focusNode: focusNode,
autofocus: autofocus,
child: child
);
child: result);
child: result
);
child: result);
child: result
);
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", onPressed, ifNull: "disabled"));
properties.add(new StringProperty("tooltip", tooltip, defaultValue: null));
properties.add(new ColorProperty("foregroundColor", foregroundColor, defaultValue: null));
properties.add(new ColorProperty("backgroundColor", backgroundColor, defaultValue: null));
properties.add(new ColorProperty("focusColor", focusColor, defaultValue: null));
properties.add(new ColorProperty("hoverColor", hoverColor, defaultValue: null));
properties.add(new ColorProperty("splashColor", splashColor, defaultValue: null));
properties.add(new ObjectFlagProperty<object>("heroTag", heroTag, ifPresent: "hero"));
properties.add(new FloatProperty("elevation", elevation, defaultValue: null));
properties.add(new FloatProperty("focusElevation", focusElevation, defaultValue: null));
properties.add(new FloatProperty("hoverElevation", hoverElevation, defaultValue: null));
properties.add(new FloatProperty("highlightElevation", highlightElevation, defaultValue: null));
properties.add(new FloatProperty("disabledElevation", disabledElevation, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<FocusNode>("focusNode", focusNode, defaultValue: null));
properties.add(new FlagProperty("isExtended", value: isExtended, ifTrue: "extended"));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
materialTapTargetSize, defaultValue: null));
}
}
class _ChildOverflowBox : SingleChildRenderObjectWidget {

}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
if (renderObject is _RenderChildOverflowBox renderChildOverflowBox) {
renderChildOverflowBox.textDirection = Directionality.of(context);
}
}
}

}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
if (child != null) {
child.layout(new BoxConstraints(), parentUsesSize: true);
size = new Size(

35
com.unity.uiwidgets/Runtime/material/floating_action_button_location.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
public static class FloatingActionButtonLocationUtils {
public partial class material_ {
public const float kFloatingActionButtonMargin = 16.0f;
public static readonly TimeSpan kFloatingActionButtonSegue = new TimeSpan(0, 0, 0, 0, 200);

public abstract Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry);
public override string ToString() {
return GetType().ToString();
return foundation_.objectRuntimeType(this, "FloatingActionButtonLocation");
}
}

float bottomSheetHeight = scaffoldGeometry.bottomSheetSize.height;
float fabHeight = scaffoldGeometry.floatingActionButtonSize.height;
float snackBarHeight = scaffoldGeometry.snackBarSize.height;
float fabY = contentBottom - fabHeight - FloatingActionButtonLocationUtils.kFloatingActionButtonMargin;
float fabY = contentBottom - fabHeight - material_.kFloatingActionButtonMargin;
FloatingActionButtonLocationUtils.kFloatingActionButtonMargin);
material_.kFloatingActionButtonMargin);
}
if (bottomSheetHeight > 0.0f) {

}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
float fabX = FloatingActionButtonLocationUtils._endOffset(scaffoldGeometry);
float fabX = material_._endOffset(scaffoldGeometry);
float contentBottom = scaffoldGeometry.contentBottom;
float bottomSheetHeight = scaffoldGeometry.bottomSheetSize.height;

float fabY = contentBottom - fabHeight - FloatingActionButtonLocationUtils.kFloatingActionButtonMargin;
float fabY = contentBottom - fabHeight - material_.kFloatingActionButtonMargin;
FloatingActionButtonLocationUtils.kFloatingActionButtonMargin);
material_.kFloatingActionButtonMargin);
}
if (bottomSheetHeight > 0.0f) {

if (snackBarHeight > 0.0f) {
fabY = Mathf.Min(fabY,
contentBottom - snackBarHeight - fabHeight -
FloatingActionButtonLocationUtils.kFloatingActionButtonMargin);
material_.kFloatingActionButtonMargin);
}
if (bottomSheetHeight > 0.0f) {

}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
float fabX = FloatingActionButtonLocationUtils._endOffset(scaffoldGeometry);
float fabX = material_._endOffset(scaffoldGeometry);
return new Offset(fabX, getDockedY(scaffoldGeometry));
}

}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
return new Offset(FloatingActionButtonLocationUtils._startOffset(scaffoldGeometry),
FloatingActionButtonLocationUtils._straddleAppBar(scaffoldGeometry));
return new Offset(material_._startOffset(scaffoldGeometry),
material_._straddleAppBar(scaffoldGeometry));
}
public override string ToString() {

}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
return new Offset(FloatingActionButtonLocationUtils._startOffset(scaffoldGeometry, offset: 4.0f),
FloatingActionButtonLocationUtils._straddleAppBar(scaffoldGeometry));
return new Offset(material_._startOffset(scaffoldGeometry, offset: 4.0f),
material_._straddleAppBar(scaffoldGeometry));
}
public override string ToString() {

}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
return new Offset(FloatingActionButtonLocationUtils._endOffset(scaffoldGeometry),
FloatingActionButtonLocationUtils._straddleAppBar(scaffoldGeometry));
return new Offset(material_._endOffset(scaffoldGeometry),
material_._straddleAppBar(scaffoldGeometry));
}
public override string ToString() {

}
public override string ToString() {
return GetType().ToString();
return foundation_.objectRuntimeType(this, "FloatingActionButtonAnimator");
}
}

}
static readonly Animatable<float> _rotationTween = new FloatTween(
begin: 1.0f - FloatingActionButtonLocationUtils.kFloatingActionButtonTurnInterval * 2.0f,
begin: 1.0f - material_.kFloatingActionButtonTurnInterval * 2.0f,
end: 1.0f
);

114
com.unity.uiwidgets/Runtime/material/floatting_action_button_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using UnityEngine;

public class FloatingActionButtonThemeData : Diagnosticable {
public class FloatingActionButtonThemeData : Diagnosticable, IEquatable<FloatingActionButtonThemeData> {
Color backgroundColor = null,
Color backgroundColor = null,
Color focusColor = null,
Color hoverColor = null,
Color splashColor = null,
float? focusElevation = null,
float? hoverElevation = null,
this.foregroundColor = foregroundColor;
this.foregroundColor = foregroundColor;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.splashColor = splashColor;
this.focusElevation = focusElevation;
this.hoverElevation = hoverElevation;
public readonly Color foregroundColor;
public readonly Color foregroundColor;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly Color splashColor;
public readonly float? focusElevation;
public readonly float? hoverElevation;
public readonly float? disabledElevation;

public FloatingActionButtonThemeData copyWith(
Color backgroundColor,
Color foregroundColor,
float? elevation,
float? disabledElevation,
float? highlightElevation,
ShapeBorder shape
Color foregroundColor = null,
Color backgroundColor = null,
Color focusColor = null,
Color hoverColor = null,
Color splashColor = null,
float? elevation = null,
float? focusElevation = null,
float? hoverElevation = null,
float? disabledElevation = null,
float? highlightElevation = null,
ShapeBorder shape = null
foregroundColor: foregroundColor ?? this.foregroundColor,
foregroundColor: foregroundColor ?? this.foregroundColor,
focusColor: focusColor ?? this.focusColor,
hoverColor: hoverColor ?? this.hoverColor,
splashColor: splashColor ?? this.splashColor,
focusElevation: focusElevation ?? this.focusElevation,
hoverElevation: hoverElevation ?? this.hoverElevation,
disabledElevation: disabledElevation ?? this.disabledElevation,
highlightElevation: highlightElevation ?? this.highlightElevation,
shape: shape ?? this.shape

public static FloatingActionButtonThemeData lerp(FloatingActionButtonThemeData a, FloatingActionButtonThemeData b,
public static FloatingActionButtonThemeData lerp(FloatingActionButtonThemeData a,
FloatingActionButtonThemeData b,
float t) {
if (a == null && b == null) {
return null;

backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
focusColor: Color.lerp(a?.focusColor, b?.focusColor, t),
hoverColor: Color.lerp(a?.hoverColor, b?.hoverColor, t),
splashColor: Color.lerp(a?.splashColor, b?.splashColor, t),
focusElevation: Mathf.Lerp(a?.focusElevation ?? 0, b?.focusElevation ?? 0, t),
hoverElevation: Mathf.Lerp(a?.hoverElevation ?? 0, b?.hoverElevation ?? 0, t),
disabledElevation: Mathf.Lerp(a?.disabledElevation ?? 0, b?.disabledElevation ?? 0, t),
highlightElevation: Mathf.Lerp(a?.highlightElevation ?? 0, b?.highlightElevation ?? 0, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)

public override int GetHashCode() {
var hashCode = backgroundColor?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ foregroundColor?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ elevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ disabledElevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ highlightElevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ shape?.GetHashCode() ?? 0;
var hashCode = (foregroundColor != null ? foregroundColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (backgroundColor != null ? backgroundColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (focusColor != null ? focusColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (hoverColor != null ? hoverColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (splashColor != null ? splashColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ elevation.GetHashCode();
hashCode = (hashCode * 397) ^ focusElevation.GetHashCode();
hashCode = (hashCode * 397) ^ hoverElevation.GetHashCode();
hashCode = (hashCode * 397) ^ disabledElevation.GetHashCode();
hashCode = (hashCode * 397) ^ highlightElevation.GetHashCode();
hashCode = (hashCode * 397) ^ (shape != null ? shape.GetHashCode() : 0);
return hashCode;
}

return true;
}
return Equals(backgroundColor, other.backgroundColor)
&& Equals(elevation, other.elevation)
&& Equals(shape, other.shape)
&& Equals(foregroundColor, other.foregroundColor)
&& Equals(disabledElevation, other.disabledElevation)
&& Equals(highlightElevation, other.highlightElevation);
return Equals(foregroundColor, other.foregroundColor) && Equals(backgroundColor, other.backgroundColor) &&
Equals(focusColor, other.focusColor) && Equals(hoverColor, other.hoverColor) &&
Equals(splashColor, other.splashColor) && Nullable.Equals(elevation, other.elevation) &&
Nullable.Equals(focusElevation, other.focusElevation) &&
Nullable.Equals(hoverElevation, other.hoverElevation) &&
Nullable.Equals(disabledElevation, other.disabledElevation) &&
Nullable.Equals(highlightElevation, other.highlightElevation) && Equals(shape, other.shape);
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {

base.debugFillProperties(properties);
FloatingActionButtonThemeData defaultData = new FloatingActionButtonThemeData();
properties.add(new DiagnosticsProperty<Color>("backgroundColor", backgroundColor,
defaultValue: defaultData.backgroundColor));
properties.add(new DiagnosticsProperty<Color>("foregroundColor", foregroundColor,
properties.add(new ColorProperty("foregroundColor", foregroundColor,
properties.add(new DiagnosticsProperty<float?>("elevation", elevation,
defaultValue: defaultData.elevation));
properties.add(new DiagnosticsProperty<float?>("disabledElevation", disabledElevation,
properties.add(new ColorProperty("backgroundColor", backgroundColor,
defaultValue: defaultData.backgroundColor));
properties.add(new ColorProperty("focusColor", focusColor, defaultValue: defaultData.focusColor));
properties.add(new ColorProperty("hoverColor", hoverColor, defaultValue: defaultData.hoverColor));
properties.add(new ColorProperty("splashColor", splashColor, defaultValue: defaultData.splashColor));
properties.add(new FloatProperty("elevation", elevation, defaultValue: defaultData.elevation));
properties.add(
new FloatProperty("focusElevation", focusElevation, defaultValue: defaultData.focusElevation));
properties.add(
new FloatProperty("hoverElevation", hoverElevation, defaultValue: defaultData.hoverElevation));
properties.add(new FloatProperty("disabledElevation", disabledElevation,
properties.add(new DiagnosticsProperty<float?>("highlightElevation", highlightElevation,
properties.add(new FloatProperty("highlightElevation", highlightElevation,
defaultValue: defaultData.highlightElevation));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: defaultData.shape));
}

74
com.unity.uiwidgets/Runtime/material/icon_button.cs


using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
static class IconButtonUtils {
public const float _kMinButtonSize = 48.0f;
public partial class material_ {
public const float _kMinButtonSize = kMinInteractiveDimension;
}

float iconSize = 24.0f,
VisualDensity visualDensity = null,
Color focusColor = null,
Color hoverColor = null,
Color disableColor = null,
Color disabledColor = null,
string tooltip = null) : base(key: key) {
FocusNode focusNode = null,
bool autofocus = false,
string tooltip = null,
bool? enableFeedback = true,
BoxConstraints constraints = null
) : base(key: key) {
this.visualDensity = visualDensity;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
disabledColor = disableColor;
this.disabledColor = disabledColor;
this.focusNode = focusNode;
this.autofocus = autofocus;
this.enableFeedback = enableFeedback;
this.constraints = constraints;
public readonly VisualDensity visualDensity;
public readonly EdgeInsets padding;

public readonly Color focusColor;
public readonly Color hoverColor;
public readonly Color color;
public readonly Color splashColor;

public readonly VoidCallback onPressed;
public readonly FocusNode focusNode;
public readonly bool autofocus;
public readonly bool? enableFeedback;
public readonly BoxConstraints constraints;
ThemeData theme = Theme.of(context);
Color currentColor;
if (onPressed != null) {
currentColor = color;

}
VisualDensity effectiveVisualDensity = visualDensity ?? theme.visualDensity;
BoxConstraints unadjustedConstraints = constraints ?? new BoxConstraints(
minWidth: material_._kMinButtonSize,
minHeight: material_._kMinButtonSize
);
BoxConstraints adjustedConstraints = effectiveVisualDensity.effectiveConstraints(unadjustedConstraints);
constraints: new BoxConstraints(minWidth: IconButtonUtils._kMinButtonSize,
minHeight: IconButtonUtils._kMinButtonSize),
constraints: adjustedConstraints,
child: new Padding(
padding: padding,
child: new SizedBox(

child: IconTheme.merge(
data: new IconThemeData(
size: iconSize,
color: currentColor),
child: icon)
color: currentColor
),
child: icon
)
)
)
)

}
return new InkResponse(
focusNode: focusNode,
autofocus: autofocus,
canRequestFocus: onPressed != null,
enableFeedback: enableFeedback ?? false,
focusColor: focusColor ?? Theme.of(context).focusColor,
hoverColor: hoverColor ?? Theme.of(context).hoverColor,
highlightColor: highlightColor ?? Theme.of(context).highlightColor,
splashColor: splashColor ?? Theme.of(context).splashColor,
radius: Mathf.Max(

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Widget>("icon", icon, showName: false));
properties.add(new StringProperty("tooltip", tooltip, defaultValue: null, quoted: false));
properties.add(new ColorProperty("color", color, defaultValue: null));
properties.add(new ColorProperty("disabledColor", disabledColor, defaultValue: null));
properties.add(new ColorProperty("focusColor", focusColor, defaultValue: null));
properties.add(new ColorProperty("hoverColor", hoverColor, defaultValue: null));
properties.add(new ColorProperty("highlightColor", highlightColor, defaultValue: null));
properties.add(new ColorProperty("splashColor", splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<FocusNode>("focusNode", focusNode, defaultValue: null));
}
}
}

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();

10
com.unity.uiwidgets/Runtime/material/scaffold.cs


base.initState();
_previousController = new AnimationController(
duration: FloatingActionButtonLocationUtils.kFloatingActionButtonSegue,
duration: material_.kFloatingActionButtonSegue,
vsync: this);
_previousController.addStatusListener(_handlePreviousAnimationStatusChanged);

}
static readonly Animatable<float> _entranceTurnTween = new FloatTween(
begin: 1.0f - FloatingActionButtonLocationUtils.kFloatingActionButtonTurnInterval,
begin: 1.0f - material_.kFloatingActionButtonTurnInterval,
end: 1.0f
).chain(new CurveTween(curve: Curves.easeIn));

lowerBound: 0.0f,
upperBound: 1.0f,
value: 1.0f,
duration: FloatingActionButtonLocationUtils.kFloatingActionButtonSegue +
FloatingActionButtonLocationUtils.kFloatingActionButtonSegue
duration: material_.kFloatingActionButtonSegue +
material_.kFloatingActionButtonSegue
duration: FloatingActionButtonLocationUtils.kFloatingActionButtonSegue,
duration: material_.kFloatingActionButtonSegue,
vsync: this
);
}

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
)
)
)
)
)
}
)
);
}
);
}
}
}
正在加载...
取消
保存