INDEX / JOURNAL / LOG-002
VOL. 2026 · ENGINEERING
SERIES 2 / 7
LOG-002 · WIDGET TREE

Widget は画面ではない

PUBLISHED
2026 · 06 · 19
AUTHOR
MIGIWAYA
READ
約 6 分
TAGS
#flutter#dart

§ 01IMMUTABLE

lib/widgets/price_tag.dartDART
class PriceTag extends StatelessWidget {
const PriceTag({super.key, required this.label, required this.amount});
 
final String label;
final int amount;
 
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Row(
children: [
Text(label, style: theme.textTheme.bodyMedium),
const SizedBox(width: 8),
Text('¥$amount', style: theme.textTheme.titleMedium),
],
);
}
}

§ 02THREE-TREES

§ 03BUILD

§ 04CONTEXT

DART
final theme = Theme.of(context);
final l10n = AppLocalizations.of(context);
final media = MediaQuery.of(context);

§ 05COMPOSE

§ 06KEY

DART
ListView(
children: [
for (final item in items)
TodoRow(key: ValueKey(item.id), item: item),
],
)

§ 07SUMMARY

脚注 · NOTES
  1. [1]
  2. [2]
  3. [3]
  4. [4]
同シリーズ · Flutter の基礎を実コードで学ぶ
§ + RELATED すべて見る →
INQUIRY
CONTACT
LOCATION
STATUS
Active / Open
ESTABLISHED
2024 · 5 · 5
FORM