How to make Flutter Stepper body expand to fill entire screen height - flutter

Because Flutter Stepper is scrollable, it can't be set the step content to fill its height.
I want to make a layout like this
While I'm getting this layout
I've used SizedBox with fixed height, but it's incorrect way while screens have different height values.

You can use SizedBox , just specify a non-fixed height and get the current screen height via
MediaQuery. of(context). size. height
this is how it works normally regardless of the screen size
Step(
isActive: currentStep >=0,
title: Text('Account'),
content: SizedBox(
height: MediaQuery. of(context). size. height - 300,
child: Text("sdf"),),
),

Related

Is flutter render infinity size?

I am new in flutter I can't understand that is infinity size render in flutter
If I use container with infinity width then it will render but in box constraints documentation infinity size can't render
This is because there is something constraining the widget, when you set as an example:
Container(
width: double.infinity,
),
it will try to take an infinity size, which usually will throw an error to you, but it's constrained so it takes the max possible width.
The Container widget is built on top of different multiples widgets such as ConstrainedBox, DecoratedBox, Align, LimitedBox... , the ConstrainedBox defaults to the BoxConstraints.expand(), check it's source code:
// ...
child: ConstrainedBox(constraints: const BoxConstraints.expand()),
);
but if you check also the Scaffold source code :
// ....
final BoxConstraints fullWidthConstraints = looseConstraints.tighten(width: size.width);
so trying to expand that Container even within infinity, will expand it at maximum on the fullWidthConstraints which is, in this case, the screen's width.

How can i make image in full screen without to lose some parts of image on screen

to display image according to it's original size i do the following
Image.file(File(fileCreated!.path)),
to display image to fit height and width (full screen) i do the following
Image.file(File(fileCreated!.path),fit: BoxFit.cover,height: double.infinity,width: double.infinity,),
ok it is now in full screen but i noticed there is some missing parts of the image contents is no longer visible on screen like 20 pixel from width and height , i know flutter do it for keeping the image quality the same. but How i ignore that behavior
How could i display image in full screen so the whole image parts is visible on screen ?
i tried with following
height:MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
whatever i change the height. the width will be auto changing too, even if i did not change the width !!!!
but same result
edit :
full parent
#override
Widget build(BuildContext context) {
return Scaffold(
body: Image.file(File(widget.imageFile,),fit: BoxFit.cover,height: MediaQuery.of(context).size.height,),
);
}
}
You can use MediaQuery, but I will prefer using LayoutBuilder on top widget. Also check the parent widget if it is having padding/margin.
Image.file(
File(fileCreated!.path),
fit: BoxFit.fill,
height:MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
),

Flutter Horizontal PageView with Child Width Larger Screen Width

How to implement PageView width child have width larger screen width.
PageView(
controller: controller,
children: const <Widget>[
Image('img1.jpg'),
Image('img2.jpg'), // large image one
Image('img3.jpg')
],
)
https://i.imgur.com/jvowQd2.mp4
try using InteractiveViewer. It lets you have a bigger size image or widget in it and the user can zoom or zoom out from it.
InteractiveViewer documentation.

Flutter - How to create fluid / dynamic container that follows it's parent height?

I want to have a line that has 100% parent height, the line should has a fluid height following it's parent's height. the parent's height would be dynamic because every content has it's own height. Just like in Path app.
This is my app, currently I'm setting the height as a constant, how to make it dynamic following it's parent's height? :
Container(
width: 1,
color: Colors. redAccent,
height: 300, // <-- this height
)
try to use the Expanded Widget which uses the available space. you just have to definewhat is the available space here
Expanded(
child: Container(
color: Colors.amber,
width: 100,
),
),
here, if you dont put something on top of the expanded, it will take all the screen
and if not on the bottom, it will reach the bottom of the screen.
it takes the whole free space.
I solved this by adding container and add border left :)

Set width and height for Cupertino Picker

Cupertino Picker in flutter takes 100% width.
How do we give it custom styling? Height, Width, Borders?
I tried putting it inside a container with width and all, didn't work.Instead there was a weird soft edged background when I gave container a color.
Answering my own question for the time being,
I got a workaround by making the following tree:
Row
Sized box(width:20)
Expanded
Cupertino Picker
Sized Box(width: 20)
I tried multiple workarounds but none worked
A better approach is highly appreciated!
you can try wrapping it up with a container and setting width or height
Container(
height: 250,
child: CupertinoPicker(
itemExtent: 32,
onSelectedItemChanged: (value) {
setState(() {});
},
children:
...
}),