borderRadius Trong Decoration - Tự Học Flutter

 



Các Giá Trị của BorderRadius

Dưới đây là các giá trị và phương thức phổ biến của BorderRadius:

1.BorderRadius.circular(double radius): Tạo bo góc tròn đều cho tất cả các góc.

Container(
        // margin: const EdgeInsets.all(100),
        // alignment: Alignment.topCenter,
        // padding: const EdgeInsets.all(20),
        width: 100,
        height: 100,
        // color: Colors.green,
        decoration: BoxDecoration(
          color: Colors.green,
          borderRadius: BorderRadius.circular(25),
        ),
        child: const Center(
          child: Text('Hieu'),
        ))


2. BorderRadius.all(Radius radius): Tạo bo góc với bán kính cụ thể cho tất cả các góc.

Container(
        // margin: const EdgeInsets.all(100),
        // alignment: Alignment.topCenter,
        // padding: const EdgeInsets.all(20),
        width: 100,
        height: 100,
        // color: Colors.green,
        decoration: const BoxDecoration(
          color: Colors.green,
          borderRadius: BorderRadius.all(Radius.circular(25)),
        ),
        child: const Center(
          child: Text('Hieu'),
        ))


3. BorderRadius.only({Radius topLeft, Radius topRight, Radius bottomLeft, Radius 
bottomRight}): Tạo bo góc cho từng góc riêng lẻ.



4. BorderRadius.horizontal({Radius left, Radius right}): Tạo bo góc cho các góc trái và phải.

Làm Giống borderRadius.all(Radius radius) nhưng thêm name param là left và right


5. BorderRadius.vertical({Radius top, Radius bottom}): Tạo bo góc cho các góc trên và dưới.

Làm Giống borderRadius.all(Radius radius) nhưng thêm name param là left và right

Post a Comment

Previous Post Next Post