Save the year in the database

We will need it later
This commit is contained in:
Ricardo Markiewicz
2019-07-02 09:50:56 -03:00
parent ffbec2acfd
commit 5b3358ca6f
2 changed files with 35 additions and 34 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+35 -34
View File
@@ -33,12 +33,10 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
); );
_buttonAnimation = Tween<double>(begin: 0, end: 1.0).animate( _buttonAnimation = Tween<double>(begin: 0, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn) CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn));
);
_pageAnimation = Tween<double>(begin: -1, end: 1.0).animate( _pageAnimation = Tween<double>(begin: -1, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn) CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn));
);
_controller.addListener(() { _controller.addListener(() {
print(_controller.value); print(_controller.value);
@@ -220,38 +218,39 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
Widget _submit() { Widget _submit() {
if (_controller.value < 1) { if (_controller.value < 1) {
var buttonWidth = widget.buttonRect.right - widget.buttonRect.left; var buttonWidth = widget.buttonRect.right - widget.buttonRect.left;
var w = MediaQuery.of(context).size.width; var w = MediaQuery.of(context).size.width;
return Positioned( return Positioned(
left: widget.buttonRect.left * (1 - _buttonAnimation.value), left: widget.buttonRect.left * (1 - _buttonAnimation.value),
//<-- Margin from left //<-- Margin from left
right: (w - widget.buttonRect.right) * (1 - _buttonAnimation.value), right: (w - widget.buttonRect.right) * (1 - _buttonAnimation.value),
//<-- Margin from right //<-- Margin from right
top: widget.buttonRect.top, top: widget.buttonRect.top,
//<-- Margin from top //<-- Margin from top
bottom: (MediaQuery.of(context).size.height - widget.buttonRect.bottom) * bottom:
(1 - _buttonAnimation.value), (MediaQuery.of(context).size.height - widget.buttonRect.bottom) *
//<-- Margin from bottom (1 - _buttonAnimation.value),
child: Container( //<-- Margin from bottom
width: double.infinity, child: Container(
//<-- Blue cirle width: double.infinity,
decoration: BoxDecoration( //<-- Blue cirle
borderRadius: BorderRadius.circular( decoration: BoxDecoration(
buttonWidth * (1 - _buttonAnimation.value)), borderRadius: BorderRadius.circular(
color: Colors.blueAccent, buttonWidth * (1 - _buttonAnimation.value)),
), color: Colors.blueAccent,
child: MaterialButton( ),
child: Text( child: MaterialButton(
"Add expense", child: Text(
style: TextStyle( "Add expense",
color: Colors.white, style: TextStyle(
fontSize: 20.0, color: Colors.white,
), fontSize: 20.0,
), ),
), ),
), ),
); ),
);
} else { } else {
return Positioned( return Positioned(
top: widget.buttonRect.top, top: widget.buttonRect.top,
@@ -270,6 +269,7 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
), ),
), ),
onPressed: () { onPressed: () {
var today = DateTime.now();
var user = Provider.of<LoginState>(context).currentUser(); var user = Provider.of<LoginState>(context).currentUser();
if (value > 0 && category != "") { if (value > 0 && category != "") {
Firestore.instance Firestore.instance
@@ -280,8 +280,9 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
.setData({ .setData({
"category": category, "category": category,
"value": value / 100.0, "value": value / 100.0,
"month": DateTime.now().month, "month": today.month,
"day": DateTime.now().day, "day": today.day,
"year": today.year,
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();