Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
modal_bottom_sheet
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jaime Blasco
2020-04-08 09:58:08 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9fd89a684abf8f5517b89911b7d8aa563ac1dc90
9fd89a68
1 parent
eca82dfc
Add new example
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
example/lib/main.dart
example/lib/modals/floating_modal.dart
example/lib/main.dart
View file @
9fd89a6
...
...
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import
'package:modal_bottom_sheet/modal_bottom_sheet.dart'
;
import
'modals/floating_modal.dart'
;
import
'modals/modal_complex_all.dart'
;
import
'modals/modal_fit.dart'
;
import
'modals/modal_inside_modal.dart'
;
...
...
@@ -142,6 +143,13 @@ class _MyHomePageState extends State<MyHomePage> {
scrollController:
scrollController
),
)),
ListTile
(
title:
Text
(
'Float Modal'
),
onTap:
()
=>
showFloatingModalBottomSheet
(
context:
context
,
builder:
(
context
,
scrollController
)
=>
ModalFit
(
scrollController:
scrollController
),
)),
ListTile
(
title:
Text
(
'Cupertino Modal fit'
),
onTap:
()
=>
showCupertinoModalBottomSheet
(
expand:
false
,
...
...
example/lib/modals/floating_modal.dart
0 → 100644
View file @
9fd89a6
import
'dart:math'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:modal_bottom_sheet/modal_bottom_sheet.dart'
;
class
FloatingModal
extends
StatelessWidget
{
final
Widget
child
;
final
Color
backgroundColor
;
const
FloatingModal
({
Key
key
,
this
.
child
,
this
.
backgroundColor
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
SafeArea
(
child:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
),
child:
Material
(
color:
backgroundColor
,
clipBehavior:
Clip
.
antiAlias
,
borderRadius:
BorderRadius
.
circular
(
12
),
child:
child
,
),
),
);
}
}
Future
<
T
>
showFloatingModalBottomSheet
<
T
>({
@required
BuildContext
context
,
@required
ScrollWidgetBuilder
builder
,
Color
backgroundColor
,
})
async
{
final
result
=
await
showCustomModalBottomSheet
(
context:
context
,
builder:
builder
,
containerWidget:
(
_
,
animation
,
child
)
=>
FloatingModal
(
child:
child
,
),
expand:
false
);
return
result
;
}
...
...
Please
register
or
login
to post a comment