Center widgets flutter code example
Example 1: flutter column widget vertical center
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children:children,
)
Example 2: flutter inhereted widget
class MyInherited extends InheritedWidget {
const MyInherited({
Key key,
@required Widget child,
}) : super(key: key, child: child);
static MyInherited of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<MyInherited>();
}
@override
bool updateShouldNotify(MyInherited old) => false;
}