forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/pageController_get_value_error
* master: (23 commits) Roll pub packages (flutter#150810) Remove reference to `MaterialApp` and `showCupertinoModalPopup` from `CupertinoAlertDialog` (flutter#150725) Read `AndroidManifest.xml` and emit `manifest-impeller-(enabled|disabled)` analytics (flutter#150791) [flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (flutter#150645) Reland fix inputDecorator hint color on M3 (flutter#150278) Roll Flutter Engine from 62e0b5f9c340 to 94023d711db3 (7 revisions) (flutter#150797) Fix collapsed InputDecorator minimum height (flutter#150770) Add more warm up frame docs (flutter#150464) Roll pub packages (flutter#150739) Add `focusNode`, `focusColor`, `onFocusChange`, `autofocus` to `CupertinoButton` (flutter#150721) Document RenderObject._relayoutBoundary and its invariant; small refactors (flutter#150527) Roll Flutter Engine from 6313b1e5afd7 to 62e0b5f9c340 (1 revision) (flutter#150790) fix a typo (flutter#150682) Fix link in RenderObjectWidget doc comment (flutter#150600) Roll Flutter Engine from fbd92055f3a6 to 6313b1e5afd7 (1 revision) (flutter#150781) [tool] make `ErrorHandlingFileSystem.deleteIfExists` catch error code 3 (`ERROR_PATH_NOT_FOUND` on Windows) (flutter#150741) Roll Packages from 711b4ac2794e to 03f5f6d5660c (21 revisions) (flutter#150779) Roll Flutter Engine from afa7ce19bca8 to fbd92055f3a6 (1 revision) (flutter#150777) Reland Add tests for form_text_field.1.dart (flutter#150481) (flutter#150696) (flutter#150750) Add an example for CupertinoPopupSurface (flutter#150357) ...
- Loading branch information
Showing
34 changed files
with
1,276 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
be7db94196fee940e319363f7ed0c486a780ae50 | ||
94023d711db3f950a235fd84a80a3dde4dd86338 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
711b4ac2794e299e8d8926a269f672b1eba56640 | ||
03f5f6d5660cf1dd77586d207845971ce2bebb93 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
iU-B6rJxy0wUYSmmp1O7ykcFNnD26n1wW_i9UZ8fT4kC | ||
WUN7NQK04NjF9fRmfM16ILdIhytQAHB7O1631G4HsIEC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
examples/api/lib/cupertino/dialog/cupertino_popup_surface.0.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// 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/cupertino.dart'; | ||
|
||
/// Flutter code sample for [CupertinoPopupSurface]. | ||
void main() => runApp(const PopupSurfaceApp()); | ||
|
||
class PopupSurfaceApp extends StatelessWidget { | ||
const PopupSurfaceApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const CupertinoApp( | ||
home: PopupSurfaceExample(), | ||
); | ||
} | ||
} | ||
|
||
class PopupSurfaceExample extends StatefulWidget { | ||
const PopupSurfaceExample({super.key}); | ||
|
||
@override | ||
State<PopupSurfaceExample> createState() => _PopupSurfaceExampleState(); | ||
} | ||
|
||
class _PopupSurfaceExampleState extends State<PopupSurfaceExample> { | ||
bool _shouldPaintSurface = true; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return CupertinoPageScaffold( | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Row( | ||
mainAxisSize: MainAxisSize.min, | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: <Widget>[ | ||
const Text('Paint surface'), | ||
const SizedBox(width: 16.0), | ||
CupertinoSwitch( | ||
value: _shouldPaintSurface, | ||
onChanged: (bool value) => setState(() => _shouldPaintSurface = value), | ||
), | ||
], | ||
), | ||
CupertinoButton( | ||
onPressed: () => _showPopupSurface(context), | ||
child: const Text('Show popup'), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
void _showPopupSurface(BuildContext context) { | ||
showCupertinoModalPopup<void>( | ||
context: context, | ||
builder: (BuildContext context) { | ||
return CupertinoPopupSurface( | ||
isSurfacePainted: _shouldPaintSurface, | ||
child: Container( | ||
height: 240, | ||
padding: const EdgeInsets.all(8.0), | ||
child: Column( | ||
children: <Widget>[ | ||
Expanded( | ||
child: Container( | ||
alignment: Alignment.center, | ||
decoration: _shouldPaintSurface | ||
? null | ||
: BoxDecoration( | ||
color: CupertinoTheme.of(context).scaffoldBackgroundColor, | ||
borderRadius: BorderRadius.circular(8.0), | ||
), | ||
child: const Text('This is a popup surface.'), | ||
), | ||
), | ||
const SizedBox(height: 8.0), | ||
SizedBox( | ||
width: double.infinity, | ||
child: CupertinoButton( | ||
color: _shouldPaintSurface | ||
? null | ||
: CupertinoTheme.of(context).scaffoldBackgroundColor, | ||
onPressed: () => Navigator.pop(context), | ||
child: const Text( | ||
'Close', | ||
style: TextStyle(color: CupertinoColors.systemBlue), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
examples/api/test/cupertino/dialog/cupertino_popup_surface.0_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// 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/cupertino.dart'; | ||
import 'package:flutter_api_samples/cupertino/dialog/cupertino_popup_surface.0.dart' | ||
as example; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
testWidgets('CupertinoPopupSurface displays expected widgets in init state', | ||
(WidgetTester tester) async { | ||
await tester.pumpWidget(const example.PopupSurfaceApp()); | ||
|
||
final Finder cupertinoButton = find.byType(CupertinoButton); | ||
expect(cupertinoButton, findsOneWidget); | ||
|
||
final Finder cupertinoSwitch = find.byType(CupertinoSwitch); | ||
expect(cupertinoSwitch, findsOneWidget); | ||
}); | ||
|
||
testWidgets('CupertinoPopupSurface is displayed with painted surface', | ||
(WidgetTester tester) async { | ||
await tester.pumpWidget(const example.PopupSurfaceApp()); | ||
|
||
// CupertinoSwitch is toggled on by default. | ||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value, isTrue); | ||
|
||
// Tap on the CupertinoButton to show the CupertinoPopupSurface. | ||
await tester.tap(find.byType(CupertinoButton)); | ||
await tester.pumpAndSettle(); | ||
|
||
// Make sure CupertinoPopupSurface is showing. | ||
final Finder cupertinoPopupSurface = find.byType(CupertinoPopupSurface); | ||
expect(cupertinoPopupSurface, findsOneWidget); | ||
|
||
// Confirm that CupertinoPopupSurface is painted with a ColoredBox. | ||
final Finder coloredBox = find.descendant( | ||
of: cupertinoPopupSurface, | ||
matching: find.byType(ColoredBox), | ||
); | ||
expect(coloredBox, findsOneWidget); | ||
}); | ||
|
||
testWidgets('CupertinoPopupSurface is displayed without painted surface', | ||
(WidgetTester tester) async { | ||
await tester.pumpWidget(const example.PopupSurfaceApp()); | ||
|
||
// Toggling off CupertinoSwitch and confirm its state. | ||
final Finder cupertinoSwitch = find.byType(CupertinoSwitch); | ||
await tester.tap(cupertinoSwitch); | ||
await tester.pumpAndSettle(); | ||
expect(tester.widget<CupertinoSwitch>(cupertinoSwitch).value, isFalse); | ||
|
||
// Tap on the CupertinoButton to show the CupertinoPopupSurface. | ||
await tester.tap(find.byType(CupertinoButton)); | ||
await tester.pumpAndSettle(); | ||
|
||
// Make sure CupertinoPopupSurface is showing. | ||
final Finder cupertinoPopupSurface = find.byType(CupertinoPopupSurface); | ||
expect(cupertinoPopupSurface, findsOneWidget); | ||
|
||
// Confirm that CupertinoPopupSurface is not painted with a ColoredBox. | ||
final Finder coloredBox = find.descendant( | ||
of: cupertinoPopupSurface, | ||
matching: find.byType(ColoredBox), | ||
); | ||
expect(coloredBox, findsNothing); | ||
}); | ||
} |
58 changes: 58 additions & 0 deletions
58
examples/api/test/material/text_form_field/text_form_field.1_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// 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/services.dart'; | ||
import 'package:flutter_api_samples/material/text_form_field/text_form_field.1.dart' as example; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
testWidgets('Pressing space should focus the next field', (WidgetTester tester) async { | ||
await tester.pumpWidget(const example.TextFormFieldExampleApp()); | ||
final Finder textFormField = find.byType(TextFormField); | ||
|
||
expect(textFormField, findsExactly(5)); | ||
|
||
final Finder editableText = find.byType(EditableText); | ||
expect(editableText, findsExactly(5)); | ||
|
||
List<bool> getFocuses() { | ||
return editableText.evaluate() | ||
.map((Element finderResult) => (finderResult.widget as EditableText).focusNode.hasFocus) | ||
.toList(); | ||
} | ||
|
||
expect(getFocuses(), const <bool>[false, false, false, false, false]); | ||
|
||
await tester.tap(textFormField.first); | ||
await tester.pump(); | ||
|
||
expect(getFocuses(), const <bool>[true, false, false, false, false]); | ||
|
||
await tester.sendKeyEvent(LogicalKeyboardKey.space); | ||
await tester.pump(); | ||
|
||
expect(getFocuses(), const <bool>[false, true, false, false, false]); | ||
|
||
await tester.sendKeyEvent(LogicalKeyboardKey.space); | ||
await tester.pump(); | ||
|
||
expect(getFocuses(), const <bool>[false, false, true, false, false]); | ||
|
||
await tester.sendKeyEvent(LogicalKeyboardKey.space); | ||
await tester.pump(); | ||
|
||
expect(getFocuses(), const <bool>[false, false, false, true, false]); | ||
|
||
await tester.sendKeyEvent(LogicalKeyboardKey.space); | ||
await tester.pump(); | ||
|
||
expect(getFocuses(), const <bool>[false, false, false, false, true]); | ||
|
||
await tester.sendKeyEvent(LogicalKeyboardKey.space); | ||
await tester.pump(); | ||
|
||
expect(getFocuses(), const <bool>[true, false, false, false, false]); | ||
}); | ||
} |
Oops, something went wrong.