How To Change Image Border Color In Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 09-10-2020

Border color is the visible part of border displays on screen. In flutter we can use BoxDecoration() class color parameter to Set Change Image Border Color in Flutter android iOS mobile app. The color supports multiple type of parameters and in current tutorial we would use HEX color codes.

How To Change Image Border Color In Flutter Android App

Change Image Border Color
Step 1: 
Change Image Border Color Short Code 

 Container(
  decoration: BoxDecoration(
      border: Border.all(
        color: Colors.lightGreen,
        width: 5,
      )),
  child: Image.asset("assets/background.jpg",
    width: 250,
    fit: BoxFit.contain,
  ),
),

Complete Code FOr Change Image Border Color In Flutter
Main.dart
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
        home: Scaffold(
            appBar: AppBar(
              backgroundColor: Colors.black,
              title: Text('Set Image Border Color',style: TextStyle(color: Colors.lightGreen),),
            ),
            body: Center(
              child: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(top:50.0),
                    child: Container(
                      decoration: BoxDecoration(
                          border: Border.all(
                            color: Colors.lightGreen,
                            width: 5,
                          )),
                      child: Image.asset("assets/background.jpg",
                        width: 250,
                        fit: BoxFit.contain,
                      ),
                    ),
                  ),
                ],
              ),
            )));
  }
}

Related Post