So, basically I want to completely remove the top bar in bluish color which shows the current date and year and start the calendar interface from the white background but I can't figure out how to do it.
Flutter is an open source project which allows you to modify their entire code.
You should take a look at the class _DatePickerDialog and _DatePickerHeader.
Copy the entire code from date_picker.dart and, at line 1020, remove header and that's it.
return Container(
color: theme.dialogBackgroundColor,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
header, // this one is the header
Flexible(child: picker),
actions,
],
),
)
Most likely you should change Flexible for Expanded over your Column.
Here is the official docs showDatePicker
Related
I want to get my AssetImage and Text side by side each other. To achieve that I used a row and it is being displayed like this:
Row(
children: [
Image.asset('assets/images/pfp.png',height: height*0.1,),
Column(children: [Text("we")],)
],
)
I want the image to be displayed in this way:
I want the text to start from the top of the image. How do I achieve that? Below is the current code I have that displayed it as the first image:
Use crossaxisalgnment
Row(
crossAxisAlignment : CrossAxisAlignment.start,
children : [
Image.asset(""),
Text(""),
]
)
Just add a cross axis alignment property to your Row widget
Set it to crossAxisAlignment: CrossAxisAlignment.start
You will have the expected result ✔️
I have a Text widget (the +357) next to a TextFormField widget (the 12345678) like here:
They are put in a row (with the icon as well).
The problem is when there is error text in the TextFormField, the error text displaces the TextFormField entirely:
How can I keep the TextFormField in its place even when there is an error text to be displayed??
note: if it turns that showing some code is needed just ask about it, as I think that I explained it clearly above.
Try to add the property crossAxisAlignment: CrossAxisAlignment.start to your row
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...
],
),
How to add the 'pinned item' functionality, similar to Google Keep, on a ListView?
I tried doing 2 list view, and putting the pinned one on top of a Column. But the problem is they scrolled separately, and if I wrapped the column in a Singlechildscrollview, it just gives error.
Am I on the right track of doing it or there is a way by just using a single list view?
Implement if you want:
add an extra field to your object: bool pinned -> then you sort the list to make sure the pinned items are on top of the list
put a GestureDetector around the item and use the onTap to set the pinned value -> pinned = !pinned
Or try this package I just found:
https://pub.dev/packages/pinnable_listview
I think I got the Singlechildscrollview worked the way I want it to. I just have to set the ListView shrinkWrap: true, and physics: NeverScrollableScrollPhysics(). I'm not sure if this is a good idea tho, since most people say that shrinkWrap is quite a heavy operation to use.
SingleChildScrollView(
physics: ScrollPhysics(),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Pinned'),
PinnedListItemHere(), //ListView of Pinned Items
Divider(
height: 25.0,
thickness: 2.0,
),
Text('Others'),
UnpinnedListItemHere(), //ListView of Unpinned Items
],
),
),
Hi all fellow developers,
I am developing a responsive web page in flutter using the flutter web SDK, but i am stuck at one part of the page where i have a Row inside row I have 2 Containers among which i want the 1st Container to be Scrollable and the Second container to be of constant size(Non scrollable) just like whatsapp web ui where contact list keeps scrolling but the chat side and the rest of the page doesn't.
please Help me,
Thanks in advance...
This should work You need a fixed sized container and make sure a Scroll able widget should be inside it. Now size can be made responsive by using Media Query Parameters and below code you only need to adjust space and sizing and it would work.
Row(
//Your parent Row
children: [
Container(
//static non scrollable container
child: Column(
children: [
//Children you want to add
//this wont be scrollable
//It is also preferred that you give this some height or width too
],
),
),
Container(
//Scrollable container
//Please adjust height and width yourself
//You can use media query parameters to make it responsive
width: 200,
height: 500,
child: SingleChildScrollView(
//You can also change the scroll direction
child: Column(
//Add children you want to be in
//Scrollable column
),
),
)
],
),
I have a list I'm mapping:
List<Widget> names = post.names
.map(
(c) => new Padding(
padding: EdgeInsets.all(8),
child: new Text('' + c['name']),
),
)
.toList();
And displaying:
new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: names,
),
However, the row overflows to right if it has too many items in it. I tried to wrap it to Expanded / Flexible widgets, but that causes error about the parent widget not having height.
If I try to use:
crossAxisAlignment: CrossAxisAlignment.stretch,
I get:
BoxConstraints forces an infinite height.
I also tried to use Expanded inside the Row, however that is not possible as I'm creating the children from the list and that causes error.
How to achieve a name list which also expands vertically based to amount of items?
You need to use Wrap instead of Row like this.
Wrap(
children: names,
//...
),
If you want the widgets to be scrollable horizontally, use a list view and set the axis to horizontal.
But if you want the widgets to wrap, then you need to build a grid instead of a row.
Check out this post: Flutter - Layout a Grid