row percentage based layout

2개이상의 widget을 다룰 때 사용 방법

Method to use when working with 2 or more widget

Row(
  children: <Widget>[
    Expanded(
      flex: 7,
      child: Container(
        color: Colors.green,
        child: Text(''),
      ),
    ),
    Expanded(
      flex: 3,
      child: Container(
        color: Colors.yellow,
        child: Text(''),
      ),
    ),
  ],
),

cf. https://stackoverflow.com/questions/43122113/sizing-elements-to-percentage-of-screen-width-height

percentage based layout

cf. https://api.flutter.dev/flutter/widgets/FractionallySizedBox-class.html
1개의 widget을 다룰 때 사용 방법

Method to use when working with one widget

Flexible(
  child: FractionallySizedBox(
    widthFactor: 0.4,
    child: Container(
      color: Colors.purple,
        child: Text(''),
      ),
    ),
  ),

profile
𝙸 𝚊𝚖 𝚊 𝚌𝚞𝚛𝚒𝚘𝚞𝚜 𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚎𝚛 𝚠𝚑𝚘 𝚎𝚗𝚓𝚘𝚢𝚜 𝚍𝚎𝚏𝚒𝚗𝚒𝚗𝚐 𝚊 𝚙𝚛𝚘𝚋𝚕𝚎𝚖. 🇰🇷👩🏻‍💻

0개의 댓글