text
stringlengths
1
372
column(
children: [
Icon(Icons.kitchen, color: colors.green[500]),
const Text('PREP:'),
const text('25 min'),
],
),
column(
children: [
Icon(Icons.timer, color: colors.green[500]),
const Text('COOK:'),
const text('1 hr'),
],
),
column(
children: [
Icon(Icons.restaurant, color: colors.green[500]),
const Text('FEEDS:'),
const text('4-6'),
],
),
],
),
),
);
<code_end>
the leftColumn variable contains the ratings and icons rows,
as well as the title and text that describes the pavlova:
<code_start>
final leftColumn = container(
padding: const EdgeInsets.fromLTRB(20, 30, 20, 20),
child: column(
children: [
titleText,
subTitle,
ratings,
iconList,
],
),
);
<code_end>
the left column is placed in a SizedBox to constrain its width.
finally, the UI is constructed with the entire row (containing the
left column and the image) inside a card.
the pavlova image is from pixabay.
you can embed an image from the net using image.network() but,
for this example, the image is saved to an images directory in the project,
added to the pubspec file, and accessed using images.asset().
for more information, see adding assets and images.
<code_start>
body: center(
child: container(
margin: const EdgeInsets.fromLTRB(0, 40, 0, 30),
height: 600,
child: card(
child: row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 440,
child: leftColumn,
),
mainImage,
],
),
),
),
),
<code_end>
lightbulb tip
the pavlova example runs best horizontally on a wide device,
such as a tablet. if you are running this example in the iOS simulator,
you can select a different device using the hardware > device menu.
for this example, we recommend the iPad pro.
you can change its orientation to landscape mode using
hardware > rotate. you can also change the size of the
simulator window (without changing the number of logical pixels)
using window > scale.
app source: pavlova
<topic_end>
<topic_start>
common layout widgets
flutter has a rich library of layout widgets.
here are a few of those most commonly used.
the intent is to get you up and running as quickly as possible,
rather than overwhelm you with a complete list.
for information on other available widgets,
refer to the widget catalog,
or use the search box in the API reference docs.
also, the widget pages in the API docs often make suggestions
about similar widgets that might better suit your needs.
the following widgets fall into two categories: standard widgets
from the widgets library, and specialized widgets from the
material library. any app can use the widgets library but
only material apps can use the material components library.
<topic_end>
<topic_start>
standard widgets
<topic_end>
<topic_start>