jamesblasco / modal_bottom_sheet

Flutter | Create advanced modal bottom sheets. Material, Cupertino or your own style
https://pub.dev/packages/modal_bottom_sheet
MIT License
1.83k stars 461 forks source link

Having problem implementing the modal_bottom_sheet library #390

Closed lebe24 closed 3 months ago

lebe24 commented 4 months ago

hi everyone

this is my first time running this package, I have read the documentation and tried to implement the showCupertinoModalBottomSheet

for context

installation

import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';

implementation


 IconButton(icon: Icon(Icons.settings), 
            onPressed: () => showCupertinoModalBottomSheet(
                        expand: true,
                              context: context,
                              backgroundColor: Colors.transparent,
                        builder: (context) => Center(child: Text("test")),
                      ),
                    ),
          ],

error


./../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/material_with_modal_page_route.dart:4:1: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
import '../modal_bottom_sheet.dart';
^^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/material_bottom_sheet.dart:28:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
      .push(ModalBottomSheetRoute<T>(
            ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/material_bottom_sheet.dart:50:10: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.
 - 'Object' is from 'dart:core'.
 - 'Future' is from 'dart:async'.
  return result;
MahitMehta commented 4 months ago

@lebe24 Did you ever figure out a solution? I'm facing the same problem currently.

lebe24 commented 4 months ago

Hey @MahitMehta the solutions seems to be modifying the bottom sheet file regarding the import. But basically am just waiting to see if a solution come up if not I probably figured the bug in the package. Right now I haven't found any fix, am just waiting...😐

iamnabink commented 4 months ago

Flutter version and package version please

CyMathew commented 4 months ago

Change pubspec version manually to modal_bottom_sheet: ^3.0.0-pre

Also read the documentation on how to make iOS style modal transitions work. You will need MaterialWithModalsPageRoute on the route you're navigating from.

lebe24 commented 3 months ago

Package version works 🥂 thanks @CyMathew @iamnabink