Skip to content

Instantly share code, notes, and snippets.

@cristianfb1989
Created February 28, 2020 16:08
Show Gist options
  • Save cristianfb1989/4e1858ecd868abefd7b0f77b4cf4da5b to your computer and use it in GitHub Desktop.
Save cristianfb1989/4e1858ecd868abefd7b0f77b4cf4da5b to your computer and use it in GitHub Desktop.
class SecondPage extends StatefulWidget {
@override
_SecondPageState createState() => _SecondPageState();
}
class _SecondPageState extends State<SecondPage> {
static double containerHeight = 120;
static double containerWidth = 500;
List<Widget> itemsDishes = [
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Dishes',
style: TextStyle(fontSize: 50),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Fish and Chips',
style: TextStyle(fontSize: 40),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Bangers and Mash',
style: TextStyle(fontSize: 40),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Full English Breakfast',
style: TextStyle(fontSize: 40),
),
),
];
List<Widget> itemsDrinks = [
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Drinks',
style: TextStyle(fontSize: 50),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Barley water',
style: TextStyle(fontSize: 40),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Brooke Bond',
style: TextStyle(fontSize: 40),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Builders tea',
style: TextStyle(fontSize: 40),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Earl Grey tea',
style: TextStyle(fontSize: 40),
),
),
Container(
alignment: Alignment.center,
width: containerWidth,
height: containerHeight,
child: Text(
'Ginger wine',
style: TextStyle(fontSize: 40),
),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Second Page'),
),
body: Center(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height * .7,
child: ListView.builder(
itemCount: itemsDishes.length,
itemBuilder: (context, index) {
return itemsDishes[index];
},
)),
Container(
height: MediaQuery.of(context).size.height * .9,
child: ListView.builder(
itemCount: itemsDrinks.length,
itemBuilder: (context, index) {
return itemsDrinks[index];
},
)),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment