浏览代码

[Cupertino] Add Action Sheet & Dialog

/main
iizzaya 5 年前
当前提交
288df053
共有 30 个文件被更改,包括 2093 次插入66 次删除
  1. 8
      Runtime/cupertino/app.cs
  2. 11
      Runtime/cupertino/route.cs
  3. 2
      Runtime/material/chip.cs
  4. 2
      Runtime/material/input_decorator.cs
  5. 2
      Runtime/material/list_tile.cs
  6. 2
      Runtime/material/slider.cs
  7. 2
      Runtime/rendering/box.cs
  8. 2
      Runtime/rendering/custom_layout.cs
  9. 2
      Runtime/rendering/editable.cs
  10. 2
      Runtime/rendering/flex.cs
  11. 2
      Runtime/rendering/image.cs
  12. 2
      Runtime/rendering/list_body.cs
  13. 2
      Runtime/rendering/paragraph.cs
  14. 2
      Runtime/rendering/performance_overlay.cs
  15. 8
      Runtime/rendering/proxy_box.cs
  16. 2
      Runtime/rendering/proxy_box.mixin.gen.cs
  17. 2
      Runtime/rendering/rotated_box.cs
  18. 10
      Runtime/rendering/shifted_box.cs
  19. 2
      Runtime/rendering/stack.cs
  20. 2
      Runtime/rendering/table.cs
  21. 2
      Runtime/rendering/viewport.cs
  22. 2
      Runtime/rendering/wrap.cs
  23. 2
      Runtime/widgets/layout_builder.cs
  24. 2
      Runtime/widgets/single_child_scroll_view.cs
  25. 42
      Samples/UIWidgetsGallery/demo/cupertino/cupertino_alert_demo.cs
  26. 16
      Samples/UIWidgetsGallery/gallery/demos.cs
  27. 1001
      Runtime/cupertino/action_sheet.cs
  28. 11
      Runtime/cupertino/action_sheet.cs.meta
  29. 1001
      Runtime/cupertino/dialog.cs
  30. 11
      Runtime/cupertino/dialog.cs.meta

8
Runtime/cupertino/app.cs


this._navigatorObservers = new List<NavigatorObserver>();
}
}
// Iterable<LocalizationsDelegate<dynamic>> get _localizationsDelegates sync* {
// if (widget.localizationsDelegates != null)
// yield* widget.localizationsDelegates;
// yield DefaultCupertinoLocalizations.delegate;
// }
List<LocalizationsDelegate> _localizationsDelegates {
get {
List<LocalizationsDelegate<CupertinoLocalizations>> _delegates =

11
Runtime/cupertino/route.cs


);
public static IPromise<T> showCupertinoModalPopup<T>(
public static IPromise<object> showCupertinoModalPopup(
return (IPromise<T>) Navigator.of(context, rootNavigator: true).push(
return Navigator.of(context, rootNavigator: true).push(
new _CupertinoModalPopupRoute(
builder: builder,
barrierLabel: "Dismiss"

);
}
public static IPromise<T> showCupertinoDialog<T>(
public static IPromise<object> showCupertinoDialog(
return (IPromise<T>) DialogUtils.showGeneralDialog(
return DialogUtils.showGeneralDialog(
pageBuilder:
(BuildContext _context, Animation<float> animation, Animation<float> secondaryAnimation) => {
pageBuilder: (BuildContext _context, Animation<float> animation, Animation<float> secondaryAnimation) => {
return builder(_context);
},
transitionBuilder: _buildCupertinoDialogTransitions

2
Runtime/material/chip.cs


);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this.computeMinIntrinsicHeight(width);
}

2
Runtime/material/input_decorator.cs


+ this.contentPadding.bottom;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this.computeMinIntrinsicHeight(width);
}

2
Runtime/material/list_tile.cs


this.title.getMinIntrinsicHeight(width) + this.subtitle?.getMinIntrinsicHeight(width) ?? 0.0f);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this.computeMinIntrinsicHeight(width);
}

2
Runtime/material/slider.cs


return Mathf.Max(this._minPreferredTrackHeight, this._maxSliderPartHeight);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return Mathf.Max(this._minPreferredTrackHeight, this._maxSliderPartHeight);
}

2
Runtime/rendering/box.cs


this.computeMaxIntrinsicHeight);
}
protected virtual float computeMaxIntrinsicHeight(float width) {
protected internal virtual float computeMaxIntrinsicHeight(float width) {
return 0.0f;
}

2
Runtime/rendering/custom_layout.cs


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
float height = this._getSize(BoxConstraints.tightForFinite(width: width)).height;
if (height.isFinite()) {
return height;

2
Runtime/rendering/editable.cs


return this._preferredHeight(width);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this._preferredHeight(width);
}

2
Runtime/rendering/flex.cs


);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this._getIntrinsicSize(
sizingDirection: Axis.vertical,
extent: width,

2
Runtime/rendering/image.cs


return this._sizeForConstraints(BoxConstraints.tightForFinite(width: width)).height;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
D.assert(width >= 0.0);
return this._sizeForConstraints(BoxConstraints.tightForFinite(width: width)).height;
}

2
Runtime/rendering/list_body.cs


}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
switch (this.mainAxis) {
case Axis.horizontal:
return this._getIntrinsicMainAxis((RenderBox child) => child.getMaxIntrinsicHeight(width));

2
Runtime/rendering/paragraph.cs


return this._computeIntrinsicHeight(width);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this._computeIntrinsicHeight(width);
}

