浏览代码

[Cupertino] Implement nav_bar.

/main
Yuncong Zhang 5 年前
当前提交
0b6b7511
共有 9 个文件被更改,包括 571 次插入327 次删除
  1. 765
      Runtime/cupertino/nav_bar.cs
  2. 8
      Runtime/cupertino/page_scaffold.cs
  3. 2
      Runtime/cupertino/text_theme.cs
  4. 43
      Runtime/widgets/transitions.cs
  5. 2
      Samples/UIWidgetsGallery/demo/animation/home.cs
  6. 2
      Samples/UIWidgetsGallery/demo/material/backdrop_demo.cs
  7. 2
      Samples/UIWidgetsGallery/gallery/backdrop.cs
  8. 63
      Runtime/widgets/value_listenable_builder.cs
  9. 11
      Runtime/widgets/value_listenable_builder.cs.meta

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

8
Runtime/cupertino/page_scaffold.cs


? existingMediaQuery.viewInsets.copyWith(bottom: 0.0f)
: existingMediaQuery.viewInsets;
bool fullObstruction =
bool? fullObstruction =
if (fullObstruction) {
if (fullObstruction == true) {
paddedContent = new MediaQuery(
data: existingMediaQuery
.removePadding(removeTop: true)

}
public abstract class ObstructingPreferredSizeWidget : PreferredSizeWidget {
public bool fullObstruction { get; }
protected ObstructingPreferredSizeWidget(Key key = null) : base(key: key) {}
public virtual bool? fullObstruction { get; }
}
}

2
Runtime/cupertino/text_theme.cs


readonly TextStyle _navTitleTextStyle;
TextStyle navTitleTextStyle {
public TextStyle navTitleTextStyle {
get {
return this._navTitleTextStyle ??
(this._isLight

43
Runtime/widgets/transitions.cs


using Unity.UIWidgets.ui;
using UnityEngine;
using Rect = Unity.UIWidgets.ui.Rect;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.widgets {
public abstract class AnimatedWidget : StatefulWidget {

alignment: this.alignment.value,
widthFactor: this.widthFactor,
heightFactor: this.heightFactor,
child: this.child
);
}
}
public class DefaultTextStyleTransition : AnimatedWidget {
public DefaultTextStyleTransition(
Key key = null,
Animation<TextStyle> style = null,
Widget child = null,
TextAlign? textAlign = null,
bool softWrap = true,
TextOverflow overflow = TextOverflow.clip,
int? maxLines = null
) : base(key: key, listenable: style) {
D.assert(style != null);
D.assert(child != null);
this.textAlign = textAlign;
this.softWrap = softWrap;
this.overflow = overflow;
this.maxLines = maxLines;
this.child = child;
}
Animation<TextStyle> style {
get { return (Animation<TextStyle>) this.listenable; }
}
public readonly TextAlign? textAlign;
public readonly bool softWrap;
public readonly TextOverflow overflow;
public readonly int? maxLines;
public readonly Widget child;
protected internal override Widget build(BuildContext context) {
return new DefaultTextStyle(
style: this.style.value,
textAlign: this.textAlign,
softWrap: this.softWrap,
overflow: this.overflow,
maxLines: this.maxLines,
child: this.child
);
}

2
Samples/UIWidgetsGallery/demo/animation/home.cs


);
}
protected override Widget build(BuildContext context) {
protected internal override Widget build(BuildContext context) {
return new LayoutBuilder(builder: this._build);
}
}

2
Samples/UIWidgetsGallery/demo/material/backdrop_demo.cs


) : base(key: key, listenable: listenable) {
}
protected override Widget build(BuildContext context) {
protected internal override Widget build(BuildContext context) {
Animation<float> animation = (Animation<float>) this.listenable;
return new DefaultTextStyle(
style: Theme.of(context).primaryTextTheme.title,

2
Samples/UIWidgetsGallery/gallery/backdrop.cs


public readonly Widget child0;
public readonly Widget child1;
protected override Widget build(BuildContext context) {
protected internal override Widget build(BuildContext context) {
Animation<float> progress = this.listenable as Animation<float>;
float opacity1 = new CurvedAnimation(

63
Runtime/widgets/value_listenable_builder.cs


using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
public delegate Widget ValueWidgetBuilder<T>(BuildContext context, T value, Widget child);
public class ValueListenableBuilder<T> : StatefulWidget {
public ValueListenableBuilder(
ValueListenable<T> valueListenable,
ValueWidgetBuilder<T> builder,
Widget child = null
) {
D.assert(valueListenable != null);
D.assert(builder != null);
this.valueListenable = valueListenable;
this.builder = builder;
this.child = child;
}
public readonly ValueListenable<T> valueListenable;
public readonly ValueWidgetBuilder<T> builder;
public readonly Widget child;
public override State createState() {
return new _ValueListenableBuilderState<T>();
}
}
class _ValueListenableBuilderState<T> : State<ValueListenableBuilder<T>> {
T value;
public override void initState() {
base.initState();
this.value = this.widget.valueListenable.value;
this.widget.valueListenable.addListener(this._valueChanged);
}
public override void didUpdateWidget(StatefulWidget _oldWidget) {
ValueListenableBuilder<T> oldWidget = _oldWidget as ValueListenableBuilder<T>;
if (oldWidget.valueListenable != this.widget.valueListenable) {
oldWidget.valueListenable.removeListener(this._valueChanged);
this.value = this.widget.valueListenable.value;
this.widget.valueListenable.addListener(this._valueChanged);
}
base.didUpdateWidget(oldWidget);
}
public override void dispose() {
this.widget.valueListenable.removeListener(this._valueChanged);
base.dispose();
}
void _valueChanged() {
this.setState(() => { this.value = this.widget.valueListenable.value; });
}
public override Widget build(BuildContext context) {
return this.widget.builder(context, this.value, this.widget.child);
}
}
}

11
Runtime/widgets/value_listenable_builder.cs.meta


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