text
stringlengths
1
372
dart code:
colors_demo.dart
<code_start>
widget _buildList() {
return ListView(
children: [
_tile('CineArts at the empire', '85 w portal ave', icons.theaters),
_tile('The castro theater', '429 castro st', icons.theaters),
_tile('Alamo drafthouse cinema', '2550 mission st', icons.theaters),
_tile('Roxie theater', '3117 16th st', icons.theaters),
_tile('United artists stonestown twin', '501 buckingham way',
icons.theaters),
_tile('AMC metreon 16', '135 4th st #3000', icons.theaters),
const divider(),
_tile('K\'s kitchen', '757 monterey blvd', icons.restaurant),
_tile('Emmy\'s restaurant', '1923 ocean ave', icons.restaurant),
_tile('Chaiya thai restaurant', '272 claremont blvd', icons.restaurant),
_tile('La ciccia', '291 30th st', icons.restaurant),
],
);
}
ListTile _tile(String title, string subtitle, IconData icon) {
return ListTile(
title: text(title,
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 20,
)),
subtitle: text(subtitle),
leading: icon(
icon,
color: colors.blue[500],
),
);
}
<code_end>
<topic_end>
<topic_start>
stack
use stack to arrange widgets on top of a base
widget—often an image. the widgets can completely
or partially overlap the base widget.
<topic_end>
<topic_start>
summary (stack)
<topic_end>
<topic_start>
examples (stack)
uses stack to overlay a container
(that displays its text on a translucent
black background) on top of a CircleAvatar.
the stack offsets the text using the alignment property and
alignments.
app source: card_and_stack
uses stack to overlay an icon on top of an image.
dart code:
bottom_navigation_demo.dart
<code_start>
widget _buildStack() {
return stack(
alignment: const alignment(0.6, 0.6),
children: [
const CircleAvatar(
backgroundImage: AssetImage('images/pic.jpg'),
radius: 100,
),
container(
decoration: const BoxDecoration(
color: colors.black45,
),
child: const text(
'mia b',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: colors.white,
),
),
),
],
);
}
<code_end>
<topic_end>
<topic_start>
card
a card, from the material library,
contains related nuggets of information and can
be composed from almost any widget, but is often used with
ListTile. card has a single child,
but its child can be a column, row, list, grid,
or other widget that supports multiple children.
by default, a card shrinks its size to 0 by 0 pixels.
you can use SizedBox to constrain the size of a card.
in flutter, a card features slightly rounded corners
and a drop shadow, giving it a 3d effect.
changing a card’s elevation property allows you to control
the drop shadow effect. setting the elevation to 24,
for example, visually lifts the card further from the
surface and causes the shadow to become more dispersed.