@@ -9,25 +9,24 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
void main() => runApp(const ContextMenuControllerExampleApp());
|
||||
|
||||
/// A builder that includes an Offset to draw the context menu at.
|
||||
typedef ContextMenuBuilder = Widget Function(BuildContext context, Offset offset);
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
class ContextMenuControllerExampleApp extends StatefulWidget {
|
||||
const ContextMenuControllerExampleApp({super.key});
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
State<ContextMenuControllerExampleApp> createState() => _ContextMenuControllerExampleAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
void _showDialog (BuildContext context) {
|
||||
class _ContextMenuControllerExampleAppState extends State<ContextMenuControllerExampleApp> {
|
||||
void _showDialog(BuildContext context) {
|
||||
Navigator.of(context).push(
|
||||
DialogRoute<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) =>
|
||||
const AlertDialog(title: Text('You clicked print!')),
|
||||
builder: (BuildContext context) => const AlertDialog(title: Text('You clicked print!')),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -82,7 +81,8 @@ class _MyAppState extends State<MyApp> {
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Container(height: 20.0),
|
||||
const Text('Right click (desktop) or long press (mobile) anywhere, not just on this text, to show the custom menu.'),
|
||||
const Text(
|
||||
'Right click (desktop) or long press (mobile) anywhere, not just on this text, to show the custom menu.'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user