Created and added extra animation to replace material progress indicator
This commit is contained in:
parent
fe316b336e
commit
ae0f8515aa
5 changed files with 38 additions and 1 deletions
BIN
assets/animations/loading_animation.flr
Normal file
BIN
assets/animations/loading_animation.flr
Normal file
Binary file not shown.
BIN
assets/animations/loading_animation_looped.flr
Normal file
BIN
assets/animations/loading_animation_looped.flr
Normal file
Binary file not shown.
|
|
@ -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<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(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
lib/src/widgets/loading_indicator.dart
Normal file
16
lib/src/widgets/loading_indicator.dart
Normal 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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue