This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# edit $HOME/.bash_profile or $HOME/.bashrc. | |
# macOS Catalina uses the Z shell by default, so edit $HOME/.zshrc | |
# source $HOME/.<rc file> to refresh the current window | |
# Verify that the flutter/bin directory is now in your PATH by running: echo $PATH | |
# Verify that the flutter command is available by running: which flutter | |
# iOS setup | |
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer | |
sudo xcodebuild -runFirstLaunch | |
open -a Simulator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return: padding: const EdgeInsets.all(8.0), | |
child: Table( | |
columnWidths: {0: IntrinsicColumnWidth()}, | |
defaultVerticalAlignment: TableCellVerticalAlignment.middle, | |
children: [ | |
TableRow( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Icon( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
ui.platformViewRegistry.registerViewFactory( | |
'hello-world-html', | |
(int viewId) => IFrameElement() | |
..width = '640' | |
..height = '360' | |
..src = 'https://www.youtube.com/embed/IyFZznAk69U' | |
..style.border = 'none'); | |
runApp(Directionality( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) | |
.then((_) { | |
runApp(new MyApp()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MaterialApp( | |
home: MyApp(), | |
)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to view current channel | |
flutter channel | |
# Now with Flutter 1.9 | |
flutter channel master | |
flutter upgrade | |
flutter config --enable-web | |
cd <into project directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//play loop infinite | |
Image.network('https://example.com/animated-image.gif') | |
// | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(new MyApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//========================= | |
//Use toSet and then toList | |
var ids = [1, 4, 4, 4, 5, 6, 6]; | |
var distinctIds = ids.toSet().toList(); //[1, 4, 5, 6] | |
//========================= | |
isEven(x) => x % 2 == 0; | |
main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: App(), |
OlderNewer