How to draw a dynamic height line in flutter? - flutter

I wanted to draw a dynamic height line, as shown in the given picture below
I did something line this using a continer with one sided border
Container(
child:(content goes here....)
margin: EdgeInsets.symmetric(horizontal:16+20.0),
decoration: BoxDecoration(
border: Border(
left: BorderSide(width: 2.0, color: Colors.lightBlue.shade600),
),
color: Colors.white,
),
)
but the issue is the corners(top and below) of the line is not rounded.
I want to draw a vertical line on the left side of my post, and on the right side goes the content.

You could try something like this:
IntrinsicHeight(
child: Row(
children: [
Container(
width: 5,
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
color: const Color(0x7f9e9e9e),
),
),
Expanded(child: **content goes here**),
],
),
)
And here's a DartPad example for you: Example
Which will produce something like this:
Where the bar on the left will size automatically with the contents on the right.

Related

What is this icon name?

I want to use this icon on my Flutter app, unfortunately I do not know the name. Someone could tell me what's the name?
the three points icon is:
Icon(Icons.more_horiz)
and you can reach the same shape over it like this:
Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Colors.black,
width: 1,
),
),
child: Icon(Icons.more_horiz),
),
this will result in something like this, I didn't compare them, so changing just the padding and border, and border radius values will get you there

How can I apply notch curve to Widget?

I have a design as you can see below and the question is how can I apply this notch effect on Arrow ? Is there any easy way to do it just like in Floating Action Button ? Thanks in advance.
I have created Dartpad, please look into this and do let me know if you need any help.
Dartpad Link : https://dartpad.dev/flutter?9bd55396e067e71a839851e18905f478
Code:
Padding(
padding: const EdgeInsets.all(16.0),
child: SizedBox(
height: 70,
child: Stack(alignment: Alignment.centerRight, children: [
Padding(
padding: const EdgeInsets.only(right: 20.0),
child: Container(
height: 70,
decoration: BoxDecoration(
color: Colors.cyan, borderRadius: BorderRadius.circular(8)),
),
),
Container(
width: 40,
height: 65,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 5)),
child: FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.cyan,
child: const Icon(Icons.chevron_right),
),
)
]),
),
);
Output:
Hey you can achieve it in 2 way
1st one and simple - Create a box decoration widget and a circle shape widget with white border and put these together with Stack and fit as per your requirements.
2nd use Custom Clipper or Custom Paint and draw your shape.

How can I create this circles for my flutter UI?

I want to create those blue circles (you can see them on the picture), the app UI design was created with Figma.
I don't even know how to start, I'm new at flutter
Any ideas or tips?
You can start learning from flutter.dev.
There are many ways to do this. I am using Container with decoration
Container(
height: 70,
width: 70,
padding: EdgeInsets.all(10), //spacing using padding
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(width: 5, color: Colors.blue),
),
child: const Material( //inner circle
color: Colors.green,
shape: CircleBorder(),
),
)
More about Container.

How do i add shadow or bottom margin in dropdownlist in flutter?

I want to add shadow or margin to the bottom of text so user can see distinctly different tiles in it. How do i go about that?
You can add the text as a child to a Container and then set it's border according to your need.
DropdownMenuItem(
child: Container(
child: Row(
children: <Widget>[
Icon(Icons.exit_to_app),
SizedBox(
width: 8,
),
Text('Logout'),
],
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.black87,
width: 1.0,
),
),
),
),
);
Dartpad link. Output:

FractionallySizedCircle? in flutter

is there any tricks to achieve sth like a FractionallySizedBox
to get a circle the size of a fraction of parent's height or width ?
like this :
FractionallySizedCircle(
heightFactor: .5,
child: ClipRRect(
borderRadius: BorderRadius.circular(2000), // side question : is there a better way to achieve this too ?
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: globals.lightBlue,
),
child: Align(
alignment: Alignment(0, 1),
child: SvgPicture.asset(
'assets/images/boy-id.svg'),
),
),
),
),
[Update] : I needed to have a circular ClipRRect just like the sample code has the ClipRRect in it, changed it with clipOval and did the job, but would come in handy if we could have real FractionallySizedCircle (this ClipOval is actually an oval obviuosly), so the question stays open...
You can use FractionallySizedBox and Container simply like this:
FractionallySizedBox(
heightFactor: 0.5,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.lightBlue,
),
),
)