Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky committed Oct 3, 2023
1 parent e4af9e8 commit 862c336
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
8 changes: 7 additions & 1 deletion emulator_proxy/bin/start.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
import 'package:emulator_proxy/emulator_proxy.dart';

Future<void> main(List<String> args) async {
final authProxy = EmulatorProxy(proxyPort: 9098, emulatorPort: 9099);
final latencyMs = args.isNotEmpty ? int.tryParse(args[0]) : 100;

final authProxy = EmulatorProxy(
proxyPort: 9098,
emulatorPort: 9099,
latency: Duration(milliseconds: latencyMs ?? 100),
);

authProxy.serve();
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,38 +125,40 @@ void main() {
testWidgets(
'When reaching the end of the list, loads more items',
(tester) async {
await tester.binding.setSurfaceSize(const Size(500, 500));
addTearDown(() => tester.binding.setSurfaceSize(null));
final ref = db.collection('flutter-tests/list-view-builder/works');

final collection = db.collection(
'flutter-tests/list-view-builder/works',
);

await fillCollection(collection, 25);
await fillCollection(ref, 25);
late double size;

await tester.pumpWidget(
MaterialApp(
home: Material(
child: FirestoreListView<Map>(
physics: const ClampingScrollPhysics(),
query: collection.orderBy('value'),
cacheExtent: 0,
pageSize: 5,
itemBuilder: (context, snapshot) {
final v = snapshot.data()['value'] as int;

return Container(
height: 100,
alignment: Alignment.center,
color: Colors.black.withAlpha(v % 2 == 0 ? 50 : 100),
key: ValueKey(v.toString()),
child: Text(
v.toString(),
textAlign: TextAlign.center,
),
);
},
),
child: Builder(builder: (context) {
final mq = MediaQuery.of(context);
final h = mq.size.height;
size = h / 5;

return FirestoreListView<Map>(
physics: const ClampingScrollPhysics(),
query: ref.orderBy('value'),
cacheExtent: 0,
pageSize: 5,
itemExtent: size,
itemBuilder: (context, snapshot) {
final v = snapshot.data()['value'] as int;

return Container(
alignment: Alignment.center,
color: Colors.black.withAlpha(v % 2 == 0 ? 50 : 100),
key: ValueKey(v.toString()),
child: Text(
v.toString(),
textAlign: TextAlign.center,
),
);
},
);
}),
),
),
);
Expand All @@ -169,7 +171,7 @@ void main() {

await tester.drag(
find.byKey(const ValueKey('4')),
const Offset(0, -500),
Offset(0, -size * 5),
touchSlopY: 0,
);

Expand All @@ -181,7 +183,7 @@ void main() {

await tester.drag(
find.byKey(const ValueKey('9')),
const Offset(0, -500),
Offset(0, -size * 5),
touchSlopY: 0,
);

Expand Down

0 comments on commit 862c336

Please sign in to comment.