Jagora don Amfani da Border in Flutter

A cikin Flutter shirye-shirye, amfani da Border wani muhimmin sashi ne na ƙirƙirar ƙayyadaddun ƙayyadaddun bayanai don abubuwan UI ɗin ku. Border yana ba ku damar ƙera keɓancewar al'ada don abubuwa kamar hotuna, kwantena, da maɓalli. A cikin wannan labarin, za mu bincika yadda ake amfani da Border don ƙirƙirar ƙayyadaddun abubuwa a cikin Flutter aikace-aikacenku.

Basic Border

Kuna iya amfani da Border ajin don ƙirƙirar iyaka don takamaiman widget. A ƙasa akwai misalin ƙirƙirar iyaka don murabba'i huɗu:

Container(  
  width: 100,  
  height: 100,  
  decoration: BoxDecoration(  
    border: Border.all(width: 2.0, color: Colors.blue), // Create a border with width 2 and blue color  
 ),  
)  

Iyaka ta bangarori daban-daban

Hakanan zaka iya keɓance iyaka ga kowane gefe na widget:

Container(  
  width: 100,  
  height: 100,  
  decoration: BoxDecoration(  
    border: Border(  
      left: BorderSide(width: 2.0, color: Colors.red),   // Left border  
      right: BorderSide(width: 2.0, color: Colors.green), // Right border  
      top: BorderSide(width: 2.0, color: Colors.blue),    // Top border  
      bottom: BorderSide(width: 2.0, color: Colors.yellow),// Bottom border  
   ),  
 ),  
)  

Keɓance Iyaka tare da Radius

Kuna iya amfani da ku BorderRadius don zagaye kusurwoyin kan iyaka:

Container(  
  width: 100,  
  height: 100,  
  decoration: BoxDecoration(  
    border: Border.all(width: 2.0, color: Colors.blue),  
    borderRadius: BorderRadius.circular(10.0), // Round corners with a radius of 10  
 ),  
)  

Haɗuwa da BoxDecoration

Kuna iya haɗa amfani da su Border don BoxDecoration ƙirƙirar ƙarin tasiri da siffofi na kan iyaka.

 

Ƙarshe:

Yin amfani da Border a ciki Flutter hanya ce mai ƙarfi don ƙirƙirar ƙayyadaddun ƙayyadaddun abubuwan abubuwan UI ɗin ku. Ta hanyar keɓance faɗin, launi, da kusurwoyin kan iyaka, zaku iya keɓance maɓalli na musamman da jan hankali don aikace-aikacenku.