-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
234 additions
and
53 deletions.
There are no files selected for viewing
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class Dividend { | ||
|
||
final String _fantasyName; | ||
final String _ticker; | ||
final String _type; | ||
final String _date; | ||
final String currency; | ||
final String _netIncome; | ||
|
||
final Map<String, IconData> _assetTypeIcons= { | ||
"share": Icons.library_books, | ||
"reit": Icons.location_city | ||
}; | ||
|
||
Dividend(this._fantasyName, this._ticker, this._type, this._date, this._netIncome, {this.currency="R\$"}); | ||
|
||
String get name => _fantasyName + " (" + _ticker + ")"; | ||
IconData get icon => _assetTypeIcons[this._type]; | ||
String get date => _date; | ||
String get income => "$currency$_netIncome"; | ||
} |
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
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
final biggerFont = const TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold); | ||
final normalFont = const TextStyle(fontSize: 18.0); | ||
final smallerFont = const TextStyle(fontSize: 14.0, color: Colors.grey); | ||
final buttonFont = const TextStyle(fontSize: 18.0, color: Colors.white); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:app/utils/theme.dart'; | ||
|
||
import '../models/dividend.dart'; | ||
|
||
class DividendsState extends State<Dividends> { | ||
|
||
final _provisioned = <Dividend>[ | ||
Dividend("Energias do Brasil", "ENBR3", "share", "28/06/2020", "31,30"), | ||
Dividend("KINEA RENDA IMOBILIÁRIA FDO INV IMOB", "KNRI11", "reit", "20/06/2020", "25,10"), | ||
Dividend("Sinqia", "SQIA3", "share", "17/06/2020", "08,60") | ||
]; | ||
|
||
final _credited = <Dividend>[ | ||
Dividend("Itaúsa", "ITSA4", "share", "10/06/2020", "10,20"), | ||
Dividend("Fleury", "FLRY3", "share", "08/06/2020", "4,20"), | ||
Dividend("B3", "B3SA3", "share", "02/06/2020", "15,50"), | ||
Dividend("HSI MALL FDO INV IMOB", "HSML11", "reit", "01/06/2020", "20,60") | ||
]; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return _buildDividends(); | ||
} | ||
|
||
Widget _buildDividends() { | ||
return ListView.builder( | ||
padding: const EdgeInsets.all(15), | ||
itemBuilder: (context, i) { | ||
if (i.isOdd) return Divider(); | ||
int index = i ~/ 2; | ||
|
||
if (index == 0) return _buildTitle("Provisionado"); | ||
index -= 1; | ||
|
||
if (index < _provisioned.length) return _buildRow(_provisioned[index]); | ||
index -= _provisioned.length; | ||
|
||
if (index == 0) return _buildTitle("Creditado"); | ||
index -= 1; | ||
|
||
if (index < _credited.length) return _buildRow(_credited[index]); | ||
|
||
return null; | ||
}); | ||
} | ||
|
||
Widget _buildTitle(text) { | ||
return ListTile( | ||
title: Text( | ||
text, | ||
style: biggerFont | ||
) | ||
); | ||
} | ||
|
||
Widget _buildRow(Dividend dividend) { | ||
return ListTile( | ||
title: Text( | ||
dividend.name, | ||
style: biggerFont, | ||
), | ||
subtitle: Text( | ||
dividend.date, | ||
style: smallerFont, | ||
), | ||
leading: Icon(dividend.icon), | ||
trailing: Text( | ||
dividend.income, | ||
style: normalFont, | ||
) | ||
); | ||
} | ||
} | ||
|
||
class Dividends extends StatefulWidget { | ||
@override | ||
DividendsState createState() => DividendsState(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:app/views/portfolio.dart'; | ||
import 'package:app/views/dividends.dart'; | ||
|
||
class HomeState extends State<Home> { | ||
int _currentIndex = 0; | ||
final List<Widget> _children = [ | ||
Portfolio(), | ||
Dividends() | ||
]; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Bezunca Investimentos'), | ||
), | ||
body: _children[_currentIndex], | ||
bottomNavigationBar: BottomNavigationBar( | ||
onTap: onTabTapped, | ||
currentIndex: _currentIndex, | ||
items: [ | ||
BottomNavigationBarItem( | ||
icon: new Icon(Icons.account_balance_wallet), | ||
title: new Text('Portfolio'), | ||
), | ||
BottomNavigationBarItem( | ||
icon: new Icon(Icons.attach_money), | ||
title: new Text('Proventos'), | ||
) | ||
], | ||
), | ||
); | ||
} | ||
|
||
void onTabTapped(int index) { | ||
setState(() { | ||
_currentIndex = index; | ||
}); | ||
} | ||
} | ||
|
||
class Home extends StatefulWidget { | ||
@override | ||
State<StatefulWidget> createState() { | ||
return HomeState(); | ||
} | ||
} |
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
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
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
Oops, something went wrong.