@@ -24,6 +24,7 @@ class CodeJudgeDesktopAndTabletItem extends StatelessWidget{
2424 final ValueChanged <Offset >? onMenuClick;
2525 final String note;
2626 final bool isSelected;
27+ final bool showMenu;
2728
2829 const CodeJudgeDesktopAndTabletItem ({
2930 super .key,
@@ -34,6 +35,7 @@ class CodeJudgeDesktopAndTabletItem extends StatelessWidget{
3435 this .onMenuClick,
3536 this .note = "" ,
3637 this .isSelected = false ,
38+ this .showMenu = true ,
3739 });
3840
3941 @override
@@ -72,26 +74,28 @@ class CodeJudgeDesktopAndTabletItem extends StatelessWidget{
7274 ),
7375 child: Stack ( // Draw the content of the item
7476 children: [
75- Positioned (
76- top: 2 ,
77- right: 2 ,
78- child: IconButton (
79- key: buttonKey,
80- onPressed: () {
81- // Get the position of the button
82- final RenderBox button = buttonKey.currentContext! .findRenderObject () as RenderBox ;
83- Offset position = button.localToGlobal (Offset .zero,);
77+ showMenu
78+ ? Positioned (
79+ top: 2 ,
80+ right: 2 ,
81+ child: IconButton (
82+ key: buttonKey,
83+ onPressed: () {
84+ // Get the position of the button
85+ final RenderBox button = buttonKey.currentContext! .findRenderObject () as RenderBox ;
86+ Offset position = button.localToGlobal (Offset .zero,);
8487
85- if (onMenuClick != null ) {
86- onMenuClick! .call (position);
87- }
88- },
89- icon: Icon (
90- Icons .more_vert_outlined,
91- size: 20 ,
88+ if (onMenuClick != null ) {
89+ onMenuClick! .call (position);
90+ }
91+ },
92+ icon: Icon (
93+ Icons .more_vert_outlined,
94+ size: 20 ,
95+ ),
9296 ),
93- ),
94- ),
97+ )
98+ : SizedBox . shrink ( ),
9599 Center (
96100 child: Text (title, style: TextStyle (fontSize: 16 , fontWeight: FontWeight .bold))
97101 ),
@@ -116,6 +120,7 @@ class CodeJudgeMobileItem extends StatelessWidget {
116120 final ValueChanged <Offset >? onMenuClick;
117121 final String note;
118122 final bool isSelected;
123+ final bool showMenu;
119124
120125 const CodeJudgeMobileItem ({
121126 super .key,
@@ -126,6 +131,7 @@ class CodeJudgeMobileItem extends StatelessWidget {
126131 this .onMenuClick,
127132 this .note = "" ,
128133 this .isSelected = false ,
134+ this .showMenu = true ,
129135 });
130136
131137 @override
@@ -175,22 +181,24 @@ class CodeJudgeMobileItem extends StatelessWidget {
175181 padding: const EdgeInsets .only (right: 8.0 ),
176182 child: Text (note, style: TextStyle (fontSize: 12 , fontWeight: FontWeight .w200)),
177183 ),
178- IconButton (
179- key: buttonKey,
180- onPressed: () {
181- // Get the position of the button
182- final RenderBox button = buttonKey.currentContext! .findRenderObject () as RenderBox ;
183- Offset position = button.localToGlobal (Offset .zero,);
184+ showMenu
185+ ? IconButton (
186+ key: buttonKey,
187+ onPressed: () {
188+ // Get the position of the button
189+ final RenderBox button = buttonKey.currentContext! .findRenderObject () as RenderBox ;
190+ Offset position = button.localToGlobal (Offset .zero,);
184191
185- if (onMenuClick != null ) {
186- onMenuClick! .call (position);
187- }
188- },
189- icon: Icon (
190- Icons .more_vert_outlined,
191- size: 20 ,
192- ),
193- ),
192+ if (onMenuClick != null ) {
193+ onMenuClick! .call (position);
194+ }
195+ },
196+ icon: Icon (
197+ Icons .more_vert_outlined,
198+ size: 20 ,
199+ ),
200+ )
201+ : SizedBox .shrink (),
194202 ],
195203 )
196204 ),
0 commit comments