text
stringlengths 1
372
|
|---|
setting container width
|
to specify the width of a container
|
widget, use its width property.
|
this is a fixed width, unlike the CSS max-width property
|
that adjusts the container width up to a maximum value.
|
to mimic that effect in flutter,
|
use the constraints property of the container.
|
create a new BoxConstraints widget with a minWidth or maxWidth.
|
for nested containers, if the parent’s width is less than the child’s width,
|
the child container sizes itself to match the parent.
|
<topic_end>
|
<topic_start>
|
manipulating position and size
|
the following examples show how to perform more complex operations
|
on widget position, size, and background.
|
<topic_end>
|
<topic_start>
|
setting absolute position
|
by default, widgets are positioned relative to their parent.
|
to specify an absolute position for a widget as x-y coordinates,
|
nest it in a positioned widget that is,
|
in turn, nested in a stack widget.
|
<topic_end>
|
<topic_start>
|
rotating components
|
to rotate a widget, nest it in a transform widget.
|
use the transform widget’s alignment and origin properties
|
to specify the transform origin (fulcrum) in relative and absolute terms,
|
respectively.
|
for a simple 2d rotation, in which the widget is rotated on the z axis,
|
create a new matrix4 identity object
|
and use its rotateZ() method to specify the rotation factor
|
using radians (degrees × π / 180).
|
<topic_end>
|
<topic_start>
|
scaling components
|
to scale a widget up or down, nest it in a transform widget.
|
use the transform widget’s alignment and origin properties
|
to specify the transform origin (fulcrum) in relative or absolute terms,
|
respectively.
|
for a simple scaling operation along the x-axis,
|
create a new matrix4 identity object
|
and use its scale() method to specify the scaling factor.
|
when you scale a parent widget,
|
its child widgets are scaled accordingly.
|
<topic_end>
|
<topic_start>
|
applying a linear gradient
|
to apply a linear gradient to a widget’s background,
|
nest it in a container widget.
|
then use the container widget’s decoration property to create a
|
BoxDecoration object, and use BoxDecoration’s gradient
|
property to transform the background fill.
|
the gradient “angle” is based on the alignment (x, y) values:
|
<topic_end>
|
<topic_start>
|
vertical gradient
|
<topic_end>
|
<topic_start>
|
horizontal gradient
|
<topic_end>
|
<topic_start>
|
manipulating shapes
|
the following examples show how to make and customize shapes.
|
<topic_end>
|
<topic_start>
|
rounding corners
|
to round the corners of a rectangular shape,
|
use the borderRadius property of a BoxDecoration object.
|
create a new BorderRadius
|
object that specifies the radius for rounding each corner.
|
<topic_end>
|
<topic_start>
|
adding box shadows
|
in CSS you can specify shadow offset and blur in shorthand,
|
using the box-shadow property. this example shows two box shadows,
|
with properties:
|
in flutter, each property and value is specified separately.
|
use the boxShadow property of BoxDecoration to create a list of
|
BoxShadow widgets. you can define one or multiple
|
BoxShadow widgets, which can be stacked
|
to customize the shadow depth, color, and so on.
|
<topic_end>
|
<topic_start>
|
making circles and ellipses
|
making a circle in CSS requires a workaround of applying a
|
border-radius of 50% to all four sides of a rectangle,
|
though there are basic shapes.
|
while this approach is supported
|
with the borderRadius property of BoxDecoration,
|
flutter provides a shape property
|
with BoxShape enum for this purpose.
|
<topic_end>
|
<topic_start>
|
manipulating text
|
the following examples show how to specify fonts and other
|
text attributes. they also show how to transform text strings,
|
customize spacing, and create excerpts.
|
<topic_end>
|
<topic_start>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.