Comparing Flutter to what it might look like in Kotlin
| /** | |
| * This is a quick proof of concept to illustrate how the principles of Kotlin/Anko could be used to make Flutter | |
| * more designer-friendly. | |
| * | |
| * @see Single Expression Functions (https://kotlinlang.org/docs/reference/functions.html#single-expression-functions) | |
| * @see Groovy-Style Builders (https://kotlinlang.org/docs/reference/type-safe-builders.html) | |
| * @see Extension Functions/Properties (https://kotlinlang.org/docs/reference/extensions.html#extension-properties) | |
| * @see Anko Layouts (https://github.com/Kotlin/anko#anko-layouts-wiki) | |
| */ | |
| class TutorialHome : StatelessWidget { | |
| override | |
| fun build(context: BuildContext) = scaffold { | |
| appBar = appBar { | |
| leading = iconButton { | |
| iconImage = Icons.menu | |
| tooltip = "Navigation menu" | |
| } | |
| titleText = "Example title" | |
| actions = [ // based on https://twitter.com/abreslav/status/867714627060322305 | |
| iconButton { | |
| iconImage = Icons.search | |
| tooltip = "Search" | |
| } | |
| ] | |
| } | |
| body = center { | |
| // Remember: This is a fully functional programming environment. You can execute any code you can think of. | |
| childText = "Hello ${MyApp.users.me.fullName.split(" ").first}"! | |
| } | |
| floatingActionButton = fab { | |
| tooltip = "Add" | |
| childImage = Icons.add | |
| } | |
| } | |
| } |
| class TutorialHome extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| // Scafold is a layout for the major material design widgets. | |
| return new Scaffold( | |
| appBar: new AppBar( | |
| leading: new IconButton( | |
| icon: new Icon(Icons.menu), | |
| tooltip: 'Navigation menu', | |
| onPressed: null, | |
| ), | |
| title: new Text('Example title'), | |
| actions: <Widget>[ | |
| new IconButton( | |
| icon: new Icon(Icons.search), | |
| tooltip: 'Search', | |
| onPressed: null, | |
| ), | |
| ], | |
| ), | |
| // body is the majority of the screen. | |
| body: new Center( | |
| child: new Text('Hello, world!'), | |
| ), | |
| floatingActionButton: new FloatingActionButton( | |
| tooltip: 'Add', // used by assistive technologies | |
| child: new Icon(Icons.add), | |
| onPressed: null, | |
| ), | |
| ); | |
| } | |
| } |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
gaara87
commented
Oct 1, 2017
|
kotlin sure does look better |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
IgorGanapolsky
Nov 17, 2017
Is it worthwhile to learn Flutter? Or just sticking to Kotlin is a sure bet for the next decade.
IgorGanapolsky
commented
Nov 17, 2017
|
Is it worthwhile to learn Flutter? Or just sticking to Kotlin is a sure bet for the next decade. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
dron247
Nov 23, 2017
@IgorGanapolsky флаттер - это немного про другое, это ненативный гуй абстрагированный от платформы в первую очередь, рисует уи на предоставленном контексте вполне кроссплатформенно и главное быстро, как в играх подход в целом
dron247
commented
Nov 23, 2017
|
@IgorGanapolsky флаттер - это немного про другое, это ненативный гуй абстрагированный от платформы в первую очередь, рисует уи на предоставленном контексте вполне кроссплатформенно и главное быстро, как в играх подход в целом |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
raveesh-me
commented
Dec 17, 2017
|
IMHO both are much better than JAVA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kotlin sure does look better