shiburagi / Drawer-Behavior-Flutter

Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
MIT License
209 stars 36 forks source link

type 'InkWell' is not a subtype of type '_MenuListItem?' in type cast #54

Closed Shiba-Kar closed 3 years ago

Shiba-Kar commented 3 years ago
import 'dart:ui';

import 'package:brando_store/utils/app_utils.dart';
import 'package:drawerbehavior/drawer_scaffold.dart';
import 'package:drawerbehavior/menu_screen.dart';
import 'package:flutter/material.dart';

class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  int selectedItemId = 0;
  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (BuildContext context, BoxConstraints constraints) {
        final height = getHeight(constraints);
        final width = getWidth(constraints);
        return DrawerScaffold(
          appBar: AppBar(),
          drawers: [
            SideDrawer(
              slide: true,
              animation: true,
              color: Theme.of(context).primaryColor,
              selectedItemId: selectedItemId,
              onMenuItemSelected: (itemId) {
                setState(() {
                  selectedItemId = itemId;
                });
              },
              background: DecorationImage(
                image: AssetImage('assets/gifs/logo.gif'),
                fit: BoxFit.cover,
                colorFilter: ColorFilter.mode(
                  Colors.white,
                  BlendMode.color,
                ),
                alignment: Alignment.topCenter,
              ),
              // percentage: 0.3,
              menu: Menu(items: [
                MenuItem(title: "Profile", icon: Icons.redeem),
                MenuItem(title: "Posts"),
              ]),

              itemBuilder: (_, item, __) {
                return InkWell(
                  child: Container(
                    height: height * 10,
                    width: width * 2,
                    child: Text(item.id.toString()),
                  ),
                );
                /* return Stack(
                  children: [Image.asset('assets/gifs/logo.gif'), item],
                ); */
              },
            )
          ],
        );
      },
    );
  }
}
shiburagi commented 3 years ago

can u try with this version drawerbehavior: ^2.2.0