浏览代码

Update MaterialApp.

/main
Yuncong Zhang 5 年前
当前提交
5deed4e9
共有 1 个文件被更改,包括 34 次插入24 次删除
  1. 58
      Runtime/material/app.cs

58
Runtime/material/app.cs


string title = "",
Color color = null,
ThemeData theme = null,
ThemeData darkTheme = null,
Locale locale = null,
List<LocalizationsDelegate<MaterialLocalizations>> localizationsDelegates = null,
LocaleListResolutionCallback localeListResolutionCallback = null,

this.title = title;
this.color = color;
this.theme = theme;
this.dartTheme = darkTheme;
this.locale = locale;
this.localizationsDelegates = localizationsDelegates;
this.localeListResolutionCallback = localeListResolutionCallback;

public readonly string title;
public readonly ThemeData theme;
public readonly ThemeData dartTheme;
public readonly Color color;

}
public override Widget build(BuildContext context) {
ThemeData theme = this.widget.theme ?? ThemeData.fallback();
Widget result = new AnimatedTheme(
data: theme,
isMaterialAppTheme: true,
child: new WidgetsApp(
key: new GlobalObjectKey<State>(this),
navigatorKey: this.widget.navigatorKey,
navigatorObservers: this._navigatorObservers,
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
new MaterialPageRoute(settings: settings, builder: builder),
home: this.widget.home,
routes: this.widget.routes,
initialRoute: this.widget.initialRoute,
onGenerateRoute: this.widget.onGenerateRoute,
onUnknownRoute: this.widget.onUnknownRoute,
builder: this.widget.builder,
textStyle: AppUtils._errorTextStyle,
locale: this.widget.locale,
localizationsDelegates: this._localizationsDelegates,
localeResolutionCallback: this.widget.localeResolutionCallback,
localeListResolutionCallback: this.widget.localeListResolutionCallback,
supportedLocales: this.widget.supportedLocales,
showPerformanceOverlay: this.widget.showPerformanceOverlay
)
Widget result = new WidgetsApp(
key: new GlobalObjectKey<State>(this),
navigatorKey: this.widget.navigatorKey,
navigatorObservers: this._navigatorObservers,
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
new MaterialPageRoute(settings: settings, builder: builder),
home: this.widget.home,
routes: this.widget.routes,
initialRoute: this.widget.initialRoute,
onGenerateRoute: this.widget.onGenerateRoute,
onUnknownRoute: this.widget.onUnknownRoute,
builder: (BuildContext congtext, Widget child) => {
ThemeData theme = this.widget.theme ?? ThemeData.fallback();
return new AnimatedTheme(
data: theme,
isMaterialAppTheme: true,
child: this.widget.builder != null
? new Builder(
builder: (_context) => { return this.widget.builder(_context, child); }
)
: child
);
},
textStyle: AppUtils._errorTextStyle,
locale: this.widget.locale,
localizationsDelegates: this._localizationsDelegates,
localeResolutionCallback: this.widget.localeResolutionCallback,
localeListResolutionCallback: this.widget.localeListResolutionCallback,
supportedLocales: this.widget.supportedLocales,
showPerformanceOverlay: this.widget.showPerformanceOverlay
);
return result;

正在加载...
取消
保存