text
stringlengths
1
372
@override
widget build(BuildContext context) {
return column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
icon(icon, color: color),
padding(
padding: const EdgeInsets.only(top: 8),
child: text(
label,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
color: color,
),
),
),
],
);
}
<code_end>
<topic_end>
<topic_start>
position the buttons with a row widget
add the following code into the ButtonSection widget.
<code_start>
class ButtonSection extends StatelessWidget {
const ButtonSection({super.key});
@override
widget build(BuildContext context) {
final color color = Theme.of(context).primaryColor;
return SizedBox(
child: row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ButtonWithText(
color: color,
icon: icons.call,
label: 'call',
),
ButtonWithText(
color: color,
icon: icons.near_me,
label: 'route',
),
ButtonWithText(
color: color,
icon: icons.share,
label: 'share',
),
],
),
);
}
}
class ButtonWithText extends StatelessWidget {
const ButtonWithText({
super.key,
required this.color,
required this.icon,
required this.label,
});
final color color;
final IconData icon;
final string label;
@override
widget build(BuildContext context) {
return column(
// ···
);
}
}
<code_end>
<topic_end>
<topic_start>
update the app to display the button section
add the button section to the children list.
<topic_end>
<topic_start>
add the text section
in this section, add the text description to this app.
<topic_end>
<topic_start>
add the TextSection widget
add the following code as a separate widget after the ButtonSection widget.
<code_start>
class TextSection extends StatelessWidget {
const TextSection({
super.key,
required this.description,
});
final string description;
@override
widget build(BuildContext context) {
return padding(
padding: const EdgeInsets.all(32),
child: text(
description,
softWrap: true,