text
stringlengths 1
372
|
|---|
width: 300,
|
child: FlutterLogo(),
|
),
|
);
|
}
|
}
|
<code_end>
|
<topic_end>
|
<topic_start>
|
how do i add swipe animation to cards?
|
in react native, either the PanResponder or
|
third-party libraries are used for swipe animation.
|
in flutter, to add a swipe animation, use the
|
dismissible widget and nest the child widgets.
|
<code_start>
|
return dismissible(
|
key: Key(widget.key.toString()),
|
onDismissed: (dismissdirection) {
|
cards.removeLast();
|
},
|
child: container(
|
//...
|
),
|
);
|
<code_end>
|
<topic_end>
|
<topic_start>
|
react native and flutter widget equivalent components
|
the following table lists commonly-used react native
|
components mapped to the corresponding flutter widget
|
and common widget properties.
|
<topic_end>
|
<topic_start>
|
flutter for web developers
|
this page is for users who are familiar with the HTML
|
and CSS syntax for arranging components of an application’s UI.
|
it maps HTML/CSS code snippets to their Flutter/Dart code equivalents.
|
flutter is a framework for building cross-platform applications
|
that uses the dart programming language.
|
to understand some differences between programming with dart
|
and programming with javascript,
|
see learning dart as a JavaScript developer.
|
one of the fundamental differences between
|
designing a web layout and a flutter layout,
|
is learning how constraints work,
|
and how widgets are sized and positioned.
|
to learn more, see understanding constraints.
|
the examples assume:
|
the HTML document starts with <!doctype html>, and the CSS box model
|
for all HTML elements is set to border-box,
|
for consistency with the flutter model.
|
in flutter, the default styling of the ‘lorem ipsum’ text
|
is defined by the bold24Roboto variable as follows,
|
to keep the syntax simple:
|
<code_start>
|
TextStyle bold24Roboto = const TextStyle(
|
color: colors.white,
|
fontSize: 24,
|
fontWeight: FontWeight.bold,
|
);
|
<code_end>
|
how is react-style, or declarative, programming different from the
|
traditional imperative style?
|
for a comparison, see introduction to declarative UI.
|
<topic_end>
|
<topic_start>
|
performing basic layout operations
|
the following examples show how to perform the most common UI layout tasks.
|
<topic_end>
|
<topic_start>
|
styling and aligning text
|
font style, size, and other text attributes that CSS
|
handles with the font and color properties are individual
|
properties of a TextStyle child of a text widget.
|
for text-align property in CSS that is used for aligning text,
|
there is a textAlign property of a text widget.
|
in both HTML and flutter, child elements or widgets
|
are anchored at the top left, by default.
|
<topic_end>
|
<topic_start>
|
setting background color
|
in flutter, you set the background color using the color property
|
or the decoration property of a container.
|
however, you cannot supply both, since it would potentially
|
result in the decoration drawing over the background color.
|
the color property should be preferred
|
when the background is a simple color.
|
for other cases, such as gradients or images,
|
use the decoration property.
|
the CSS examples use the hex color equivalents to the material color palette.
|
<topic_end>
|
<topic_start>
|
centering components
|
a center widget centers its child both horizontally
|
and vertically.
|
to accomplish a similar effect in CSS, the parent element uses either a flex
|
or table-cell display behavior. the examples on this page show the flex
|
behavior.
|
<topic_end>
|
<topic_start>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.