fix a Scrollbar example crash (#127925)
Fix a scrollbar example crash. https://api.flutter.dev/flutter/material/Scrollbar-class.html#material.Scrollbar.1
This commit is contained in:
parent
bb8de2167a
commit
f4707c2b3d
@ -319,7 +319,6 @@ final Set<String> _knownMissingTests = <String>{
|
||||
'examples/api/test/material/filled_button/filled_button.0_test.dart',
|
||||
'examples/api/test/material/text_form_field/text_form_field.1_test.dart',
|
||||
'examples/api/test/material/scrollbar/scrollbar.1_test.dart',
|
||||
'examples/api/test/material/scrollbar/scrollbar.0_test.dart',
|
||||
'examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart',
|
||||
'examples/api/test/material/radio/radio.toggleable.0_test.dart',
|
||||
'examples/api/test/material/radio/radio.0_test.dart',
|
||||
|
@ -29,6 +29,7 @@ class ScrollbarExample extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scrollbar(
|
||||
child: GridView.builder(
|
||||
primary: true,
|
||||
itemCount: 120,
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
21
examples/api/test/material/scrollbar/scrollbar.0_test.dart
Normal file
21
examples/api/test/material/scrollbar/scrollbar.0_test.dart
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/scrollbar/scrollbar.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Scrollbar.0 works well on all platforms', (WidgetTester tester) async {
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.ScrollbarExampleApp(),
|
||||
);
|
||||
|
||||
final Finder buttonFinder = find.byType(Scrollbar);
|
||||
await tester.drag(buttonFinder.last, const Offset(0, 100.0));
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
}, variant: TargetPlatformVariant.all());
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user