public override Widget build(BuildContext context) { CupertinoThemeData effectiveThemeData = widget.theme ?? new CupertinoThemeData(); return(new ScrollConfiguration( behavior: new _AlwaysCupertinoScrollBehavior(), child: new CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.baselayer, child: new CupertinoTheme( data: effectiveThemeData, child: new Builder( builder: (BuildContext context1) => { return new WidgetsApp( key: new GlobalObjectKey <State <StatefulWidget> >(value: this), navigatorKey: widget.navigatorKey, navigatorObservers: _navigatorObservers, pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => new CupertinoPageRoute(settings: settings, builder: builder), home: widget.home, routes: widget.routes, initialRoute: widget.initialRoute, onGenerateRoute: widget.onGenerateRoute, onGenerateInitialRoutes: widget.onGenerateInitialRoutes, onUnknownRoute: widget.onUnknownRoute, builder: widget.builder, title: widget.title, onGenerateTitle: widget.onGenerateTitle, textStyle: CupertinoTheme.of(context1).textTheme.textStyle, color: CupertinoDynamicColor.resolve(widget.color ?? effectiveThemeData.primaryColor, context1), locale: widget.locale, localizationsDelegates: _localizationsDelegates, localeResolutionCallback: widget.localeResolutionCallback, localeListResolutionCallback: widget.localeListResolutionCallback, supportedLocales: widget.supportedLocales, showPerformanceOverlay: widget.showPerformanceOverlay, checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages, checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers, showSemanticsDebugger: widget.showSemanticsDebugger, debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner, inspectorSelectButtonBuilder: (BuildContext context3, VoidCallback onPressed) => { return CupertinoButton.filled( child: new Icon( CupertinoIcons.search, size: 28.0f, color: CupertinoColors.white ), padding: EdgeInsets.zero, onPressed: onPressed ); }, shortcuts: widget.shortcuts, actions: widget.actions ); } ) ) ) )); }
public CupertinoApp( Key key = null, GlobalKey <NavigatorState> navigatorKey = null, Widget home = null, CupertinoThemeData theme = null, Dictionary <string, WidgetBuilder> routes = null, string initialRoute = null, RouteFactory onGenerateRoute = null, InitialRouteListFactory onGenerateInitialRoutes = null, RouteFactory onUnknownRoute = null, List <NavigatorObserver> navigatorObservers = null, TransitionBuilder builder = null, string title = "", GenerateAppTitle onGenerateTitle = null, Color color = null, Locale locale = null, List <LocalizationsDelegate <CupertinoLocalizations> > localizationsDelegates = null, LocaleListResolutionCallback localeListResolutionCallback = null, LocaleResolutionCallback localeResolutionCallback = null, List <Locale> supportedLocales = null, bool showPerformanceOverlay = false, bool checkerboardRasterCacheImages = false, bool checkerboardOffscreenLayers = false, bool showSemanticsDebugger = false, bool debugShowCheckedModeBanner = true, Dictionary <LogicalKeySet, Intent> shortcuts = null, Dictionary <LocalKey, ActionFactory> actions = null ) : base(key: key) { D.assert(title != null); supportedLocales = supportedLocales ?? new List <Locale> { new Locale("en", "US") }; this.navigatorKey = navigatorKey; this.home = home; this.theme = theme; this.routes = routes ?? new Dictionary <string, WidgetBuilder>(); this.initialRoute = initialRoute; this.onGenerateRoute = onGenerateRoute; this.onGenerateInitialRoutes = onGenerateInitialRoutes; this.onUnknownRoute = onUnknownRoute; this.navigatorObservers = navigatorObservers ?? new List <NavigatorObserver>(); this.builder = builder; this.title = title; this.onGenerateTitle = onGenerateTitle; this.color = color; this.locale = locale; this.localizationsDelegates = localizationsDelegates; this.localeListResolutionCallback = localeListResolutionCallback; this.localeResolutionCallback = localeResolutionCallback; this.supportedLocales = supportedLocales; this.showPerformanceOverlay = showPerformanceOverlay; this.showSemanticsDebugger = showSemanticsDebugger; this.debugShowCheckedModeBanner = debugShowCheckedModeBanner; this.shortcuts = shortcuts; this.actions = actions; }
public CupertinoTheme( CupertinoThemeData data, Widget child, Key key = null ) : base(key: key) { D.assert(child != null); D.assert(data != null); this.data = data; this.child = child; }
public CupertinoApp( Key key = null, GlobalKey <NavigatorState> navigatorKey = null, Widget home = null, CupertinoThemeData theme = null, Dictionary <string, WidgetBuilder> routes = null, string initialRoute = null, RouteFactory onGenerateRoute = null, RouteFactory onUnknownRoute = null, List <NavigatorObserver> navigatorObservers = null, TransitionBuilder builder = null, string title = "", GenerateAppTitle onGenerateTitle = null, Color color = null, Locale locale = null, List <LocalizationsDelegate <CupertinoLocalizations> > localizationsDelegates = null, LocaleListResolutionCallback localeListResolutionCallback = null, LocaleResolutionCallback localeResolutionCallback = null, List <Locale> supportedLocales = null, bool showPerformanceOverlay = false ) : base(key: key) { D.assert(title != null); supportedLocales = supportedLocales ?? new List <Locale> { new Locale("en", "US") }; this.navigatorKey = navigatorKey; this.home = home; this.theme = theme; this.routes = routes ?? new Dictionary <string, WidgetBuilder>(); this.initialRoute = initialRoute; this.onGenerateRoute = onGenerateRoute; this.onUnknownRoute = onUnknownRoute; this.navigatorObservers = navigatorObservers ?? new List <NavigatorObserver>(); this.builder = builder; this.title = title; this.onGenerateTitle = onGenerateTitle; this.color = color; this.locale = locale; this.localizationsDelegates = localizationsDelegates; this.localeListResolutionCallback = localeListResolutionCallback; this.localeResolutionCallback = localeResolutionCallback; this.supportedLocales = supportedLocales; this.showPerformanceOverlay = showPerformanceOverlay; }
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { base.debugFillProperties(properties); CupertinoThemeData defaultData = new CupertinoThemeData(); properties.add( new EnumProperty <Brightness>("brightness", this.brightness, defaultValue: defaultData.brightness)); properties.add(new DiagnosticsProperty <Color>("primaryColor", this.primaryColor, defaultValue: defaultData.primaryColor)); properties.add(new DiagnosticsProperty <Color>("primaryContrastingColor", this.primaryContrastingColor, defaultValue: defaultData.primaryContrastingColor)); properties.add( new DiagnosticsProperty <CupertinoTextThemeData>("textTheme", this.textTheme, defaultValue: defaultData.textTheme)); properties.add(new DiagnosticsProperty <Color>("barBackgroundColor", this.barBackgroundColor, defaultValue: defaultData.barBackgroundColor)); properties.add(new DiagnosticsProperty <Color>("scaffoldBackgroundColor", this.scaffoldBackgroundColor, defaultValue: defaultData.scaffoldBackgroundColor)); }
public override Widget build(BuildContext context) { CupertinoThemeData effectiveThemeData = this.widget.theme ?? new CupertinoThemeData(); return(new ScrollConfiguration( behavior: new _AlwaysCupertinoScrollBehavior(), child: new CupertinoTheme( data: effectiveThemeData, child: new WidgetsApp( pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => new CupertinoPageRoute(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, title: this.widget.title, onGenerateTitle: this.widget.onGenerateTitle, textStyle: effectiveThemeData.textTheme.textStyle, color: this.widget.color ?? CupertinoColors.activeBlue, locale: this.widget.locale, localizationsDelegates: this._localizationsDelegates, localeResolutionCallback: this.widget.localeResolutionCallback, localeListResolutionCallback: this.widget.localeListResolutionCallback, supportedLocales: this.widget.supportedLocales, showPerformanceOverlay: this.widget.showPerformanceOverlay, inspectorSelectButtonBuilder: (BuildContext _context, VoidCallback onPressed) => { return CupertinoButton.filled( child: new Icon( CupertinoIcons.search, size: 28.0f, color: CupertinoColors.white ), padding: EdgeInsets.zero, onPressed: onPressed ); } ) ) )); }
public static CupertinoThemeData _rawWithDefaults( Brightness?brightness, Color primaryColor, Color primaryContrastingColor, CupertinoTextThemeData textTheme, Color barBackgroundColor, Color scaffoldBackgroundColor, _CupertinoThemeDefaults defaults ) { var themeData = new CupertinoThemeData( brightness: brightness, primaryColor: primaryColor, primaryContrastingColor: primaryContrastingColor, textTheme: textTheme, barBackgroundColor: barBackgroundColor, scaffoldBackgroundColor: scaffoldBackgroundColor, defaults); return(themeData); }
public override Widget build(BuildContext context) { bool enabled = widget.enabled; CupertinoThemeData themeData = CupertinoTheme.of(context); Color primaryColor = themeData.primaryColor; Color backgroundColor = (widget.color == null) ? (widget._filled ? primaryColor : null) : CupertinoDynamicColor.resolve(widget.color, context); Color foregroundColor = backgroundColor != null ? themeData.primaryContrastingColor : enabled ? primaryColor : CupertinoDynamicColor.resolve(CupertinoColors.placeholderText, context); TextStyle textStyle = themeData.textTheme.textStyle.copyWith(color: foregroundColor); return(new GestureDetector( behavior: HitTestBehavior.opaque, onTapDown: enabled ? _handleTapDown : (GestureTapDownCallback)null, onTapUp: enabled ? _handleTapUp : (GestureTapUpCallback)null, onTapCancel: enabled ? _handleTapCancel : (GestureTapCancelCallback)null, onTap: widget.onPressed == null ? (GestureTapCallback)null : () => { if (widget.onPressed != null) { widget.onPressed(); } }, child: new ConstrainedBox( constraints: widget.minSize == null ? new BoxConstraints() : new BoxConstraints( minWidth: widget.minSize, minHeight: widget.minSize ), child: new FadeTransition( opacity: _opacityAnimation, child: new DecoratedBox( decoration: new BoxDecoration( borderRadius: widget.borderRadius, color: backgroundColor != null && !enabled ? CupertinoDynamicColor.resolve(widget.disabledColor, context) : backgroundColor ), child: new Padding( padding: widget.padding ?? (backgroundColor != null ? CupertinoButtonUtils._kBackgroundButtonPadding : CupertinoButtonUtils._kButtonPadding), child: new Center( widthFactor: 1.0f, heightFactor: 1.0f, child: new DefaultTextStyle( style: textStyle, child: new IconTheme( data: new IconThemeData(color: foregroundColor), child: widget.child ) ) ) ) ) ) ) )); }
public override Widget build(BuildContext context) { base.build(context); D.assert(WidgetsD.debugCheckHasDirectionality(context)); TextEditingController controller = _effectiveController; List <TextInputFormatter> formatters = widget.inputFormatters ?? new List <TextInputFormatter>(); bool enabled = widget.enabled ?? true; Offset cursorOffset = new Offset( CupertinoTextFieldUtils._iOSHorizontalCursorOffsetPixels / MediaQuery.of(context).devicePixelRatio, 0); if (widget.maxLength != null && widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(widget.maxLength)); } CupertinoThemeData themeData = CupertinoTheme.of(context); TextStyle resolvedStyle = widget.style?.copyWith( color: CupertinoDynamicColor.resolve(widget.style?.color, context), backgroundColor: CupertinoDynamicColor.resolve(widget.style?.backgroundColor, context) ); TextStyle textStyle = themeData.textTheme.textStyle.merge(resolvedStyle); TextStyle resolvedPlaceholderStyle = widget.placeholderStyle?.copyWith( color: CupertinoDynamicColor.resolve(widget.placeholderStyle?.color, context), backgroundColor: CupertinoDynamicColor.resolve(widget.placeholderStyle?.backgroundColor, context) ); TextStyle placeholderStyle = textStyle.merge(resolvedPlaceholderStyle); Brightness?keyboardAppearance = widget.keyboardAppearance ?? CupertinoTheme.brightnessOf(context); Color cursorColor = CupertinoDynamicColor.resolve(widget.cursorColor, context) ?? themeData.primaryColor; Color disabledColor = CupertinoDynamicColor.resolve(CupertinoTextFieldUtils._kDisabledBackground, context); Color decorationColor = CupertinoDynamicColor.resolve(widget.decoration?.color, context); BoxBorder border = widget.decoration?.border; Border resolvedBorder = border as Border; if (border is Border) { BorderSide resolveBorderSide(BorderSide side) { return(side == BorderSide.none ? side : side.copyWith(color: CupertinoDynamicColor.resolve(side.color, context))); } resolvedBorder = (Border)(border == null || border.GetType() != typeof(Border) ? border : new Border( top: resolveBorderSide(((Border)border).top), left: resolveBorderSide(((Border)border).left), bottom: resolveBorderSide(((Border)border).bottom), right: resolveBorderSide(((Border)border).right) )); } BoxDecoration effectiveDecoration = widget.decoration?.copyWith( border: resolvedBorder, color: enabled ? decorationColor : (decorationColor == null ? disabledColor : decorationColor) ); Widget paddedEditable = new Padding( padding: widget.padding, child: new RepaintBoundary( child: new EditableText( key: editableTextKey, controller: controller, readOnly: widget.readOnly, toolbarOptions: widget.toolbarOptions, showCursor: widget.showCursor, showSelectionHandles: _showSelectionHandles, focusNode: _effectiveFocusNode, keyboardType: widget.keyboardType, textInputAction: widget.textInputAction, textCapitalization: widget.textCapitalization, style: textStyle, strutStyle: widget.strutStyle, textAlign: widget.textAlign, autofocus: widget.autofocus, obscureText: widget.obscureText, autocorrect: widget.autocorrect, smartDashesType: widget.smartDashesType, smartQuotesType: widget.smartQuotesType, enableSuggestions: widget.enableSuggestions, maxLines: widget.maxLines, minLines: widget.minLines, expands: widget.expands, selectionColor: CupertinoTheme.of(context).primaryColor.withOpacity(0.2f), selectionControls: widget.selectionEnabled ? CupertinoTextFieldUtils.cupertinoTextSelectionControls : null, onChanged: widget.onChanged, onSelectionChanged: _handleSelectionChanged, onEditingComplete: widget.onEditingComplete, onSubmitted: widget.onSubmitted, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: widget.cursorWidth, cursorRadius: widget.cursorRadius, cursorColor: cursorColor, cursorOpacityAnimates: true, cursorOffset: cursorOffset, paintCursorAboveText: true, backgroundCursorColor: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context), selectionHeightStyle: widget.selectionHeightStyle, selectionWidthStyle: widget.selectionWidthStyle, scrollPadding: widget.scrollPadding, keyboardAppearance: keyboardAppearance, dragStartBehavior: widget.dragStartBehavior, scrollController: widget.scrollController, scrollPhysics: widget.scrollPhysics, enableInteractiveSelection: widget.enableInteractiveSelection ) ) ); return(new IgnorePointer( ignoring: !enabled, child: new Container( decoration: effectiveDecoration, child: _selectionGestureDetectorBuilder.buildGestureDetector( behavior: HitTestBehavior.translucent, child: new Align( alignment: new Alignment(-1.0f, _textAlignVertical.y), widthFactor: 1.0f, heightFactor: 1.0f, child: _addTextDependentAttachments(paddedEditable, textStyle, placeholderStyle) ) ) ) )); }
public override Widget build(BuildContext context) { base.build(context); TextEditingController controller = this._effectiveController; List <TextInputFormatter> formatters = this.widget.inputFormatters ?? new List <TextInputFormatter>(); bool enabled = this.widget.enabled ?? true; Offset cursorOffset = new Offset( CupertinoTextFieldUtils._iOSHorizontalCursorOffsetPixels / MediaQuery.of(context).devicePixelRatio, 0); if (this.widget.maxLength != null && this.widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength)); } CupertinoThemeData themeData = CupertinoTheme.of(context); TextStyle textStyle = themeData.textTheme.textStyle.merge(this.widget.style); TextStyle placeholderStyle = textStyle.merge(this.widget.placeholderStyle); Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.brightness; Color cursorColor = this.widget.cursorColor ?? themeData.primaryColor; Widget paddedEditable = new Padding( padding: this.widget.padding, child: new RepaintBoundary( child: new EditableText( key: this._editableTextKey, controller: controller, focusNode: this._effectiveFocusNode, keyboardType: this.widget.keyboardType, textInputAction: this.widget.textInputAction, textCapitalization: this.widget.textCapitalization, style: textStyle, strutStyle: this.widget.strutStyle, textAlign: this.widget.textAlign, autofocus: this.widget.autofocus, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, maxLines: this.widget.maxLines, minLines: this.widget.minLines, expands: this.widget.expands, selectionColor: CupertinoTextFieldUtils._kSelectionHighlightColor, selectionControls: CupertinoTextSelectionUtils.cupertinoTextSelectionControls, onChanged: this.widget.onChanged, onSelectionChanged: this._handleSelectionChanged, onEditingComplete: this.widget.onEditingComplete, onSubmitted: this.widget.onSubmitted, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: this.widget.cursorWidth, cursorRadius: this.widget.cursorRadius, cursorColor: cursorColor, cursorOpacityAnimates: true, cursorOffset: cursorOffset, paintCursorAboveText: true, backgroundCursorColor: CupertinoColors.inactiveGray, scrollPadding: this.widget.scrollPadding, keyboardAppearance: keyboardAppearance, dragStartBehavior: this.widget.dragStartBehavior, scrollPhysics: this.widget.scrollPhysics ) ) ); return(new IgnorePointer( ignoring: !enabled, child: new Container( decoration: this.widget.decoration, child: new Container( color: enabled ? null : CupertinoTheme.of(context).brightness == Brightness.light ? CupertinoTextFieldUtils._kDisabledBackground : CupertinoColors.darkBackgroundGray, child: new TextSelectionGestureDetector( onTapDown: this._handleTapDown, onSingleTapUp: this._handleSingleTapUp, onSingleLongTapStart: this._handleSingleLongTapStart, onSingleLongTapMoveUpdate: this._handleSingleLongTapMoveUpdate, onSingleLongTapEnd: this._handleSingleLongTapEnd, onDoubleTapDown: this._handleDoubleTapDown, onDragSelectionStart: this._handleMouseDragSelectionStart, onDragSelectionUpdate: this._handleMouseDragSelectionUpdate, onDragSelectionEnd: this._handleMouseDragSelectionEnd, behavior: HitTestBehavior.translucent, child: this._addTextDependentAttachments(paddedEditable, textStyle, placeholderStyle) ) ) ) )); }