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

Incompatible with the latest version of flutter/dart? #374

Closed gjcarver closed 3 months ago

gjcarver commented 9 months ago

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'; ^^^^^^^^^^^^^^^^^^^^^ lib/modals/circular_modal.dart:102:32: Error: Method not found: 'ModalSheetRoute'. .push(modal_bottom_sheet.ModalSheetRoute( ^^^^^^^^^^^^^^^ lib/modals/circular_modal.dart:118:10: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.

FAILURE: Build failed with an exception.

sonigeez commented 9 months ago

facing same issue...

gjcarver commented 9 months ago

Switched "params" to "pathParameters" in gorouter.dart: "final String id = state.pathParameters['bid']!;" Switched "with" to "implements" in lib/examples/sheet/complex_snap_sheet.dart : "class MapAppBar extends StatefulWidget implements PreferredSizeWidget {"

gjcarver commented 9 months ago

lib/examples/route/navigation/go_router.dart: from "redirect: (GoRouterState state) {" to "redirect: (BuildContext context, GoRouterState state) {"

sanburnn commented 8 months ago

facing same issue here. is there anyway to fix this?

fralsal commented 8 months ago

I believe I have fixed the issue, will test it on my project and submit a PR.

Edit: PR is up.

sanburnn commented 8 months ago

oh sory i just fix it by changing the version into modal_bottom_sheet: ^3.0.0-pre

koldoon commented 7 months ago

What about "sheet" package update accordingly? Facing the same issue

ziqq commented 7 months ago

Hello any one, try to use modal_bottom_sheet: ^3.0.0-pre in pubspec.yaml

joaobentes commented 6 months ago

Hello everyone,

It does not work for me neither. I have both sheet: ^1.0.0-pre and modal_bottom_sheet: ^3.0.0-pre in pubspec.yaml.

But still, it does not build the project. Here's the error messages:

../../.pub-cache/hosted/pub.dev/sheet-1.0.0-pre/lib/src/sheet.dart:905:18: Error: The method 'RenderSheetViewport.getOffsetToReveal' has fewer named arguments than those of overridden method 'RenderAbstractViewport.getOffsetToReveal'.
  RevealedOffset getOffsetToReveal(RenderObject target, double alignment,
                 ^
../../fluttter/flutter/packages/flutter/lib/src/rendering/viewport.dart:126:18: Context: This is the overridden method ('getOffsetToReveal').
  RevealedOffset getOffsetToReveal(
                 ^
../../.pub-cache/hosted/pub.dev/sheet-1.0.0-pre/lib/src/sheet.dart:905:18: Error: The method 'RenderSheetViewport.getOffsetToReveal' doesn't have the named parameter 'axis' of overridden method 'RenderAbstractViewport.getOffsetToReveal'.
  RevealedOffset getOffsetToReveal(RenderObject target, double alignment,
                 ^
../../fluttter/flutter/packages/flutter/lib/src/rendering/viewport.dart:126:18: Context: This is the overridden method ('getOffsetToReveal').
  RevealedOffset getOffsetToReveal(
                 ^
../../.pub-cache/hosted/pub.dev/sheet-1.0.0-pre/lib/src/scrollable.dart:313:7: Error: The non-abstract class 'SheetState' is missing implementations for these members:
 - ScrollContext.devicePixelRatio

And here's my sample code:

import 'package:flutter/material.dart';
import 'package:sheet/route.dart';

class PreviewCupertinoModals extends StatefulWidget {
  const PreviewCupertinoModals({super.key});

  @override
  State<PreviewCupertinoModals> createState() => _PreviewCupertinoModalsState();
}

class _PreviewCupertinoModalsState extends State<PreviewCupertinoModals> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: ElevatedButton(
          child: const Text('Go to Cupertino Sheet'),
          onPressed: () {
            const CupertinoSheetPage(
                child: Center(
              child: Text('Something'),
            ));
          }),
    );
  }
}

Here's my flutter --version

Flutter 3.16.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b0366e0a3f (4 weeks ago) • 2023-12-05 19:46:39 -0800
Engine • revision 54a7145303
Tools • Dart 3.2.3 • DevTools 2.28.4

Anyone with the same issue?

ziqq commented 5 months ago

Hello @joaobentes, remove sheet: ^1.0.0-pre and use only modal_bottom_sheet: ^3.0.0-pre

jamesblasco commented 3 months ago

There is a new version of sheet 1.0.0 and modal_bottom_sheet: 3.0.0 that should work with latest dart 3.3 and flutter 3.19