public override Widget build(BuildContext context) { Widget current = this.child; if (this.child == null && (this.constraints == null || !this.constraints.isTight)) { current = new LimitedBox( maxWidth: 0.0, maxHeight: 0.0, child: new ConstrainedBox(constraints: BoxConstraints.expand()) ); } if (this.alignment != null) { current = new Align(alignment: this.alignment, child: current); } EdgeInsets effetivePadding = this._paddingIncludingDecoration; if (effetivePadding != null) { current = new Padding(padding: effetivePadding, child: current); } if (this.decoration != null) { current = new DecoratedBox(decoration: this.decoration, child: current); } if (this.foregroundDecoration != null) { current = new DecoratedBox( decoration: this.foregroundDecoration, position: DecorationPosition.foreground, child: current ); } if (this.constraints != null) { current = new ConstrainedBox(constraints: this.constraints, child: current); } if (this.margin != null) { current = new Padding(padding: this.margin, child: current); } if (this.transform != null) { current = new Transform(transform: new Matrix3(this.transform), child: current); } return(current); }
public override Widget build(BuildContext context) { Widget current = child; if (child == null) { current = new LimitedBox( maxWidth: 0.0f, maxHeight: 0.0f, child: new ConstrainedBox(constraints: BoxConstraints.expand()) ); } current = new RaycastableBox(child: current); return(current); }
public static void Main(string[] args) { var cajaDeEntero = new Box <int>(5); var cajaDeString = new Box <string>("Hola mundo"); Console.WriteLine(cajaDeEntero.Content); // 5 Console.WriteLine(cajaDeString.Content); // Hola mundo var cajaDeCajas = new Box <Box <string> >(cajaDeString); Console.WriteLine(cajaDeCajas); // [Box: Content=[Box: Content=Hola mundo]] var cajota = new ComplexBox <double, decimal, float>(1, 2) { Item = 3 }; // var limitado = new LimitedBox<string>(); // Error, string no es struct var limitado = new LimitedBox <DateTime>(); // OK, DateTime es struct // var limitado1 = new LimitedBox<DateTime, Box<string>>(); // Error, Box<string> no implementa IEquatable var limitado1 = new LimitedBox <DateTime, string>(); // OK, string sí implementa IEquatable // var limitado2 = new LimitedBox<DateTime, string, string>(); // Error, el tipo string no tiene un constructor sin parámetros var limitado2 = new LimitedBox <DateTime, string, MainClass>(); // OK, MainClass sí tiene un constructor sin parámetros // Ejemplo: // var vitesse = new FootballTeam(18); var vitesse = new Team <FootballPlayer>(18); vitesse.Members[0] = new FootballPlayer { Name = "Alex Renato Ibarra Mina" }; // var losAngeles = new BaseballTeam(25); var losAngeles = new Team <BaseballPlayer>(25); losAngeles.Members[0] = new BaseballPlayer { Name = "Julio César Urías" }; // var equipoDeEnteros = new Team<int>(10); // Error. Ni int // var otroEquipo = new Team<object>(1233); // ni object son (o derivan de) Athlete }
public static void Main(string[] args) { var cajaDeEntero = new Box<int>(5); var cajaDeString = new Box<string>("Hola mundo"); Console.WriteLine(cajaDeEntero.Content); // 5 Console.WriteLine(cajaDeString.Content); // Hola mundo var cajaDeCajas = new Box<Box<string>>(cajaDeString); Console.WriteLine(cajaDeCajas); // [Box: Content=[Box: Content=Hola mundo]] var cajota = new ComplexBox<double, decimal, float>(1, 2) { Item = 3 }; // var limitado = new LimitedBox<string>(); // Error, string no es struct var limitado = new LimitedBox<DateTime>(); // OK, DateTime es struct // var limitado1 = new LimitedBox<DateTime, Box<string>>(); // Error, Box<string> no implementa IEquatable var limitado1= new LimitedBox<DateTime, string>(); // OK, string sí implementa IEquatable // var limitado2 = new LimitedBox<DateTime, string, string>(); // Error, el tipo string no tiene un constructor sin parámetros var limitado2 = new LimitedBox<DateTime, string, MainClass>(); // OK, MainClass sí tiene un constructor sin parámetros // Ejemplo: // var vitesse = new FootballTeam(18); var vitesse = new Team<FootballPlayer>(18); vitesse.Members[0] = new FootballPlayer { Name = "Alex Renato Ibarra Mina" }; // var losAngeles = new BaseballTeam(25); var losAngeles = new Team<BaseballPlayer>(25); losAngeles.Members[0] = new BaseballPlayer { Name = "Julio César Urías" }; // var equipoDeEnteros = new Team<int>(10); // Error. Ni int // var otroEquipo = new Team<object>(1233); // ni object son (o derivan de) Athlete }
public override Widget build(BuildContext context) { Widget current = child; if (child == null && (constraints == null || !constraints.isTight)) { current = new LimitedBox( maxWidth: 0.0f, maxHeight: 0.0f, child: new ConstrainedBox(constraints: BoxConstraints.expand()) ); } if (alignment != null) { current = new Align(alignment: alignment, child: current); } EdgeInsetsGeometry effetivePadding = _paddingIncludingDecoration; if (effetivePadding != null) { current = new Padding(padding: effetivePadding, child: current); } if (color != null) { current = new ColoredBox(color: color, child: current); } if (decoration != null) { current = new DecoratedBox(decoration: decoration, child: current); } if (foregroundDecoration != null) { current = new DecoratedBox( decoration: foregroundDecoration, position: DecorationPosition.foreground, child: current ); } if (constraints != null) { current = new ConstrainedBox(constraints: constraints, child: current); } if (margin != null) { current = new Padding(padding: margin, child: current); } if (transform != null) { current = new Transform(transform: new Matrix4(transform), child: current); } if (clipBehavior != Clip.none) { current = new ClipPath( clipper: new _DecorationClipper( textDirection: Directionality.of(context), decoration: decoration ), clipBehavior: clipBehavior, child: current ); } return(current); }