The case of assigning the id of PlutoMenuItem.

Search for a command to run...

No comments yet. Be the first to comment.
The default ScrollBehavior.dragDevices of PlutoGrid is as follows.(dragDevices is a setting that allows scrolling by dragging to the set pointer type.) // In case of Mobile { PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind....

Example code to add custom widget to PlutoMenuBar.

PlutoGrid has default shortcut keys set, and users can change or set shortcut keys. Shortcut Range The scope of the shortcut depends on the focus. PlutoGrid : In the state that TextField is not focused. You can set custom shortcut keys. TextField :...

PlutoLayout is a Flutter package for configuring layouts such as CMS or admin service.You can configure tab views or menus on the top, bottom, left, and right sides.It also supports keyboard shortcuts and allows you to toggle or resize the tab view. ...

A unique id can be set for PlutoMenuItem.
PlutoMenuItem(
id: 'unique_id',
title: 'Menu 1',
)
If PlutoMenuItem is created in build method, you should set a unique id for PlutoMenuItem.
Otherwise, when PlutoMenuBar is rebuilt, incorrect actions such as flickering or closing of open menus may occur.
(id must be unique throughout the app.)
class TestWidget extends StatelessWidget {
const TestWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return PlutoMenuBar(menus: [
PlutoMenuItem(
id: 'Menu1',
title: 'Menu1',
),
PlutoMenuItem(
id: 'Menu2',
title: 'Menu2',
),
]);
}
}
If PlutoMenuItem is created only once in a method such as initState, there is no need to set id.
Even if PlutoMenuBar is rebuilt, PlutoMenuItem is reused.
(The internal PlutoMenuItem.key is not changed.)
class TestWidget extends StatefulWidget {
const TestWidget({Key? key}) : super(key: key);
@override
State<TestWidget> createState() => _TestWidgetState();
}
class _TestWidgetState extends State<TestWidget> {
late final List<PlutoMenuItem> menus;
@override
void initState() {
super.initState();
menus = [
PlutoMenuItem(title: 'Menu1'),
PlutoMenuItem(title: 'Menu2'),
];
}
@override
Widget build(BuildContext context) {
return PlutoMenuBar(menus: menus);
}
}