
* Update CupertinoContextMenu to iOS 16 visuals * Revert some formatting * Remove space * Remove formatting changes, add more comments * Added shadow effect * Update context menu tests * Remove white spaces * Remove unused variable * Refactor type checking logic * Set default previewBuilder and update tests * Check for border radius * Remove trailing spaces * Add builder to constructor * Update previewBuilder Rebase to master * Update builder and tests * Remove trailing spaces * Update examples * Refactor builder * Update builder to use one animation * Update scale * Change deprecation message, remove white spaces * Change deprecation message * Change deprecation message * Change deprecation message * Update documentation * Update documentation * Update documentation and examples * Update documentation and examples * Remove white spaces * Remove white spaces * Remove const * Address linting errors * Seperate builder into own constructor * Remove trailing characters * Formatting changes * Remove white spaces * Change ignore comment * Add TODO * Remove whitespace
80 lines
2.3 KiB
Dart
80 lines
2.3 KiB
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
/// Flutter code sample for [CupertinoContextMenu].
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
void main() => runApp(const ContextMenuApp());
|
|
|
|
class ContextMenuApp extends StatelessWidget {
|
|
const ContextMenuApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const CupertinoApp(
|
|
theme: CupertinoThemeData(brightness: Brightness.light),
|
|
home: ContextMenuExample(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ContextMenuExample extends StatelessWidget {
|
|
const ContextMenuExample({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CupertinoPageScaffold(
|
|
navigationBar: const CupertinoNavigationBar(
|
|
middle: Text('CupertinoContextMenu Sample'),
|
|
),
|
|
child: Center(
|
|
child: SizedBox(
|
|
width: 100,
|
|
height: 100,
|
|
child: CupertinoContextMenu(
|
|
actions: <Widget>[
|
|
CupertinoContextMenuAction(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
isDefaultAction: true,
|
|
trailingIcon: CupertinoIcons.doc_on_clipboard_fill,
|
|
child: const Text('Copy'),
|
|
),
|
|
CupertinoContextMenuAction(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
trailingIcon: CupertinoIcons.share,
|
|
child: const Text('Share'),
|
|
),
|
|
CupertinoContextMenuAction(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
trailingIcon: CupertinoIcons.heart,
|
|
child: const Text('Favorite'),
|
|
),
|
|
CupertinoContextMenuAction(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
isDestructiveAction: true,
|
|
trailingIcon: CupertinoIcons.delete,
|
|
child: const Text('Delete'),
|
|
),
|
|
],
|
|
child: Container(
|
|
color: CupertinoColors.systemYellow,
|
|
child: const FlutterLogo(size: 500.0),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|