David PHAM-VAN

Add Builder widget

@@ -647,3 +647,22 @@ class SizedBox extends StatelessWidget { @@ -647,3 +647,22 @@ class SizedBox extends StatelessWidget {
647 constraints: BoxConstraints.tightFor(width: width, height: height)); 647 constraints: BoxConstraints.tightFor(width: width, height: height));
648 } 648 }
649 } 649 }
  650 +
  651 +typedef WidgetBuilder = Widget Function(Context context);
  652 +
  653 +/// A platonic widget that calls a closure to obtain its child widget.
  654 +class Builder extends StatelessWidget {
  655 + /// Creates a widget that delegates its build to a callback.
  656 + ///
  657 + /// The [builder] argument must not be null.
  658 + Builder({
  659 + @required this.builder,
  660 + }) : assert(builder != null),
  661 + super();
  662 +
  663 + /// Called to obtain the child widget.
  664 + final WidgetBuilder builder;
  665 +
  666 + @override
  667 + Widget build(Context context) => builder(context);
  668 +}
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 - Add Markdown example 5 - Add Markdown example
6 - Update printing example 6 - Update printing example
7 - Change the channel name 7 - Change the channel name
  8 +- Add Builder widget
8 9
9 ## 2.1.8 10 ## 2.1.8
10 11