disable_web_context_menu 1.0.0+2 disable_web_context_menu: ^1.0.0+2 copied to clipboard
Disables the web context menu for a given widget
import 'package:disable_web_context_menu/disable_web_context_menu.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: DisableWebContextMenu(
child: Container(
width: 200,
height: 200,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(Radius.circular(16)),
),
child: Text(
'This container disables the native context menu on right click',
textAlign: TextAlign.center,
),
),
),
),
);
}
}