Unverified Commit f4707c2b authored by xubaolin's avatar xubaolin Committed by GitHub

fix a Scrollbar example crash (#127925)

Fix a scrollbar example crash.
https://api.flutter.dev/flutter/material/Scrollbar-class.html#material.Scrollbar.1
parent bb8de216
......@@ -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) {
......
// 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());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment