Support theming CupertinoSwitchs (#116510)

* Introduce flag to maximally apply CupertinoTheme

* add missing docs

* add tests

* fix docs

* fix test
This commit is contained in:
Pierre-Louis
2022-12-06 15:32:58 +01:00
committed by GitHub
parent 921f077687
commit 1e696d304c
9 changed files with 228 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/material/switch/switch.0.dart' as example;
import 'package:flutter_api_samples/material/switch/switch.1.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {

View File

@@ -0,0 +1,24 @@
// 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/switch/switch.3.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Can toggle switch', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SwitchApp(),
);
final Finder switchFinder = find.byType(Switch).first;
Switch materialSwitch = tester.widget<Switch>(switchFinder);
expect(materialSwitch.value, true);
await tester.tap(switchFinder);
await tester.pumpAndSettle();
materialSwitch = tester.widget<Switch>(switchFinder);
expect(materialSwitch.value, false);
});
}