Search code examples
flutterdartwidgetcontainers

How to right Side Border to a Container in flutter


How can one add right Side Border to a Container in flutter?.


Solution

  • Since you have not provided us with any code and any clear explanation on what you want, so I am going to assume you just want a right border of a container to be visible.

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: Container(
              height: 100,
              width: 100,
              decoration: BoxDecoration(
                border: Border(
                  right: BorderSide( //                   <--- right side
                    color: Colors.black,
                    width: 3.0,
                  ),
                )
              ),
              child: Center(
                child: Text("TEXT")
              )
            )
          ),
        );
      }
    }
    

    An image for understanding. image