I want to set images to my custom frame(frame is a png file) like image below.
image
image reference (https://favpng.com/png_view/film-strips-photographic-film-filmstrip-photography-photo-booth-png/EDuYNtkt)
use can try this it will help
Expanded(
// your image goes here which will take as much height as possible.
child: Image.asset('asset', fit: BoxFit.contain),
),
or
Image.asset('asset', fit: BoxFit.fill)
Related
I have an overflow on this image :
Container(
width: MediaQuery.of(context).size.width,
child: Image.network(imageSomwhereFomTheInternet),
),
How can I display a generic image from the internet preventing it to change its proportions? (I mean, if I fix an height or width the image could be "damaged" by this decision, I would like to use an automatic widget that fit this image in a certain Box, or something like that).
I don't know much about "How handle images", if you can suggest me something easy to understand where I can read more I would be very happy.
You can use fit property of image
Container(
child: Image.network(
"https://images.unsplash.com/photo-1547721064-da6cfb341d50",
fit: BoxFit.cover,
),
)
You can choose which suits you best from following:
BoxFit.contain- As large as possible but contained within the Container
BoxFit.cover- As small as possible but covering the entire Container
BoxFit.fill- Fill the entire Container but may distort the image aspect ratio
I want to have a card/container which fits the whole screen. In this card exists an image asset. However, trying to fit the image in a Expanded Widget just scale it as far as it reaches a boundayry of the screen.
Is there any way to scale it up (and of course clip/crop the image by this) so it fills up the entire screen without reaching these overflow messages? Also the user should not be able to scroll in the overflowed part.
This code should help you, you can use the image as a widget as a Container's child too;
Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(filepath),
),
),
);
Hello does anyone know how i can mask a text and photo in flutter? I already have my image with text on the screen. For example: my text would be Lion and my photo of these lions are behind it. How can i make a mask like you can in photoshop?
See this photo for example:
I'm not sure this answers your question. It's a simple version of text masking but instead of masking an image this MIN REPRO EXAMPLE shows masking gradient colors:
ShaderMask(
shaderCallback: (bounds) => RadialGradient(
colors: [
Colors.red,
Colors.green,
],
).createShader(bounds),
child: const Text('exclusive'),
),
Unfortunately, as of writing ShaderMask is not supported yet for web online for iOS/Android. Check out more here: https://github.com/flutter/flutter/issues/44152
You may find these answers useful (just again they may not be supported on web yet I don't know about other solutions):
Is there a way to show image inside text in flutter
texture (image) on text in flutter
So currently I'm trying to render a large image for example:
I tried CachedNetworkImageProvider from pub_dev.
I also tried various different Providers with combination of Image widget. None of them worked.
The only widget that allows me to render the image is photo_view which renders the 4k image but has Zoomable feature that I don't want to have.
How can I remove this feature and fit with BoxFit?
Libraries tried to render the image:
extended_image
image_ink_well
flutter_advanced_networkimage
When using PhotoView you can disable the zoom functionality.
IgnorePointer( // The PhotoView widget thinks there's nothing happening
// because you're catching any clicks that happen here.
child: PhotoView(
minScale: PhotoViewComputedScale.covered,
maxScale: PhotoViewComputedScale.covered,
),
),
You can read more about the PhotoView class here: https://pub.dev/documentation/photo_view/latest/photo_view/PhotoView-class.html
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I try to load this image using NetworkImage and show it. But instead i get half the picture and the rest is a white background on view and has very low quality. Please, help me how show this image or split this image on 3 image. Thanks.
code
preview this picture on phone
You'll have to set fit property as BoxFit.fitWidth and set the width size as the size of your screen.
Also you need to wrap the Image widget inside a SingleChildScrollView because your image is too large.
return SingleChildScrollView(
child: Container(
child: Image.network(
"http://img.mangachan.me/manga/-9new/b/1511440860_blessed_v1_ch1/__________________._.jpg",
fit: BoxFit.fitWidth,
width: MediaQuery.of(context).size.width,
),
),
);
Consider to split your large image into small pieces.