Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is not some features #10

Open
KananTaghili opened this issue Mar 12, 2024 · 0 comments
Open

There is not some features #10

KananTaghili opened this issue Mar 12, 2024 · 0 comments

Comments

@KananTaghili
Copy link

I want to use this library but I cant find some features. I made several features by some third part ways but others I cant. First there is not way to close drawer whole close, I change min width to zero but it return error. Second there is not onToggle method to listen drawer. There is not isOpen method. There is not expandable menu item group. How to disable linear view on left side of selected item. items only accept SideMenuItemDataTile not widget. When header and footer is not enabled, items move to top, how to set in center.

My code is below :

import 'package:flutter/material.dart';
import 'package:flutter_side_menu/flutter_side_menu.dart';
import 'package:flutter_svg/svg.dart';

import 'my_input_theme.dart';

void main() {
runApp(const MyApp());
}

const primaryColor = Color(0xFF2697FF);
const secondaryColor = Color(0xFF2A2D3E);
const bgColor = Color(0xFF212332);

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

@OverRide
State createState() => _MyAppState();
}

class _MyAppState extends State {
final List headerTitle = [
"Dashboard",
"Sensors",
"Equipments",
"Alerts Log",
"Notification Delivery Logs",
"Equipment and Sensor map",
"Maintenance",
];

@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: bgColor,
canvasColor: secondaryColor,
inputDecorationTheme: MyInputTheme().theme(),
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Row(
children: [
SideMenu(
hasResizer: false,
resizerToggleData: const ResizerToggleData(iconColor: Colors.white, opacity: 1, iconSize: 24),
maxWidth: 280,
minWidth: 50,
controller: GlobalVars.controller,
backgroundColor: secondaryColor,
mode: SideMenuMode.open,
builder: (data) {
return SideMenuData(
header: SizedBox(
height: 200,
child: DrawerHeader(
child: Image.asset("assets/images/main_logo.png",
fit: BoxFit.fitHeight),
),
),
items: [
for (int i = 0; i < headerTitle.length; i++)
drawerListTileSvg(
title: headerTitle.elementAt(i),
svgSrc: "assets/icons/side_menu
${i + 2}.svg",
index: i,
),
],
);
},
),
Expanded(
child: Container(
color: bgColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
GlobalVars._controller.toggle();
},
child: const Text('change side menu state'),
)
],
),
),
),
],
),
),
);
}

SideMenuItemDataTile drawerListTileSvg(
{required String title, required String svgSrc, required int index}) {
return SideMenuItemDataTile(
isSelected: GlobalVars.selectedMenuItem == index,
onTap: () => setState(() => GlobalVars.selectedMenuItem = index),
title: title,
selectedTitleStyle: const TextStyle(color: Colors.white70, fontSize: 20),
icon: Padding(
padding: const EdgeInsets.all(6),
child: SvgPicture.asset(
svgSrc,
color: Colors.white54,
),
),
highlightSelectedColor: Colors.grey.withOpacity(0.1),
hoverColor: Colors.grey.withOpacity(0.05),
selectedIcon: Padding(
padding: const EdgeInsets.all(4),
child: SvgPicture.asset(
svgSrc,
color: Colors.blue,
),
),
titleStyle: const TextStyle(color: Colors.white54, fontSize: 18),
);
}
}

class GlobalVars {
static var selectedMenuItem = 0;
static final _controller = SideMenuController();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant