Add animations and details page screen
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AddPageTransition extends PageRouteBuilder {
|
||||||
|
final Widget page;
|
||||||
|
final Widget background;
|
||||||
|
|
||||||
|
AddPageTransition({this.page, this.background})
|
||||||
|
: super(
|
||||||
|
transitionDuration: Duration(microseconds: 1),
|
||||||
|
pageBuilder: (context, animation1, animation2) => page,
|
||||||
|
transitionsBuilder: (context, animation1, animation, child) =>
|
||||||
|
Stack(
|
||||||
|
children: <Widget>[background, child],
|
||||||
|
));
|
||||||
|
}
|
||||||
+30
-4
@@ -3,16 +3,42 @@ import 'dart:math';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:charts_flutter/flutter.dart';
|
import 'package:charts_flutter/flutter.dart';
|
||||||
|
|
||||||
class GraphWidget extends StatefulWidget {
|
class PieGraphWidget extends StatefulWidget {
|
||||||
final List<double> data;
|
final List<double> data;
|
||||||
|
|
||||||
const GraphWidget({Key key, this.data}) : super(key: key);
|
const PieGraphWidget({Key key, this.data}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_GraphWidgetState createState() => _GraphWidgetState();
|
_PieGraphWidgetState createState() => _PieGraphWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GraphWidgetState extends State<GraphWidget> {
|
class _PieGraphWidgetState extends State<PieGraphWidget> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<Series<double, num>> series = [
|
||||||
|
Series<double, int>(
|
||||||
|
id: 'Gasto',
|
||||||
|
domainFn: (value, index) => index,
|
||||||
|
measureFn: (value, _) => value,
|
||||||
|
data: widget.data,
|
||||||
|
strokeWidthPxFn: (_, __) => 4,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
return PieChart(series);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LinesGraphWidget extends StatefulWidget {
|
||||||
|
final List<double> data;
|
||||||
|
|
||||||
|
const LinesGraphWidget({Key key, this.data}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LinesGraphWidgetState createState() => _LinesGraphWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LinesGraphWidgetState extends State<LinesGraphWidget> {
|
||||||
_onSelectionChanged(SelectionModel model) {
|
_onSelectionChanged(SelectionModel model) {
|
||||||
final selectedDatum = model.selectedDatum;
|
final selectedDatum = model.selectedDatum;
|
||||||
|
|
||||||
|
|||||||
+14
-1
@@ -1,5 +1,7 @@
|
|||||||
|
import 'package:como_gasto/add_page_transition.dart';
|
||||||
import 'package:como_gasto/login_state.dart';
|
import 'package:como_gasto/login_state.dart';
|
||||||
import 'package:como_gasto/pages/add_page.dart';
|
import 'package:como_gasto/pages/add_page.dart';
|
||||||
|
import 'package:como_gasto/pages/details_page.dart';
|
||||||
import 'package:como_gasto/pages/home_page.dart';
|
import 'package:como_gasto/pages/home_page.dart';
|
||||||
import 'package:como_gasto/pages/login_page.dart';
|
import 'package:como_gasto/pages/login_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -17,6 +19,18 @@ class MyApp extends StatelessWidget {
|
|||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
|
onGenerateRoute: (settings) {
|
||||||
|
if (settings.name == '/details') {
|
||||||
|
DetailsParams params = settings.arguments;
|
||||||
|
return MaterialPageRoute(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return DetailsPage(
|
||||||
|
params: params ,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
routes: {
|
routes: {
|
||||||
'/': (BuildContext context) {
|
'/': (BuildContext context) {
|
||||||
var state = Provider.of<LoginState>(context);
|
var state = Provider.of<LoginState>(context);
|
||||||
@@ -26,7 +40,6 @@ class MyApp extends StatelessWidget {
|
|||||||
return LoginPage();
|
return LoginPage();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/add': (BuildContext contex) => AddPage(),
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
+29
-7
@@ -1,15 +1,23 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:como_gasto/graph_widget.dart';
|
import 'package:como_gasto/graph_widget.dart';
|
||||||
|
import 'package:como_gasto/pages/details_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
|
enum GraphType {
|
||||||
|
LINES,
|
||||||
|
PIE,
|
||||||
|
}
|
||||||
|
|
||||||
class MonthWidget extends StatefulWidget {
|
class MonthWidget extends StatefulWidget {
|
||||||
final List<DocumentSnapshot> documents;
|
final List<DocumentSnapshot> documents;
|
||||||
final double total;
|
final double total;
|
||||||
final List<double> perDay;
|
final List<double> perDay;
|
||||||
final Map<String, double> categories;
|
final Map<String, double> categories;
|
||||||
|
final GraphType graphType;
|
||||||
|
final int month;
|
||||||
|
|
||||||
MonthWidget({Key key, this.documents, days})
|
MonthWidget({Key key, @required this.month, this.graphType, this.documents, days})
|
||||||
:
|
:
|
||||||
total = documents.map((doc) => doc['value'])
|
total = documents.map((doc) => doc['value'])
|
||||||
.fold(0.0, (a, b) => a + b),
|
.fold(0.0, (a, b) => a + b),
|
||||||
@@ -72,16 +80,30 @@ class _MonthWidgetState extends State<MonthWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _graph() {
|
Widget _graph() {
|
||||||
return Container(
|
if (widget.graphType == GraphType.LINES) {
|
||||||
height: 250.0,
|
return Container(
|
||||||
child: GraphWidget(
|
height: 250.0,
|
||||||
data: widget.perDay,
|
child: LinesGraphWidget(
|
||||||
),
|
data: widget.perDay,
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
var perCategory = widget.categories.keys.map((name) => widget.categories[name] / widget.total).toList();
|
||||||
|
return Container(
|
||||||
|
height: 250.0,
|
||||||
|
child: PieGraphWidget(
|
||||||
|
data: perCategory,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _item(IconData icon, String name, int percent, double value) {
|
Widget _item(IconData icon, String name, int percent, double value) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed("/details",
|
||||||
|
arguments: DetailsParams(name, widget.month));
|
||||||
|
},
|
||||||
leading: Icon(icon, size: 32.0,),
|
leading: Icon(icon, size: 32.0,),
|
||||||
title: Text(name,
|
title: Text(name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
+147
-61
@@ -7,51 +7,101 @@ import 'package:provider/provider.dart';
|
|||||||
import '../login_state.dart';
|
import '../login_state.dart';
|
||||||
|
|
||||||
class AddPage extends StatefulWidget {
|
class AddPage extends StatefulWidget {
|
||||||
|
final Rect buttonRect;
|
||||||
|
|
||||||
|
const AddPage({Key key, this.buttonRect}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_AddPageState createState() => _AddPageState();
|
_AddPageState createState() => _AddPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddPageState extends State<AddPage> {
|
class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
||||||
|
AnimationController _controller;
|
||||||
|
Animation _buttonAnimation;
|
||||||
|
Animation _pageAnimation;
|
||||||
|
|
||||||
String category;
|
String category;
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
_controller = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: Duration(milliseconds: 750),
|
||||||
|
);
|
||||||
|
|
||||||
|
_buttonAnimation = Tween<double>(begin: 0, end: 1.0).animate(
|
||||||
|
CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn)
|
||||||
|
);
|
||||||
|
|
||||||
|
_pageAnimation = Tween<double>(begin: -1, end: 1.0).animate(
|
||||||
|
CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn)
|
||||||
|
);
|
||||||
|
|
||||||
|
_controller.addListener(() {
|
||||||
|
print(_controller.value);
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
_controller.addStatusListener((status) {
|
||||||
|
if (status == AnimationStatus.dismissed) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_controller.forward();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
var h = MediaQuery.of(context).size.height;
|
||||||
appBar: AppBar(
|
return Stack(
|
||||||
automaticallyImplyLeading: false,
|
children: [
|
||||||
backgroundColor: Colors.transparent,
|
Transform.translate(
|
||||||
elevation: 0.0,
|
offset: Offset(0, h * (1 - _pageAnimation.value)),
|
||||||
title: Text(
|
child: Scaffold(
|
||||||
"Category",
|
appBar: AppBar(
|
||||||
style: TextStyle(
|
automaticallyImplyLeading: false,
|
||||||
color: Colors.grey,
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0.0,
|
||||||
|
title: Text(
|
||||||
|
"Category",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
centerTitle: false,
|
||||||
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
_controller.reverse();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: _body(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
_submit(),
|
||||||
actions: <Widget>[
|
],
|
||||||
IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.close,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: _body(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _body() {
|
Widget _body() {
|
||||||
|
var h = MediaQuery.of(context).size.height;
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_categorySelector(),
|
_categorySelector(),
|
||||||
_currentValue(),
|
_currentValue(),
|
||||||
_numpad(),
|
_numpad(),
|
||||||
_submit(),
|
SizedBox(
|
||||||
|
height: h - widget.buttonRect.top,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -169,45 +219,81 @@ class _AddPageState extends State<AddPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _submit() {
|
Widget _submit() {
|
||||||
return Builder(builder: (BuildContext context) {
|
if (_controller.value < 1) {
|
||||||
return Hero(
|
var buttonWidth = widget.buttonRect.right - widget.buttonRect.left;
|
||||||
tag: "add_button",
|
var w = MediaQuery.of(context).size.width;
|
||||||
child: Container(
|
|
||||||
height: 50.0,
|
return Positioned(
|
||||||
width: double.infinity,
|
left: widget.buttonRect.left * (1 - _buttonAnimation.value),
|
||||||
decoration: BoxDecoration(color: Colors.blueAccent),
|
//<-- Margin from left
|
||||||
child: MaterialButton(
|
right: (w - widget.buttonRect.right) * (1 - _buttonAnimation.value),
|
||||||
child: Text(
|
//<-- Margin from right
|
||||||
"Add expense",
|
top: widget.buttonRect.top,
|
||||||
style: TextStyle(
|
//<-- Margin from top
|
||||||
color: Colors.white,
|
bottom: (MediaQuery.of(context).size.height - widget.buttonRect.bottom) *
|
||||||
fontSize: 20.0,
|
(1 - _buttonAnimation.value),
|
||||||
|
//<-- Margin from bottom
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
//<-- Blue cirle
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
buttonWidth * (1 - _buttonAnimation.value)),
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
),
|
||||||
|
child: MaterialButton(
|
||||||
|
child: Text(
|
||||||
|
"Add expense",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20.0,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
|
||||||
var user = Provider.of<LoginState>(context).currentUser();
|
|
||||||
if (value > 0 && category != "") {
|
|
||||||
Firestore.instance
|
|
||||||
.collection('users')
|
|
||||||
.document(user.uid)
|
|
||||||
.collection('expenses')
|
|
||||||
.document()
|
|
||||||
.setData({
|
|
||||||
"category": category,
|
|
||||||
"value": value / 100.0,
|
|
||||||
"month": DateTime.now().month,
|
|
||||||
"day": DateTime.now().day,
|
|
||||||
});
|
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).showSnackBar(
|
|
||||||
SnackBar(content: Text("Select a value and a cagtegory")));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
} else {
|
||||||
|
return Positioned(
|
||||||
|
top: widget.buttonRect.top,
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Builder(builder: (BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(color: Colors.blueAccent),
|
||||||
|
child: MaterialButton(
|
||||||
|
child: Text(
|
||||||
|
"Add expense",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
var user = Provider.of<LoginState>(context).currentUser();
|
||||||
|
if (value > 0 && category != "") {
|
||||||
|
Firestore.instance
|
||||||
|
.collection('users')
|
||||||
|
.document(user.uid)
|
||||||
|
.collection('expenses')
|
||||||
|
.document()
|
||||||
|
.setData({
|
||||||
|
"category": category,
|
||||||
|
"value": value / 100.0,
|
||||||
|
"month": DateTime.now().month,
|
||||||
|
"day": DateTime.now().day,
|
||||||
|
});
|
||||||
|
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} else {
|
||||||
|
Scaffold.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text("Select a value and a cagtegory")));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../login_state.dart';
|
||||||
|
|
||||||
|
class DetailsParams {
|
||||||
|
final String categoryName;
|
||||||
|
final int month;
|
||||||
|
|
||||||
|
DetailsParams(this.categoryName, this.month);
|
||||||
|
}
|
||||||
|
|
||||||
|
class DetailsPage extends StatefulWidget {
|
||||||
|
final DetailsParams params;
|
||||||
|
|
||||||
|
const DetailsPage({Key key, this.params}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_DetailsPageState createState() => _DetailsPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DetailsPageState extends State<DetailsPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Consumer<LoginState>(
|
||||||
|
builder: (BuildContext context, LoginState state, Widget child) {
|
||||||
|
var user = Provider.of<LoginState>(context).currentUser();
|
||||||
|
var _query = Firestore.instance
|
||||||
|
.collection('users')
|
||||||
|
.document(user.uid)
|
||||||
|
.collection('expenses')
|
||||||
|
.where("month", isEqualTo: widget.params.month + 1)
|
||||||
|
.where("category", isEqualTo: widget.params.categoryName)
|
||||||
|
.snapshots();
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(widget.params.categoryName),
|
||||||
|
),
|
||||||
|
body: StreamBuilder<QuerySnapshot>(
|
||||||
|
stream: _query,
|
||||||
|
builder:
|
||||||
|
(BuildContext context, AsyncSnapshot<QuerySnapshot> data) {
|
||||||
|
if (data.hasData) {
|
||||||
|
return ListView.builder(
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
var document = data.data.documents[index];
|
||||||
|
|
||||||
|
return Dismissible(
|
||||||
|
key: Key(document.documentID),
|
||||||
|
onDismissed: (direction) {
|
||||||
|
Firestore.instance
|
||||||
|
.collection('users')
|
||||||
|
.document(user.uid)
|
||||||
|
.collection('expenses')
|
||||||
|
.document(document.documentID)
|
||||||
|
.delete();
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
leading: Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.calendar_today,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 8,
|
||||||
|
child: Text(
|
||||||
|
document["day"].toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
title: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.blueAccent.withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
"\$${document["value"]}",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 16.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: data.data.documents.length,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:como_gasto/add_page_transition.dart';
|
||||||
import 'package:como_gasto/month_widget.dart';
|
import 'package:como_gasto/month_widget.dart';
|
||||||
|
import 'package:como_gasto/pages/add_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:rect_getter/rect_getter.dart';
|
||||||
|
|
||||||
import '../login_state.dart';
|
import '../login_state.dart';
|
||||||
import '../utils.dart';
|
import '../utils.dart';
|
||||||
@@ -13,9 +16,13 @@ class HomePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _HomePageState extends State<HomePage> {
|
class _HomePageState extends State<HomePage> {
|
||||||
|
var globalKey = RectGetter.createGlobalKey();
|
||||||
|
Rect buttonRect;
|
||||||
|
|
||||||
PageController _controller;
|
PageController _controller;
|
||||||
int currentPage = DateTime.now().month - 1;
|
int currentPage = DateTime.now().month - 1;
|
||||||
Stream<QuerySnapshot> _query;
|
Stream<QuerySnapshot> _query;
|
||||||
|
GraphType currentType = GraphType.LINES;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -57,22 +64,44 @@ class _HomePageState extends State<HomePage> {
|
|||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_bottomAction(FontAwesomeIcons.history, () {}),
|
_bottomAction(FontAwesomeIcons.chartLine, () {
|
||||||
_bottomAction(FontAwesomeIcons.chartPie, () {}),
|
setState(() {
|
||||||
|
currentType = GraphType.LINES;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
_bottomAction(FontAwesomeIcons.chartPie, () {
|
||||||
|
setState(() {
|
||||||
|
currentType = GraphType.PIE;
|
||||||
|
});
|
||||||
|
}),
|
||||||
SizedBox(width: 48.0),
|
SizedBox(width: 48.0),
|
||||||
_bottomAction(FontAwesomeIcons.wallet, () {}),
|
_bottomAction(FontAwesomeIcons.wallet, () {}),
|
||||||
_bottomAction(Icons.settings, () {
|
_bottomAction(FontAwesomeIcons.signOutAlt, () {
|
||||||
Provider.of<LoginState>(context).logout();
|
Provider.of<LoginState>(context).logout();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: RectGetter(
|
||||||
child: Icon(Icons.add),
|
key: globalKey,
|
||||||
onPressed: () {
|
child: FloatingActionButton(
|
||||||
Navigator.of(context).pushNamed('/add');
|
child: Icon(Icons.add),
|
||||||
},
|
onPressed: () {
|
||||||
|
buttonRect = RectGetter.getRectFromKey(globalKey);
|
||||||
|
|
||||||
|
print(buttonRect);
|
||||||
|
|
||||||
|
var page = AddPageTransition(
|
||||||
|
background: widget,
|
||||||
|
page: AddPage(
|
||||||
|
buttonRect: buttonRect,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Navigator.of(context).push(page);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: _body(),
|
body: _body(),
|
||||||
);
|
);
|
||||||
@@ -91,6 +120,8 @@ class _HomePageState extends State<HomePage> {
|
|||||||
return MonthWidget(
|
return MonthWidget(
|
||||||
days: daysInMonth(currentPage + 1),
|
days: daysInMonth(currentPage + 1),
|
||||||
documents: data.data.documents,
|
documents: data.data.documents,
|
||||||
|
graphType: currentType,
|
||||||
|
month: currentPage,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.2"
|
||||||
|
rect_getter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: rect_getter
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ dependencies:
|
|||||||
google_sign_in: ^4.0.1+3
|
google_sign_in: ^4.0.1+3
|
||||||
firebase_auth: ^0.11.1
|
firebase_auth: ^0.11.1
|
||||||
shared_preferences: ^0.5.2
|
shared_preferences: ^0.5.2
|
||||||
|
rect_getter: ^0.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user