Created and added extra animation to replace material progress indicator

This commit is contained in:
Mariano Uvalle 2019-03-12 21:23:35 -06:00
parent fe316b336e
commit ae0f8515aa
5 changed files with 38 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1,18 +1,37 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../models/task_model.dart'; import '../models/task_model.dart';
import '../resources/authService.dart'; import '../resources/authService.dart';
import '../resources/firestore_provider.dart';
import '../widgets/task_list_tile.dart'; import '../widgets/task_list_tile.dart';
import '../widgets/loading_indicator.dart';
class HomeScreen extends StatelessWidget { class HomeScreen extends StatelessWidget {
final _auth = authService; final _auth = authService;
final _firestore = firestoreProvider;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Main Screen'), title: Text('Main Screen'),
), ),
body: TaskListTile(task: TaskModel.sample()), body: StreamBuilder(
stream: _firestore.getUserTasks('mariano159357'),
builder: (BuildContext context, AsyncSnapshot<List<TaskModel>> snap) {
if (!snap.hasData) {
return Center(
child: LoadingIndicator(),
);
}
return ListView(
padding: EdgeInsets.all(0.0),
children:
snap.data.map((task) => TaskListTile(task: task)).toList(),
);
},
),
); );
} }
} }

View file

@ -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,
),
);
}
}

View file

@ -47,6 +47,8 @@ dev_dependencies:
flutter: flutter:
assets: assets:
- assets/animations/loading_logo.flr - assets/animations/loading_logo.flr
- assets/animations/loading_animation_looped.flr
- assets/animations/loading_animation.flr
fonts: fonts:
- family: IBM Plex Sans - family: IBM Plex Sans