mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: custom context menu style
This commit is contained in:
parent
fac76ac5b8
commit
a702c06dc8
@ -30,26 +30,43 @@ class ContextMenu extends StatelessWidget {
|
||||
final children = <Widget>[];
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
for (var j = 0; j < items[i].length; j++) {
|
||||
var onHover = false;
|
||||
children.add(
|
||||
Material(
|
||||
child: InkWell(
|
||||
hoverColor: const Color(0xFFE0F8FF),
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
onTap: () {
|
||||
items[i][j].onPressed(editorState);
|
||||
onPressed();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
items[i][j].name,
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
StatefulBuilder(
|
||||
builder: (BuildContext context, setState) {
|
||||
return Material(
|
||||
color: editorState.editorStyle.selectionMenuBackgroundColor,
|
||||
child: InkWell(
|
||||
hoverColor:
|
||||
editorState.editorStyle.selectionMenuItemSelectedColor,
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
onTap: () {
|
||||
items[i][j].onPressed(editorState);
|
||||
onPressed();
|
||||
},
|
||||
onHover: (value) => setState(() {
|
||||
onHover = value;
|
||||
}),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
items[i][j].name,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: onHover
|
||||
? editorState
|
||||
.editorStyle.selectionMenuItemSelectedTextColor
|
||||
: editorState
|
||||
.editorStyle.selectionMenuItemTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -67,7 +84,7 @@ class ContextMenu extends StatelessWidget {
|
||||
minWidth: 140,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: editorState.editorStyle.selectionMenuBackgroundColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 5,
|
||||
|
Loading…
Reference in New Issue
Block a user