Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
333397a0
Unverified
Commit
333397a0
authored
Nov 30, 2022
by
Taha Tesser
Committed by
GitHub
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Material 3 `BottomSheet` example (#116112)
fix title
parent
322dd06d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
18 deletions
+82
-18
show_modal_bottom_sheet.0.dart
.../lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart
+7
-10
show_modal_bottom_sheet.1.dart
.../lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart
+10
-8
show_modal_bottom_sheet.0_test.dart
...material/bottom_sheet/show_modal_bottom_sheet.0_test.dart
+29
-0
show_modal_bottom_sheet.1_test.dart
...material/bottom_sheet/show_modal_bottom_sheet.1_test.dart
+29
-0
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+7
-0
No files found.
examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart
View file @
333397a0
...
@@ -6,27 +6,24 @@
...
@@ -6,27 +6,24 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
BottomSheet
App
());
class
MyApp
extends
StatelessWidget
{
class
BottomSheetApp
extends
StatelessWidget
{
const
MyApp
({
super
.
key
});
const
BottomSheetApp
({
super
.
key
});
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
return
MaterialApp
(
title:
_title
,
home:
Scaffold
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
_title
)),
appBar:
AppBar
(
title:
const
Text
(
'Bottom Sheet Sample'
)),
body:
const
MyStatelessWidget
(),
body:
const
BottomSheetExample
(),
),
),
);
);
}
}
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
class
BottomSheetExample
extends
StatelessWidget
{
const
MyStatelessWidget
({
super
.
key
});
const
BottomSheetExample
({
super
.
key
});
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart
View file @
333397a0
...
@@ -2,30 +2,32 @@
...
@@ -2,30 +2,32 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// Flutter code sample for Material Design 3 TextFields.
/// Flutter code sample for [showModalBottomSheet].
/// Flutter code sample for [showModalBottomSheet].
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
BottomSheet
App
());
class
My
App
extends
StatelessWidget
{
class
BottomSheet
App
extends
StatelessWidget
{
const
My
App
({
super
.
key
});
const
BottomSheet
App
({
super
.
key
});
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
colorSchemeSeed:
const
Color
(
0xff6750a4
),
useMaterial3:
true
),
theme:
ThemeData
(
colorSchemeSeed:
const
Color
(
0xff6750a4
),
useMaterial3:
true
,
),
home:
Scaffold
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Bottom Sheet Sample'
)),
appBar:
AppBar
(
title:
const
Text
(
'Bottom Sheet Sample'
)),
body:
const
MyStatelessWidget
(),
body:
const
BottomSheetExample
(),
),
),
);
);
}
}
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
class
BottomSheetExample
extends
StatelessWidget
{
const
MyStatelessWidget
({
super
.
key
});
const
BottomSheetExample
({
super
.
key
});
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart
0 → 100644
View file @
333397a0
// 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/bottom_sheet/show_modal_bottom_sheet.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'BottomSheet can be opened and closed'
,
(
WidgetTester
tester
)
async
{
const
String
titleText
=
'Modal BottomSheet'
;
const
String
closeText
=
'Close BottomSheet'
;
await
tester
.
pumpWidget
(
const
example
.
BottomSheetApp
(),
);
expect
(
find
.
text
(
titleText
),
findsNothing
);
expect
(
find
.
text
(
closeText
),
findsNothing
);
// Open the bottom sheet.
await
tester
.
tap
(
find
.
widgetWithText
(
ElevatedButton
,
'showModalBottomSheet'
));
await
tester
.
pumpAndSettle
();
// Verify that the bottom sheet is open.
expect
(
find
.
text
(
titleText
),
findsOneWidget
);
expect
(
find
.
text
(
closeText
),
findsOneWidget
);
});
}
examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart
0 → 100644
View file @
333397a0
// 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/bottom_sheet/show_modal_bottom_sheet.1.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'BottomSheet can be opened and closed'
,
(
WidgetTester
tester
)
async
{
const
String
titleText
=
'Modal BottomSheet'
;
const
String
closeText
=
'Close BottomSheet'
;
await
tester
.
pumpWidget
(
const
example
.
BottomSheetApp
(),
);
expect
(
find
.
text
(
titleText
),
findsNothing
);
expect
(
find
.
text
(
closeText
),
findsNothing
);
// Open the bottom sheet.
await
tester
.
tap
(
find
.
widgetWithText
(
ElevatedButton
,
'showModalBottomSheet'
));
await
tester
.
pumpAndSettle
();
// Verify that the bottom sheet is open.
expect
(
find
.
text
(
titleText
),
findsOneWidget
);
expect
(
find
.
text
(
closeText
),
findsOneWidget
);
});
}
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
333397a0
...
@@ -799,6 +799,13 @@ class _BottomSheetSuspendedCurve extends ParametricCurve<double> {
...
@@ -799,6 +799,13 @@ class _BottomSheetSuspendedCurve extends ParametricCurve<double> {
/// ** See code in examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart **
/// ** See code in examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.0.dart **
/// {@end-tool}
/// {@end-tool}
///
///
/// {@tool dartpad}
/// This sample shows the creation of [showModalBottomSheet], as described in:
/// https://m3.material.io/components/bottom-sheets/overview
///
/// ** See code in examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.1.dart **
/// {@end-tool}
///
/// See also:
/// See also:
///
///
/// * [BottomSheet], which becomes the parent of the widget returned by the
/// * [BottomSheet], which becomes the parent of the widget returned by the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment