text stringlengths 1 474 |
|---|
duration: const Duration(milliseconds: 3000), |
vsync: this, |
); |
final CurvedAnimation curve = CurvedAnimation( |
parent: controller, |
curve: Curves.easeIn, |
); |
animation = Tween(begin: 0.0, end: 1.0).animate(curve); |
controller.forward(); |
} |
@override |
void dispose() { |
controller.dispose(); |
super.dispose(); |
} |
@override |
Widget build(BuildContext context) { |
return FadeTransition( |
opacity: animation, |
child: const SizedBox( |
height: 300, |
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.