How to override an ExpansionPanel in flutter - flutter

How the title already suggests, I want to have my own ExpansionPanel, where, contrary to the default one, the elevation is set to zero.
I already found this in flutter.dev:
https://api.flutter.dev/flutter/material/ExpansionPanelList/ExpansionPanelList.html
I have been trying to implement this but haven't succeeded yet, how do I do it?
So Im talking about these Elevation marks of each ElevationPanel:

Maybe I misunderstood you, but it is as simple as just setting the elevation parameter when you build the widget, as such:
As such:
ExpansionPanelList(
elevation: 0,
children: [ ... ],
)
Edit:
After comments, problem has to do with divider color. Do something like this:
ExpansionPanelList(
dividerColor: Colors.transparent,
children: [...]
)

Related

How to get default theme data parameters in Flutter?

For example, the CardTheme. I know you can retrieve it this way:
Theme.of(context).cardTheme
However, how can I get its default parameters? I tried looking in the .dart files but it's difficult to find them.
What I would like to do is find default values for any given Widget in Flutter, so I can do something like this in the instance of a Card:
shape: Theme.of(context).cardTheme.copyWith(
clipBehavior: default,
color: default,
elevation: default + 25, // For example.
margin: default,
shadowColor: default,
shape: default,
surfaceTintColor: default,
),
I would find it useful as I often do not touch certain parameters, and when I find myself wanting to work starting from the defaults as a reference, I don't know where to get them.
You almost done it, you can get the default value this way Theme.of(context).cardTheme.elevation. So, to add 25 to elevation you just need to use like this:
var elevation = Theme.of(context).cardTheme.elevation;
shape: Theme.of(context).cardTheme.copyWith(
elevation: elevation + 25,
),

Flutter: Remove brightness bar from flutter_colorpicker

I used the flutter_colorpicker package to implement a color picker in my app. My widget looks something like this:
ColorPicker(
pickerColor: ...,
paletteType: PaletteType.hueWheel,
onColorChanged: (color) {
...
},
enableAlpha: false,
labelTypes: const [],
)
In the UI it looks like this:
Now I want to remove the brightness bar on the bottom. I know that the color picker is not complete without that brighness bar but I will handle the brightness a different way. I have found no official documentation on how to achieve this.
How do I remove that bar? Hacks are also welcome or somehow extending the package with inheritance.
Here I attach some links which contains no brightnesss bar
Flutter Material Color Picker
Flex Color Picker
I have solved the problem by clipping away that bar using a ClipRect widget:
ClipRect(
child: Align(
alignment: Alignment.topCenter,
heightFactor: 0.75,
child: ColorPicker(
...
colorPickerWidth: 250,
),
),
);
I have not found any unwanted side effects with this approach yet.

How to set the image position relatively

It is Flutter Layout basic question.
So far, I put a few images use Row.
However I want to do is putting image at 'right bottom' and 'left bottom'.
How can I accomplish this by Flutter layout system?
Row(
children: [
Image.asset('images/pic1.png',
height:50,
left:50, // this member doesnt exist.
bottom:10// this member doesnt exist.
),
Image.asset('images/pic2.png',
height:50
right:50,// this member doesnt exist.
bottom:10,// this member doesnt exist.
)
]
),
You can use Align. For example, for bottom right, you can do like this:
Align(
alignment: Alignment.bottomRight,
child: YourWidget(),
)
Be aware that Align fills all the space it can get so you might want to constrain it within a SizedBox or Container!
Here's everything you need to know about the Alignment class, which is what you pass to the alignment parameter of Align constructor.

Flutter: adding a gradient to my progress bar

Let me first say I started with flutter last week so I apologise in advance for my lack of knowledge.
I'm using a progress bar in my application:
FAProgressBar(
size: 50,
currentValue: dailyProgress,
direction: Axis.vertical,
verticalDirection: VerticalDirection.up,
progressColor: Colors.amber,
backgroundColor: Colors.grey[300],
animatedDuration: const Duration(milliseconds: 2000),
),
In reality it looks like this: https://imgur.com/NZUoZtW
I want it to look like this: https://imgur.com/gFCqfzR
How would you recommend me to proceed? It seems impossible to replace the progressColor property with a gradient. Is there another package I can use? Any suggestion is appreciated.
I suggest you try Gradient Widgets package for Flutter.
It has GradientProgressIndicator which should fit your needs.

how to change the opacity of the snackbar in flutter?

I wish to change the opacity of the SnackBar. It has only the background property. Can it be customized or I have to create the custom widget for snack bar?
Try using the color property of snack bar like this,
backgroundColor: Colors.black.withOpacity(0.5)
This should work as you expected.
You can adjust the opactiy of your backgroundColor with
color.withAlpha(..),
color.withOpacity(..),
using a hexadecimal integer 0x33ffffff (the first pair of digits after the x represents the alpha value),
creating a Color using Color.fromARGB(...)
or by using Color.fromRGBO(...).
You can find information about this on this documentation page about the Color class.
Now, you face the following problem: Your content is not yet translucent.
This is easily adjustable using the Opcacity Widget.
In your Snackbar just surround your actual content with an Opacity Widget:
SnackBar(backgroundColor: Color(0x66bbbbbb),
content: Opacity(opacity: .7,
child: Container(), // your content
),
)
If you are planning to make the background transparent, this may help you.
Mostly you get a black background because of elevation.
SnackBar(
elevation: 0,
backgroundColor: Colors.transparent,
/.......
),