feat(flutter): 增加轮播自动播放与站内通知
This commit is contained in:
1 parent
b7b1c50427
commit
b870956665
24 files changed
+1398
-26
No files matched your search
@@ -0,0 +1,32 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:fruitshorts/core/data/models/notice.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/notice_repository.dart';
|
||||
|
||||
/// Scripted notice repository for controller and widget tests.
|
||||
class FakeNoticeRepository implements NoticeRepository {
|
||||
FakeNoticeRepository({List<NoticePage>? pages, this.error, this.delay})
|
||||
: pages = pages ?? [];
|
||||
|
||||
final List<NoticePage> pages;
|
||||
Object? error;
|
||||
Duration? delay;
|
||||
final List<FakeNoticeCall> calls = [];
|
||||
|
||||
@override
|
||||
Future<NoticePage> page({required int pageIndex, int pageSize = 20}) async {
|
||||
calls.add(FakeNoticeCall(pageIndex: pageIndex, pageSize: pageSize));
|
||||
if (delay != null) await Future<void>.delayed(delay!);
|
||||
if (error != null) throw error!;
|
||||
if (pages.isEmpty) return const NoticePage(total: 0);
|
||||
return pages.removeAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
/// Captured notice page request.
|
||||
class FakeNoticeCall {
|
||||
const FakeNoticeCall({required this.pageIndex, required this.pageSize});
|
||||
|
||||
final int pageIndex;
|
||||
final int pageSize;
|
||||
}
|
||||
Reference in new issue
Block a user