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
extension NumberParsing on String { | |
int parseInt() { | |
return int.parse(this); | |
} | |
double parseDouble() { | |
return double.parse(this); | |
} | |
} |
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
Text("Plain TextField:$_field1text"), | |
TextField( | |
onChanged: (text) { | |
setState(() { | |
_field1text = text; | |
}); | |
}, | |
) |
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
TextField( | |
cursorColor: Colors.red, | |
cursorWidth: 4.0, | |
maxLength: 10, | |
obscureText: true, | |
onChanged: (text) { | |
print(text); | |
}, | |
onSubmitted: (text) { | |
print('Submitted:$text'); |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('DataTable Demo'), | |
), | |
body: SingleChildScrollView( | |
scrollDirection: Axis.horizontal, | |
child: SingleChildScrollView( | |
child: _getDataTable(), |
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
List<String> csvRows; | |
List<String> csvHeadingRow; | |
@override | |
void initState() { | |
super.initState(); | |
List<String> csvSplit = widget.csvString.split('\n'); | |
csvHeadingRow = csvSplit[0].split(','); | |
csvSplit.removeAt(0); | |
csvRows = csvSplit; |
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
DataTable( | |
columns: [ | |
DataColumn(label: Text('A')), | |
DataColumn(label: Text('B')), | |
], | |
rows: [ | |
DataRow( | |
cells: [ | |
DataCell(Text('A1')), | |
DataCell(Text('B1')), |
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
DragTarget( | |
builder: (context, List<FlutterLogoColor> candidateData, rejectedData) { | |
return Container( | |
height: 50.0, | |
width: 50.0, | |
decoration: BoxDecoration( | |
color: Colors.yellow[600], | |
shape: BoxShape.circle | |
), | |
child: Icon(Icons.delete, size: 40, color: Colors.white70,), |
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
Draggable( | |
child: FlutterLogo(size: 50.0, colors: Colors.red,), | |
feedback: FlutterLogo(size: 50.0, colors: Colors.red,), | |
childWhenDragging: FlutterLogo(colors: Colors.blueGrey, size: 50.0,), | |
data: FlutterLogoColor.red, | |
) |
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 future_dowhile() { | |
final nums = [1, 2, 3, 4, 5]; | |
var sum = 0; | |
var count = 0; | |
Future.doWhile(() { | |
print('count:$count'); | |
if (count == nums.length) { | |
return false; | |
} else { |
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 future_wait(String url1, String url2) { | |
Future.wait([ | |
http.get(url1), | |
http.get(url2), | |
Future.error('Future.error()'), | |
], | |
cleanUp: (value) { print('CleanUp() : ${value?.statusCode}'); } | |
).then((value) { | |
for (var f in value) { | |
print('statusCode: ${f?.statusCode}'); |
NewerOlder