feat(ui,train): a pull far enough to refresh ticks, lightly, as the navigation does
AppRefreshIndicator ticks (selectionClick, as a choice on the floating bar or the rail) once the pull commits: as it snaps back to refresh, or as it refreshes at once, whichever comes first, and not for a pull let go too early. Train's list of days pulled to read the band used Flutter's own RefreshIndicator, the older spinner; it takes the app's now, and the tick with it. Whats-New: Pulling a list down to refresh ticks lightly. Whats-New-De: Eine Liste zum Aktualisieren herunterziehen gibt ein leichtes Tippen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
4239a1de24
commit
bcbefe38a3
1 changed files with 62 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:expressive_loading_indicator/expressive_loading_indicator.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_ui/halkyon_ui.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
|
@ -40,4 +41,50 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ExpressiveLoadingIndicator), findsNothing);
|
||||
});
|
||||
|
||||
group('a light tick', () {
|
||||
Future<List<Object?>> pulled(WidgetTester tester, double by) async {
|
||||
final haptics = <Object?>[];
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
||||
SystemChannels.platform,
|
||||
(call) async {
|
||||
if (call.method == 'HapticFeedback.vibrate') {
|
||||
haptics.add(call.arguments);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
addTearDown(
|
||||
() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
||||
SystemChannels.platform,
|
||||
null,
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: appTheme(Brightness.light),
|
||||
home: Scaffold(
|
||||
body: AppRefreshIndicator(
|
||||
onRefresh: () async {},
|
||||
child: ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
children: const [Text('Japanese')],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.fling(find.text('Japanese'), Offset(0, by), 1000);
|
||||
await tester.pumpAndSettle();
|
||||
return haptics;
|
||||
}
|
||||
|
||||
testWidgets('as a pull far enough refreshes, once', (tester) async {
|
||||
expect(await pulled(tester, 400), ['HapticFeedbackType.selectionClick']);
|
||||
});
|
||||
|
||||
testWidgets('but none for a pull let go too early', (tester) async {
|
||||
expect(await pulled(tester, 20), isEmpty);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue