تنبيه النظام

الرجاء تحديد نص من المقال أولاً لإنشاء بطاقة المشاركة.

1 / 10
Ahmed Bouchefra Profile Header
A.B

;Ahmed Bouchefra

1.2k منشورات
100k قارئ
9 كاتب

أنا أحمد بوشفرة، مبرمج ومؤلف تقني (Tech Author) متخصص في تبسيط مفاهيم البرمجة وتطوير الويب. منذ عام 2017، أقدّم محتوى موجّهًا للمبرمجين عبر موقع 10xdev blog، بالإضافة إلى منصّات مثل SitePoint وSmashing Magazine. أسلوبي عملي ويساعد المبرمجين على فهم التقنيات بسرعة وبناء مهارات قوية بثقة. كما تعاونت مع دار النشر Packt في إصدار كتاب Full Stack Development with Angular and GraphQL، مما يعكس جودة المحتوى الذي أقدمه للمبرمجين. يحتوي هذا الموقع على مقالات كتبتها للجمهور العربي، بالإضافة إلى مقالاتي المترجمة من موقع 10xdev blog ومقالات أخرى ساهم بها مبرمجون من مختلف الأنحاء.

Add and Customize Borders In Flutter

جاهز

ملخص سريع للمقال باستخدام الذكاء الاصطناعي

إذا لم يكن لديك الوقت لقراءة المقال بالكامل، اضغط على زر نسخ لنسخ التوجيه (Prompt) أدناه، ثم اضغط على زر فتح ChatGPT للصقه هناك والحصول على أهم النقاط.

لخص هذا المقال واستخرج أهم النقاط (Key Takeaways) مع شرح المصطلحات التقنية. العنوان: Add and Customize Borders In Flutter - الرابط:
https://www.ahmedbouchefra.com/flutter-add-border/

In this article, we’ll see how add and customize borders in Flutter.

Adding border and customization is easy in Flutter because of BoxDecoration widget provided by flutter. In this article, I will demonstrate how to add a different border to the container using BoxDecoration widget

Add simple border with color

you can set decoration border property to set the color of the border.

`Container(
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              border: Border.all(color: Colors.blueAccent)
            ),
            child: Text('Simple Border'),
          ),` 

Change width of the border

All factory method in Border class have width property to set the width of the border

`Container(
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              border: Border.all(color: Colors.blueAccent,width: 10)
            ),
            child: Text('Simple Border'),
          )` 

Add different borders for each side

You can use Border class instead of all factory method to set a different border to each side in the widget.

`Container(
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              border: Border(
                top: BorderSide(
                  width: 10,
                  color: Colors.amber
                ),
                bottom: BorderSide(
                  color: Colors.blue
                )
              )
            ),
            child: Text('Simple Border'),
          )` 

Round corner border/ Border radius

You can set borderRadius property in BoxDecoration class to give radius to the borders. You can specify the same radius for all the corners or different radius for each corner

Equal radius for all corners

`Container(
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10),
              border: Border.all(color: Colors.blueAccent,width: 2)
            ),
            child: Text('Simple Border'),
          )` 

Different radius to each corners

`Container(
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.only(topLeft: Radius.circular(10),bottomRight: Radius.circular(10)),
              border: Border.all(color: Colors.blueAccent,width: 2)
            ),
            child: Text('Simple Border'),
          )` 

Conclusion

I hope you get an idea how to add border and customize that based on your need.