Create card with shadow inner - flutter

I don't know I can create shadow in the corners of card like image.

In this video, I wanted to create a shadow effect within the Card widget in the flutter app but there is no such attribute in the card class in a flutter. So we need to use Container Widget within Card Widget to create such an effect. Watch the Solution Video, understand how the shadow effect is achieved.
Use Card widget
There is no such attribute as Inner Shadow in Card Class
You have to use Container Widget to create such an effect
In the Container widget, use decoration property
In decoration, use BoxShadow

Related

How to create an image & text cutout in Flutter, with Container customisability?

I need to cutout both images (icons that have transparency) and text into a Container.
The main method to achieve this appears to be using ShaderMask.
My main issue is that this doesn't allow me to wrap my text or image in a simple Container, with fixed height and decoration.
How can I either have this mask/cutout apply to a parent widget or gain further customisation options on the child? Or is there a more flexible option than ShaderMask?

Flutter to apply styling to the child widget Is it necessary to wrap it inside a Container Widget

Is it necessary to use wrap another widget (ie Text, image etc) inside the Container widget as a child, if we want to apply styling to the child widget? In other words, can I apply styling to my Text or Image widgets without wrapping them inside Container widgets?
Yes its is necessary to wrap your widget using a Container or DecoratedBox.
The reason is that in flutter decorations are applied using the BoxDecoration class. If you want use styles like Borders, Background Colors Shadows etc you would need to use a Widget that uses a BoxDecoration.
If you don't want to use a Container you can use the DecoratedBox widget provided by flutter amongst others.
If you want to apply styles only to your text data, then you don't need to use Container or DecoratedBox, as pure text styles can be provided to the Text Widget, by providing the style property with the a TextStyle Class.
DecoratedBox Widget Docs
BoxDecoration Docs
TextStyle Docs

I want to add a buttombar to my application Contains only text flutter

I want to add a buttombar to my application Contains only just one text with background color .
I need it to write the copyright in my application, but I find just that I have to add At least a two-item
In the list,
I don't need this
Just i want to add a single one text with a background color
In your case you do not need a bottombar widget.
you can create a container with specific height and background color and center a text widget in the container.
If you are looking to add bottomNavigationBar with one item only you can just write your own widget in the bottom navigation bar like a Container and set a background of your choice and give it a child widget wrapped in an INKWELL or GESTUREDETECTOR and if it overlaps with the Phone's GUI you can wrap the inkwell with SAFEAREA widget

Things to be aware of when using a container as a parent instead of MaterialApp/Scaffold

Say I'm building an app that doesn't need Material design elements and use a container as a parent.
Are there things that need to be set up manually (layout-wise) that's unnecessary when using MaterialApp/Scaffold?
Following are few unexpected behaviors I noticed when using a container as a parent:
• Yellow lines in Text widgets (These lines disappear when using Scaffold instead)
• ClipRRect widget takes up the full screen even when I set constraints
Material class is a main component of your UI. Using a Material Widget as parent doesn't mean you are forced to use Material Design for your entire app, you can do your own custom Widgets, UI, etc.
As part of the official documentation:
The Material widget is responsible for:
Clipping: If clipBehavior is not Clip.none, Material clips its widget sub-tree to the shape specified by shape, type, and borderRadius. By default, clipBehavior is Clip.none for performance considerations.
Elevation: Material elevates its widget sub-tree on the Z axis by elevation pixels, and draws the appropriate shadow.
Ink effects: Material shows ink effects implemented by InkFeatures like InkSplash and InkHighlight below its children.
It is also responsible of providing default styles for your Texts (that's why you're seeing the yellow underline).
Still, remember that you're making apps for mobile clients, therefore, you should be using some of the best practices that MaterialApp and CupertinoApp bring out of the box, even if you decide to take your own path inside the app, using your own custom Widgets, etc

How do I paint an InkResponse above other widgets?

I have a LeafRenderObjectWidget in a Column:
Column(children: [CustomRenderObject(), InkResponse(child: ..), ...])
Below that, there is an InkResponse. Normally, the splash and highlight from the InkResponse would draw above the previous widget in the Column. If I had the following scenario, the highlight and splash would be rendered above the Container:
Column(children: [Container(height: ..), InkResponse(child: ..), ...])
However, in my scenario with the RenderObject, anything I draw at the bottom of my CustomRenderObject widget in the paint method of my RenderBox will be drawn above the InkResponse splash and highlight.
The Material is a parent of the Column.
This means that my InkReponse highlight and splash are cut off at the top. I do not want to add additional padding to my InkResponse. How can I have my InkResponse draw above my RenderBox?
Solutions to this problem are described in the troubleshooting section of the InkResponse class.
If you are just using a simple colored Container or something similar, you can use the Ink widget instead, which will paint onto the Material and thus render the InkResponse's highlight and splash above.
Another solution would be adding a Material of type MaterialType.transparency:
Material(type: MaterialType.transparency, child: InkResponse(..))
This would go right below the InkResponse itself. However, this does not solve my problem as it clips the InkResponse into a rectangle.
The InkResponse will draw the splash above the parent widget in the tree and not in the siblings. That explains why it is painting in your Material widget that is above the Column because the Column itself is just a layout MultiChildRenderObjectWidget.
The solution that you provided, is actually a good approach that is used sometimes, but since you want to render the splash effect in your LeafRenderObjectWidget, and because it has not children, Flutter doesn't know where actually you want to render the splash effect. I'm afraid you can't use InkResponse to render splashes in a leaf widget.
An ugly solution that might work, can go from using a Stack to place each widget on the top of the other but you'd still have to make sure they would have the same appearance. If it is a complex render object, this can be tricky.