2
Runtime/rendering/performance_overlay.cs


return this._intrinsicHeight;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this._intrinsicHeight;
}

8
Runtime/rendering/proxy_box.cs


return height;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this._additionalConstraints.hasBoundedHeight && this._additionalConstraints.hasTightHeight) {
return this._additionalConstraints.minHeight;
}

return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (width.isFinite()) {
return width / this._aspectRatio;
}

return _applyStep(height, this._stepHeight);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child == null) {
return 0.0f;
}

return base.computeMinIntrinsicHeight(width);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.offstage) {
return 0.0f;
}

2
Runtime/rendering/proxy_box.mixin.gen.cs


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(width);
}

2
Runtime/rendering/rotated_box.cs


return this._isVertical ? this.child.getMinIntrinsicWidth(width) : this.child.getMinIntrinsicHeight(width);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child == null) {
return 0.0f;
}

10
Runtime/rendering/shifted_box.cs


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(width);
}

return this._padding.vertical;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(Mathf.Max(0.0f, width - this._padding.horizontal)) +
this._padding.vertical;

return this._requestedSize.height;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this._requestedSize.height;
}

return result / (this._heightFactor ?? 1.0f);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
float result;
if (this.child == null) {
result = base.computeMaxIntrinsicHeight(width);

return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
float height = this._getSize(BoxConstraints.tightForFinite(width: width)).height;
if (height.isFinite()) {
return height;

2
Runtime/rendering/stack.cs


return this._getIntrinsicDimension((RenderBox child) => child.getMinIntrinsicHeight(width));
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this._getIntrinsicDimension((RenderBox child) => child.getMaxIntrinsicHeight(width));
}

2
Runtime/rendering/table.cs


return rowTop;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
return this.computeMinIntrinsicHeight(width);
}

2
Runtime/rendering/viewport.cs


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
D.assert(this.debugThrowIfNotCheckingIntrinsics());
return 0.0f;
}

2
Runtime/rendering/wrap.cs


throw new Exception("Unknown axis: " + this.direction);
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
switch (this.direction) {
case Axis.horizontal:
return this._computeIntrinsicHeightForWidth(width);

2
Runtime/widgets/layout_builder.cs


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
D.assert(this._debugThrowIfNotCheckingIntrinsics());
return 0.0f;
}

