citomoltd_workspace.json
C

CitomoLtd

Verified Studio
const Organization = { ceo: "Md Shakil Hossain" };
 

Flutter Center, Padding & Margin - All Common Properties

 

Flutter Center, Padding & Margin - All Common Properties


🔹 Center - All Common Properties

Center(

  // Child Widget
  child: Text(
    "Hello Flutter",
  ),

  // Width Factor
  // Child এর Width এর কত গুণ Space নিবে
  widthFactor: 2.0,

  // Height Factor
  // Child এর Height এর কত গুণ Space নিবে
  heightFactor: 2.0,
)

📌 Center Properties Summary

Propertyকাজ
childভিতরের Widget
widthFactorChild Width এর Multiplication
heightFactorChild Height এর Multiplication

Example

Center(
  child: Container(
    width: 100,
    height: 100,
    color: Colors.blue,
  ),
)

🔹 Padding - All Common Properties

Padding(

  // ভিতরের Space
  padding: EdgeInsets.all(20),

  child: Text("Flutter"),
)

EdgeInsets Variations

// সবদিকে সমান Padding
EdgeInsets.all(20)

// Left, Top, Right, Bottom
EdgeInsets.fromLTRB(10, 20, 10, 20)

// Horizontal + Vertical
EdgeInsets.symmetric(
  horizontal: 20,
  vertical: 10,
)

// শুধুমাত্র নির্দিষ্ট Side
EdgeInsets.only(
  left: 10,
  right: 10,
  top: 20,
  bottom: 20,
)

Example

Padding(
  padding: EdgeInsets.symmetric(
    horizontal: 20,
    vertical: 10,
  ),
  child: Text("Padding Example"),
)

📌 Padding Properties Summary

Propertyকাজ
paddingভিতরের Space
childChild Widget

🔹 Margin (Container এর মাধ্যমে)

Flutter-এ আলাদা Margin Widget নেই।

Margin দেওয়ার জন্য Container ব্যবহার করা হয়।

Container(

  // বাইরের Space
  margin: EdgeInsets.all(20),

  width: 200,
  height: 100,

  color: Colors.blue,

  child: Center(
    child: Text("Container"),
  ),
)

Margin Variations

// সবদিকে সমান Margin
margin: EdgeInsets.all(20)

// Left, Top, Right, Bottom
margin: EdgeInsets.fromLTRB(
  10,
  20,
  10,
  20,
)

// Horizontal + Vertical
margin: EdgeInsets.symmetric(
  horizontal: 20,
  vertical: 10,
)

// নির্দিষ্ট Side
margin: EdgeInsets.only(
  left: 20,
  top: 10,
)

📌 Margin Properties Summary

Propertyকাজ
marginWidget এর বাইরের Space
paddingWidget এর ভিতরের Space

🔹 Padding vs Margin

Container(

  // Outside Space
  margin: EdgeInsets.all(20),

  // Inside Space
  padding: EdgeInsets.all(20),

  color: Colors.blue,

  child: Text("Flutter"),
)

Visual Understanding

┌─────────────────────────┐
│        Margin           │
│  ┌───────────────────┐  │
│  │      Padding      │  │
│  │  ┌─────────────┐  │  │
│  │  │    Child    │  │  │
│  │  └─────────────┘  │  │
│  └───────────────────┘  │
└─────────────────────────┘

📌 সংক্ষেপে

Widgetব্যবহার
CenterChild কে Center এ রাখে
Paddingভিতরের Space দেয়
Marginবাইরের Space দেয়
EdgeInsetsPadding/Margin সেট করতে ব্যবহৃত হয়

Comments