Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //a statefull widget receive it values directly from the constructor,
- //from doc : A widget that does not require mutable state.
- class MyWidget extends StateFullWidget {
- //final == val (kotlin)
- final _myText = "";
- //default constructor, braces {} means the arguments can be provided in any order
- //_myText = text means _myText is initialised with the `text` value automatically
- MyWidget({this.key, @required String text}) : _myText = text;
- @override
- Widget build(BuildContext context) { //BuildContext => represents the parent widget
- var imageUrl = "www.mywebsites.com/${_myText}";
- return GestureDetector( //add user interraction
- onTap: () { //lambdas without parameter, like kotlin
- print("tapped");
- },
- child: Row( //Row == Vertical LinearLayout
- children: [
- //download then display an image
- Image.network(imageUrl),
- Text(_myText)
- ]
- )
- )
- }
- }
Add Comment
Please, Sign In to add comment