2
Runtime/widgets/single_child_scroll_view.cs


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(width);
}

42
Samples/UIWidgetsGallery/demo/cupertino/cupertino_alert_demo.cs


using Unity.UIWidgets.widgets;
namespace UIWidgetsGallery.gallery {
/*
public override State createState() => new _CupertinoAlertDemoState();
public override State createState() {
return new _CupertinoAlertDemoState();
}
}
class _CupertinoAlertDemoState : State<CupertinoAlertDemo> {

BuildContext context = null,
Widget child = null
) {
CupertinoRouteUtils.showCupertinoDialog<string>(
CupertinoRouteUtils.showCupertinoDialog(
).Then((string value) => {
).Then((object value) => {
this.setState(() => { this.lastSelectedValue = value; });
this.setState(() => { this.lastSelectedValue = value as string; });
}
});
}

Widget child = null
) {
CupertinoRouteUtils.showCupertinoModalPopup<string>(
CupertinoRouteUtils.showCupertinoModalPopup(
).Then((string value) => {
).Then((object value) => {
this.setState(() => { this.lastSelectedValue = value; });
this.setState(() => { this.lastSelectedValue = value as string; });
}
});
}

onPressed: () => {
this.showDemoDialog(
context: _context,
child: new CupertinoAlertDialog(
child:
new CupertinoAlertDialog(
title: new Text("Discard draft?"),
actions: new List<Widget> {
new CupertinoDialogAction(

context: _context,
child: new CupertinoActionSheet(
title: new Text("Favorite Dessert"),
message:
new Text(
message: new Text(
actions:
new List<Widget> {
actions: new List<Widget> {
new CupertinoActionSheetAction(
child: new Text("Profiteroles"),
onPressed: () => {

new CupertinoActionSheetAction(
child: new Text("Trifle"),
onPressed: () => { Navigator.pop(_context, "Trifle"); }
),
)
isDefaultAction:
true,
onPressed:
() => { Navigator.pop(_context, "Cancel"); }
isDefaultAction: true,
onPressed: () => { Navigator.pop(_context, "Cancel"); }
)
)
);

stackChildren.Add(
new Positioned(
bottom: 32.0f,
child: new Text("You selected: $lastSelectedValue")
child: new Text($"You selected: {this.lastSelectedValue}")
)
);
}

public override Widget build(BuildContext context) {
return new CupertinoAlertDialog(
title: title,
content: content,
title: this.title,
content: this.content,
actions: new List<Widget> {
new CupertinoDialogAction(
child: new Text("Cheesecake"),

);
}
}
*/
}

16
Samples/UIWidgetsGallery/gallery/demos.cs


// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoActivityIndicator-class.html",
// buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo()
// ),
// new GalleryDemo(
// title: "Alerts",
// icon: GalleryIcons.dialogs,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoAlertDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/showCupertinoDialog.html",
// buildRoute: (BuildContext context) => CupertinoAlertDemo()
// ),
new GalleryDemo(
title: "Alerts",
icon: GalleryIcons.dialogs,
category: _kCupertinoComponents,
routeName: CupertinoAlertDemo.routeName,
documentationUrl: "https://docs.flutter.io/flutter/cupertino/showCupertinoDialog.html",
buildRoute: (BuildContext context) => new CupertinoAlertDemo()
),
new GalleryDemo(
title: "Buttons",
icon: GalleryIcons.generic_buttons,

1001
Runtime/cupertino/action_sheet.cs
文件差异内容过多而无法显示
查看文件

11
Runtime/cupertino/action_sheet.cs.meta


fileFormatVersion: 2
guid: ea4f1fabac9a048f085e528a41c2415d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1001
Runtime/cupertino/dialog.cs
文件差异内容过多而无法显示
查看文件

11
Runtime/cupertino/dialog.cs.meta


fileFormatVersion: 2
guid: e184ed6bf781845be961798e888aa6ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存