Improved modal bottom sheet scoll

This commit is contained in:
Juan Gilsanz Polo 2022-10-02 22:23:20 +02:00
parent 72eba31200
commit 0a35fcefc5
2 changed files with 100 additions and 98 deletions

View file

@ -29,6 +29,8 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final logsProvider = Provider.of<LogsProvider>(context); final logsProvider = Provider.of<LogsProvider>(context);
final height = MediaQuery.of(context).size.height;
void apply() async { void apply() async {
logsProvider.setSelectedResultStatus(selectedResultStatus); logsProvider.setSelectedResultStatus(selectedResultStatus);
@ -79,11 +81,10 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
); );
} }
return DraggableScrollableSheet( return Container(
initialChildSize: 0.7, height: height >= 680 == true
minChildSize: 0.2, ? 680
maxChildSize: 0.7, : height-25,
builder: (context, scrollController) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(28), topLeft: Radius.circular(28),
@ -112,7 +113,9 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
const SizedBox(height: 20), const SizedBox(height: 20),
Expanded( Expanded(
child: ListView( child: ListView(
controller: scrollController, physics: height >= 680 == true
? const NeverScrollableScrollPhysics()
: null,
children: [ children: [
filterStatusListItem( filterStatusListItem(
id: "all", id: "all",
@ -180,7 +183,6 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
) )
], ],
), ),
),
); );
} }
} }

View file

@ -32,7 +32,7 @@ class LogDetailsModal extends StatelessWidget {
return DraggableScrollableSheet( return DraggableScrollableSheet(
initialChildSize: 0.6, initialChildSize: 0.6,
minChildSize: 0.4, minChildSize: 0.6,
maxChildSize: 0.95, maxChildSize: 0.95,
builder: (context, controller) => Container( builder: (context, controller) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(