Answers for "flutter container match image width"

-2

flutter image cover container

// If your container has a fixed height use the following code
Container(
  width: MediaQuery.of(context).size.width,
  height: 100,
  decoration: BoxDecoration(
    image: DecorationImage(
      fit: BoxFit.fill,
      image: NetworkImage("https://picsum.photos/250?image=9"),
    ),
  ),
)
Posted by: Guest on November-26-2020
0

Resize image flutter respecting aspect ratio

//import 'package:flutter_native_image/flutter_native_image.dart';

ImageProperties properties = await FlutterNativeImage.getImageProperties(file.path);
File compressedFile = await FlutterNativeImage.compressImage(file.path, quality: 80, 
    targetWidth: 600, 
    targetHeight: (properties.height * 600 / properties.width).round());
Posted by: Guest on June-29-2021

Code answers related to "flutter container match image width"

Code answers related to "Dart"

Browse Popular Code Answers by Language