CupertinoSegmentedControl: Add an interactive example (#98154)

This commit is contained in:
Taha Tesser
2022-02-15 19:30:19 +02:00
committed by GitHub
parent dfd42444e9
commit 7943ae5502
3 changed files with 122 additions and 38 deletions

View File

@@ -0,0 +1,19 @@
// 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_api_samples/cupertino/segmented_control/cupertino_segmented_control.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Can change a selected segmented control', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
);
expect(find.text('Selected Segment: midnight'), findsOneWidget);
await tester.tap(find.text('Cerulean'));
await tester.pumpAndSettle();
expect(find.text('Selected Segment: cerulean'), findsOneWidget);
});
}