easy_refresh_bubbles 1.0.0 easy_refresh_bubbles: ^1.0.0 copied to clipboard
Bubbles Indicator on EasyRefresh. Provides BubblesHeader and BubblesFooter. Animation with Rive.
import 'package:easy_refresh_bubbles/easy_refresh_bubbles.dart';
import 'package:flutter/material.dart';
import 'package:easy_refresh/easy_refresh.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Bubbles',
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
int _count = 10;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Bubbles'),
),
body: EasyRefresh(
header: const BubblesHeader(),
footer: const BubblesFooter(),
onRefresh: () async {
await Future.delayed(const Duration(seconds: 4));
if (!mounted) {
return;
}
setState(() {
_count = 10;
});
},
onLoad: () async {
await Future.delayed(const Duration(seconds: 4));
if (!mounted) {
return;
}
setState(() {
_count += 5;
});
},
child: ListView.builder(
itemBuilder: (context, index) {
return Card(
child: Container(
alignment: Alignment.center,
height: 80,
child: Text('${index + 1}'),
),
);
},
itemCount: _count,
),
),
);
}
}