From ae0f8515aa6a0a84ca6124506ca538b523b32fb4 Mon Sep 17 00:00:00 2001 From: AYM1607 Date: Tue, 12 Mar 2019 21:23:35 -0600 Subject: [PATCH] Created and added extra animation to replace material progress indicator --- assets/animations/loading_animation.flr | Bin 0 -> 1110 bytes .../animations/loading_animation_looped.flr | Bin 0 -> 1110 bytes lib/src/screens/home_screen.dart | 21 +++++++++++++++++- lib/src/widgets/loading_indicator.dart | 16 +++++++++++++ pubspec.yaml | 2 ++ 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 assets/animations/loading_animation.flr create mode 100644 assets/animations/loading_animation_looped.flr create mode 100644 lib/src/widgets/loading_indicator.dart diff --git a/assets/animations/loading_animation.flr b/assets/animations/loading_animation.flr new file mode 100644 index 0000000000000000000000000000000000000000..30ff4107c0d6c2c0e916cbe710fa203a6a006a4c GIT binary patch literal 1110 zcma)5O=uHQ5T3XF$&!nWMv;1{f5lvCP|$;E-ewbvLb0h}5xlgeP17_qAuSXXF^3{W zL2^@2OQcrf4-yrvO-gA84?$8WA}EL<%}EqIsMtafocFeyrqY8S%)YlX-^_gP&2C$} z=j_Ry05Ec@7Jxy_LyJo9p4ez_q$k!#+jVq!0p`h^3rqR-d6vy&+@=A z4N{v;s4fYNZQm3W^^<(zO-2JqbJ%g6DkgY$uft=|4!ev^Fm(^ZPiJ-EWvS3341dq+ zsn8TT#rh1xEps}2dGeydg2eFxss|EA%JNJR5A}@exj+%S^EdR5>IxRWjp&e`DPV&u zDp}Cr8b;V}mn~VM971jOoz}D}Rv_mP0^HYNIZG_(I4LH`E>4XiBrH8v#Kg-kd`(@_ zZ+)1WC}K1jL`biGM*oSZWWhwsEBqR`W2D^L{TPomPhzn29M5-7V(!co+RJwl)PW>g z2MpGL7+M{fHxiD-6xvi@YV{rhP5(hv%S=qx@{1NRwzlwK)Mc}EYM_w229#O~SSesY zGz35YGuQef=YHRDg^TZHpG1i(rK@|mx_3M)M6DGr@kZ^4_o&2AE;A|UTDfSKU)DzE zZ?3djKe&w!aUQsNnFzPNOL>7c&IEHzqHL7;SAb7K(Y6$DPQs#XDL}T!tJ;WYY2SJKRrOIoFfF`U$?UG^+umIPADV72~|KyU}CN4!ev^FnJ$C&t`PtWyyiZ82X;p zlLM3F6zg*gHO=Yp<>|{J3*yJKs2+$LDXY^tJk&L&F9&kinYpQdRM#-~ZCHoYbQWt} z5y^sD*AT*fhiu8>g#pxN-f8vgVg+&zBESO;R@20Cj*()5?BdiYLc&s`IgG#Rz&F$- z_11^U@f=1HL4?%$XY`+lNEVDYy~eMByGF|G-B0jX!vqHNFYtW(1TLSML`UHsg4&lr zTc5$|6PIQo^M*s=s6w0ap_cCUmwgg>uH>)n;p*P8v=FtCz0B*hBi^GDKe^1Lplj`tLw;GM z%->vTwta9L9b!Ci>k1L>cvmt48=MK|s6@di^RED(grZdxa8AOiRTLmwWK^x90OMRX zO$xAdkUlXX1G3unhPvW$gxfqT`?T%!;ugi_Oc69i(Qs+}etL)>(Et1Js&*Lbzt+qJ(tPAsVa literal 0 HcmV?d00001 diff --git a/lib/src/screens/home_screen.dart b/lib/src/screens/home_screen.dart index 55db7dd..b4773b1 100644 --- a/lib/src/screens/home_screen.dart +++ b/lib/src/screens/home_screen.dart @@ -1,18 +1,37 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import '../models/task_model.dart'; import '../resources/authService.dart'; +import '../resources/firestore_provider.dart'; import '../widgets/task_list_tile.dart'; +import '../widgets/loading_indicator.dart'; class HomeScreen extends StatelessWidget { final _auth = authService; + final _firestore = firestoreProvider; Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Main Screen'), ), - body: TaskListTile(task: TaskModel.sample()), + body: StreamBuilder( + stream: _firestore.getUserTasks('mariano159357'), + builder: (BuildContext context, AsyncSnapshot> snap) { + if (!snap.hasData) { + return Center( + child: LoadingIndicator(), + ); + } + return ListView( + padding: EdgeInsets.all(0.0), + children: + snap.data.map((task) => TaskListTile(task: task)).toList(), + ); + }, + ), ); } } diff --git a/lib/src/widgets/loading_indicator.dart b/lib/src/widgets/loading_indicator.dart new file mode 100644 index 0000000..7bdbe48 --- /dev/null +++ b/lib/src/widgets/loading_indicator.dart @@ -0,0 +1,16 @@ +import 'package:flare_flutter/flare_actor.dart'; +import 'package:flutter/material.dart'; + +class LoadingIndicator extends StatelessWidget { + Widget build(BuildContext context) { + return Container( + width: 70, + height: 70, + child: FlareActor( + 'assets/animations/loading_animation_looped.flr', + animation: 'Flip', + fit: BoxFit.contain, + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index e5aee24..9af46eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,6 +47,8 @@ dev_dependencies: flutter: assets: - assets/animations/loading_logo.flr + - assets/animations/loading_animation_looped.flr + - assets/animations/loading_animation.flr fonts: - family: IBM Plex Sans