Want to record the two ways of positioning in the Stack layout.
//... omit extraneous code...
child: new Column(
children: <Widget>[
new SizedBox(height: 20.0),
new Stack(
Alignment: const FractionalOffset(0.9, 0.1), // Method 1
children: <Widget>[
new Image(
image: new AssetImage("assets/images/illustration_11.jpg"),
width: 300.0,
height: 200.0,
fit: BoxFit.cover,
),
new Opacity(
opacity: 0.8,
child: new Image(
image: new AssetImage("assets/images/illustration_12.jpg"),
width: 200.0,
height: 150.0,
fit: BoxFit.cover,
),
),
new GestureDetector(
onTap: () {
Fluttertoast.showToast (msg: "Share it");
},
child: new Icon(Icons.share, color: Colors.white),
),
],
),
new SizedBox(height: 20.0),
new Stack(
children: <Widget>[
new Image(
image: new AssetImage("assets/images/illustration_11.jpg"),
width: 300.0,
height: 200.0,
fit: BoxFit.cover,
),
New Positioned (/ / method two
right: 15.0,
top: 15.0,
child: new Icon(
Icons.share,
color: Colors.white,
),
),
],
)
],
),
//... omit extraneous code...
Use alignment with FractionalOffset: For the parameters of the FractionalOffset, I understand this: the equivalent ratio, the first one represents the horizontal weight, the second represents the vertical weight, the horizontal 0.9 represents the position of nine out of the horizontal, and the vertical 0.1 represents the vertical To one tenth of the position
Use the positioning component Positioned, top, right, buttom, left, directly represent the distance from the direction
Layer layout (stack) and Web Absolute positioning,Android middle FrameLayout The layout is similar, and the sub -module can determine its own position according to the position of the four corners of ...
This article mainly introduces the Stack, IndexedStack, and GridView controls in the Flutter layout. It introduces its layout behavior and usage scenarios in detail, and analyzes the source code. 1. S...
The combination of Stack and Positioned is used to achieve the following page layout effects: ...
Outline Stack components is a stacked arrangement, i.e., covering another component assembly, in order to cover dependschildrenPlaced in the order, such as on the image scene using add some text, so t...
Flutter Stack frame layout, lamination stacking Image stacked together two...
Stacked layout Stack, Positioned The stacked layout is similar to the absolute positioning in the Web and the Frame layout in Android. The child component can determine its position according to the p...
Stack represents the meaning of heap, we can use Stack or combine Align or Positond to achieve positioning layout Stack common attributes: Attributes Description alignment Configure the display positi...
Code example:...
Overview The Stack component is a stacked layout, that is, the component covers another component, and the order of coverage depends on thechildrenThe order of placement in the use scenario, such as a...
1. flex layout: Flex( direction: Axis.horizontal, //Horizontal reverse (direction cannot be empty) direction: Axis.vertical, //Vertical reverse Expanded( flex: 1 ) ) The implementation code is as foll...