pikapika/lib/screens/components/ComicListBuilder.dart

34 lines
911 B
Dart
Raw Normal View History

2021-09-29 23:57:09 +00:00
import 'package:flutter/material.dart';
import 'package:pikapi/basic/Entities.dart';
import 'package:pikapi/screens/components/ComicList.dart';
import 'package:pikapi/screens/components/FitButton.dart';
import 'ContentBuilder.dart';
class ComicListBuilder extends StatelessWidget {
final Future<List<ComicSimple>> future;
final Future Function() reload;
ComicListBuilder(this.future, this.reload);
@override
Widget build(BuildContext context) {
return ContentBuilder(
future: future,
onRefresh: reload,
successBuilder:
(BuildContext context, AsyncSnapshot<List<ComicSimple>> snapshot) {
return RefreshIndicator(
onRefresh: reload,
child: ComicList(
snapshot.data!,
appendWidget: FitButton(
onPressed: reload,
text: '刷新',
),
),
);
},
);
}
}