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'; | |
class HeaderSlash extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => CustomPaint( | |
painter: _HeaderSlashCustom(),//The container shape | |
child: Container( | |
height: double.infinity, | |
width: double.infinity, | |
), |
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'; | |
class WaveHeader extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => CustomPaint( | |
painter: _WaveHeaderCustom(), //The container shape | |
child: Container( | |
height: double.infinity, | |
width: double.infinity, | |
), |
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 the same values and If you want to update any value you can put it | |
Task copyWith( | |
{String id, | |
String initDate, | |
String endDate, | |
String task, | |
bool isComplete}) => | |
Task( | |
id: id ?? this.id, | |
initDate: initDate ?? this.initDate, |
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 CustomPaint Wiget | |
Container( | |
padding: EdgeInsets.all(5), | |
width: 300, | |
height: 300, | |
//This class should be used | |
child: CustomPaint( | |
painter: _CustomPaint(porcentage), | |
), | |
); |
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
CupertinoAlertDialog( | |
title: Text(title), | |
content: Text(description), | |
actions: [ | |
CupertinoDialogAction( | |
child: Text('No'), | |
onPressed: onNegativePressed, | |
), | |
CupertinoDialogAction( | |
child: Text('Yes'), |
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
AlertDialog( | |
title: Text(title), | |
content: Text(description), | |
elevation: 16.0, | |
actions: [ | |
FlatButton(onPressed: onNegativePressed, child: Text('No')), | |
FlatButton(onPressed: onAffirmativePressed, child: Text('Yes')), | |
], | |
); |
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
class MyHomePage extends StatefulWidget { | |
@override | |
MyHomePageState createState() { | |
return new MyHomePageState(); | |
} | |
} | |
class MyHomePageState extends State<MyHomePage> { | |
final _text = TextEditingController(); | |
bool _validate = false; |
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
//With Map function the Iterable can be changed to another type or another value | |
var numbersByTwo = [1, -2, 3, 42].map((number) => number * 2); | |
print('Numbers: $numbersByTwo.'); |
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'; | |
//Example: https://stackoverflow.com/questions/26748605/how-to-store-function-as-class-member-variable?rq= | |
//In dart the functions can be Objects | |
/// | |
typedef Widget BuilderState( | |
BuildContext context, void Function(void Function()) setState); | |
double getScreenWidth(BuildContext context) => | |
MediaQuery.of(context).size.width; |
OlderNewer