浏览代码

[1.5.4] Upgrade app and app_bar.

/main
Yuncong Zhang 5 年前
当前提交
1d04c817
共有 3 个文件被更改,包括 46 次插入5 次删除
  1. 2
      Runtime/material/app.cs
  2. 39
      Runtime/material/app_bar.cs
  3. 10
      Runtime/material/app_bar_theme.cs

2
Runtime/material/app.cs


this._navigatorObservers.Add(this._heroController);
}
else {
this._navigatorObservers = null;
this._navigatorObservers = new List<NavigatorObserver>();
}
}

39
Runtime/material/app_bar.cs


Widget flexibleSpace = null,
PreferredSizeWidget bottom = null,
float? elevation = null,
ShapeBorder shape = null,
IconThemeData actionsIconTheme = null,
TextTheme textTheme = null,
bool primary = true,
bool? centerTitle = null,

this.flexibleSpace = flexibleSpace;
this.bottom = bottom;
this.elevation = elevation;
this.shape = shape;
this.actionsIconTheme = actionsIconTheme;
this.textTheme = textTheme;
this.primary = primary;
this.centerTitle = centerTitle;

public readonly float? elevation;
public readonly ShapeBorder shape;
public readonly IconThemeData actionsIconTheme;
public readonly TextTheme textTheme;

bool canPop = parentRoute?.canPop ?? false;
bool useCloseButton = parentRoute is PageRoute && ((PageRoute) parentRoute).fullscreenDialog;
IconThemeData appBarIconTheme = this.widget.iconTheme
IconThemeData overallIconTheme = this.widget.iconTheme
IconThemeData actionsIconTheme = this.widget.actionsIconTheme
?? appBarTheme.actionsIconTheme
?? overallIconTheme;
TextStyle centerStyle = this.widget.textTheme?.title
?? appBarTheme.textTheme?.title
?? themeData.primaryTextTheme.title;

sideStyle = sideStyle.copyWith(color: sideStyle.color.withOpacity(opacity));
}
appBarIconTheme = appBarIconTheme.copyWith(
opacity: opacity * (appBarIconTheme.opacity ?? 1.0f)
overallIconTheme = overallIconTheme.copyWith(
opacity: opacity * (overallIconTheme.opacity ?? 1.0f)
);
actionsIconTheme = actionsIconTheme.copyWith(
opacity: opacity * (actionsIconTheme.opacity ?? 1.0f)
);
}

tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip);
}
if (actions != null) {
actions = IconTheme.merge(
data: actionsIconTheme,
child: actions
);
}
Widget toolbar = new NavigationToolbar(
leading: leading,
middle: title,

child: new CustomSingleChildLayout(
layoutDelegate: new _ToolbarContainerLayout(),
child: IconTheme.merge(
data: appBarIconTheme,
data: overallIconTheme,
child: new DefaultTextStyle(
style: sideStyle,
child: toolbar)

elevation: this.widget.elevation
?? appBarTheme.elevation
?? _defaultElevation,
shape: this.widget.shape,
child: appBar
));
}

Color backgroundColor,
Brightness? brightness,
IconThemeData iconTheme,
IconThemeData actionsIconTheme,
TextTheme textTheme,
bool primary,
bool? centerTitle,

this.backgroundColor = backgroundColor;
this.brightness = brightness;
this.iconTheme = iconTheme;
this.actionsIconTheme = actionsIconTheme;
this.textTheme = textTheme;
this.primary = primary;
this.centerTitle = centerTitle;

public readonly Color backgroundColor;
public readonly Brightness? brightness;
public readonly IconThemeData iconTheme;
public readonly IconThemeData actionsIconTheme;
public readonly TextTheme textTheme;
public readonly bool primary;
public readonly bool? centerTitle;

|| this.backgroundColor != oldDelegate.backgroundColor
|| this.brightness != oldDelegate.brightness
|| this.iconTheme != oldDelegate.iconTheme
|| this.actionsIconTheme != oldDelegate.actionsIconTheme
|| this.textTheme != oldDelegate.textTheme
|| this.primary != oldDelegate.primary
|| this.centerTitle != oldDelegate.centerTitle

Color backgroundColor = null,
Brightness? brightness = null,
IconThemeData iconTheme = null,
IconThemeData actionsIconTheme = null,
TextTheme textTheme = null,
bool primary = true,
bool? centerTitle = null,

this.backgroundColor = backgroundColor;
this.brightness = brightness;
this.iconTheme = iconTheme;
this.actionsIconTheme = actionsIconTheme;
this.textTheme = textTheme;
this.primary = primary;
this.centerTitle = centerTitle;

public readonly Brightness? brightness;
public readonly IconThemeData iconTheme;
public readonly IconThemeData actionsIconTheme;
public readonly TextTheme textTheme;

backgroundColor: this.widget.backgroundColor,
brightness: this.widget.brightness,
iconTheme: this.widget.iconTheme,
actionsIconTheme: this.widget.actionsIconTheme,
textTheme: this.widget.textTheme,
primary: this.widget.primary,
centerTitle: this.widget.centerTitle,

10
Runtime/material/app_bar_theme.cs


Color color = null,
float? elevation = null,
IconThemeData iconTheme = null,
IconThemeData actionsIconTheme = null,
TextTheme textTheme = null
) {
this.brightness = brightness;

this.actionsIconTheme = actionsIconTheme;
this.textTheme = textTheme;
}

public readonly IconThemeData iconTheme;
public readonly IconThemeData actionsIconTheme;
public readonly TextTheme textTheme;
AppBarTheme copyWith(

IconThemeData iconTheme = null,
IconThemeData actionsIconTheme = null,
TextTheme textTheme = null
) {
return new AppBarTheme(

iconTheme: iconTheme ?? this.iconTheme,
actionsIconTheme: actionsIconTheme ?? this.actionsIconTheme,
textTheme: textTheme ?? this.textTheme
);
}

color: Color.lerp(a?.color, b?.color, t),
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
iconTheme: IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t),
actionsIconTheme: IconThemeData.lerp(a?.actionsIconTheme, b?.actionsIconTheme, t),
textTheme: TextTheme.lerp(a?.textTheme, b?.textTheme, t)
);
}

hashCode = (hashCode * 397) ^ this.color?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.elevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.iconTheme?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.actionsIconTheme?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.textTheme?.GetHashCode() ?? 0;
return hashCode;
}

&& other.color == this.color
&& other.elevation == this.elevation
&& other.iconTheme == this.iconTheme
&& other.actionsIconTheme == this.actionsIconTheme
&& other.textTheme == this.textTheme;
}

properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<IconThemeData>("iconTheme", this.iconTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<IconThemeData>("actionsIconTheme", this.actionsIconTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<TextTheme>("textTheme", this.textTheme, defaultValue: null));
}
}
正在加载...
取消
保存