How To Stack Two Icons One On Top Of The Other?
I have two icons in a stack. I want one to hide the other, but instead it's semi-transparent and the other is shown behind it.
This is the code:
Stack( children: [ Container(child: Icon(Icons.account_circle_rounded), padding: EdgeInsets.only(left: 10),), Container(child: Icon(Icons.account_circle_rounded), padding: EdgeInsets.only(left: 20),), ], )
Icons are more like SVG, use vector to draw shape. There are some empty spaces inside the icon to draw the path, and we can see the background though this. Also, it contains padding around it, You can use your assets to draw the UI.
We can wrap with another
ColoredBox to hide the background icon, but it will get extra padding from
This snippet shows basic level structure.
SizedBox( height: 24, width: 24 * 1.7, child: Stack( alignment: Alignment.center, children: [ Align( alignment: Alignment.centerLeft, child: Container( child: const Icon( Icons.account_circle_rounded, ), decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), ), ), Align( alignment: Alignment.centerRight, child: Container( child: const Icon( Icons.account_circle_sharp, ), decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), ), ), ], ), ),
Widget renders bottom to top.
- → How do you create a 12 or 24 mnemonics code for multiple cryptocurrencies (ETH, BTC and so on..)
- → Flutter: input text field don't work properly in a simple example..... where am I wrong?
- → Can I customize the code formatting of Dart code in Atom?
- → Is it possible to develop iOS apps with Flutter on a Linux virtual machine?
- → Display SnackBar in Flutter
- → JSON ObjectMapper in Flutter
- → Material flutter app source code
- → TabBarSelection No such method error
- → How do I set the animation color of a LinearProgressIndicator?
- → Add different routes/screens to Flutter app
- → Is there a way to get the size of an existing widget?
- → How to share a file using flutter
- → Is there an easy way to find particular text built from RichText in a Flutter test?