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

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?

Related

How to prevent widgets from being hidden behind the system status bar

So I am creating a new flutter widget and I am unable to understand how my app looks because of the space on top of the screen in my emulator,
As you can see there is a shaded area on top and my widgets are under it, is there any way to remove it?
Use Safe Area.
SafeArea is basically a glorified Padding widget. If you wrap another widget with SafeArea, it adds any necessary padding needed to keep your widget from being blocked by the system status bar, notches, holes, rounded corners, and other "creative" features by manufacturers.
Check this link for more.
Wrap your code with the SafeArea.
more info about SafeArea class

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

Snapping effect / Focus on a Container for a ListView.builder scrolling vertically

I currently have a ListView.builder of containers that expand once I tap it. However, I'd like the containers to center in on the expanded container that was tapped.
List of items mockup
Expanded Container mockup
Currently, if I tap on No.2 from the Expanded Container mockup picture, the container will expand but it won't snap/focus on that container. I'd like to find a way to make this possible.
Thank you in advance!

overlapping widgets gtk

How can i make widgets overlap one another.
Lower most should be image, rest above can be other widgets like buttons.
Subclass the larger(parent) widget. In a create() method or in the constructor, add a layout( or container) widget to the parent widget, then inset the others into the container. Now threat this new subclass as if it were a single, but specialized, version of its super class.
A Window is an example of a parent widget, while Fixed is an example container. A child could be an EventBox enclosing an Image. The composite of all these is a new window object that has pictures that can be clicked.
For the case of a window's titlebar look with a pixmap background, and buttons, try a Window with an Image and a Fixed container to hold the buttons. The Fixed and the Image should be able to overlap as the Fixed is transparent, and an Image has no Window.
If Buttons are truly what's needed, have a look at Button Boxes and Toolbars in the list of GTK Containers. It may be possible to add an Image background to one of those.
A different approach involves an Alignment Widget(from the same list). It specifies where the smaller widgets are positioned and sized in a proportioned manner.
I assumed, OOP, but if it's not, just organize the creation of the widgets from one function. I've made composite widgets functionally in Haskell(Gtk2Hs), and in Guile Gnome Platform (with and without OOP)

ImageButton in gwt

I have to create a image button in gwt which uses three images(left side image,center stretch image and right image).Left side images and right images having rounded corners.Center Image wants to be stretched depends on button title size.Created ImageButton should have all the functionalities of Button.
Can anyone help me in how to achieve this.
If you need a button with rounded corners then there are a number of options:
Create a new widget that extends the DecoratorPanel to create the rounded corners. The DecoratorPanel will result in a table (HTML). You'll probably want to replace the standard images. Look at the standard.css that GWT provides to find the styles that define those images, then override those styles in your custom stylesheet (look for the CSS class ".gwt-DecoratorPanel"). In the widget, add a Label widget to display the button text and provide get and set methods on your widget to get and set text to the internal label. The label will resize automatically forcing the table cell to grow bigger.
Create a new widget that extends Composite. The widget should wrap a FlexTable. Use 3 cells on the same row. Add a Label to the center cell and provide get and set methods on your widget to get and set text to the internal label. The label will resize automatically forcing the table cell to grow bigger. Add the appropriate handlers to the FlexTable widget. I suggest you use those events to add or remove styles to the appropriate cells and define the background images in a stylesheet.
You could create your own widget. This requires that you generate your own HTML etc. which may not immediately work in every browser. I recommend trying option 1 or 2 first.
You might be able to get away with using only one sprite image if you can limit the maximum width of your buttons. We wrote a CssButton class (extends Button) as part of the GWT Portlets framework that uses a single background image sprite to create rounded buttons. The code uses CSS clipping to select the correct background image from the sprite based on the width of the button.
The main advantages are that it extends the normal GWT Button and uses only a single BUTTON element in the DOM (lightweight). The disadvantage is that the maximum width of the button is limited to the widest button image in the sprite.
It also handles rollover and click effects all using the same sprite.
The code is in the GWT Portlets repository if you want to look further.