menu widget in flutter code example
Example 1: list widget flutter
ListView(
padding: const EdgeInsets.all(8),
children: <Widget>[
Container(
height: 50,
color: Colors.amber[600],
child: const Center(child: Text('Entry A')),
),
Container(
height: 50,
color: Colors.amber[500],
child: const Center(child: Text('Entry B')),
),
Container(
height: 50,
color: Colors.amber[100],
child: const Center(child: Text('Entry C')),
),
],
)
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>();
}
//if you have properties, it should look something like:
// bool updateShouldNotify(MyInherited old) => old.prop !== new.prop;
//if you don't:
@override
bool updateShouldNotify(MyInherited old) => false;
}