mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
a54ca799b9
* update rules of analysis_options.yaml. and solved all problems * refactor: fix remaining problems --------- Co-authored-by: Ushie <ushiekane@gmail.com>
40 lines
1.1 KiB
Dart
40 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CustomPopupMenu extends StatelessWidget {
|
|
const CustomPopupMenu({
|
|
Key? key,
|
|
required this.onSelected,
|
|
required this.children,
|
|
}) : super(key: key);
|
|
final Function(dynamic) onSelected;
|
|
final Map<int, Widget> children;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Theme(
|
|
data: Theme.of(context).copyWith(useMaterial3: false),
|
|
child: PopupMenuButton<int>(
|
|
icon: Icon(
|
|
Icons.more_vert,
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
),
|
|
onSelected: onSelected,
|
|
itemBuilder: (context) => children.entries
|
|
.map(
|
|
(entry) => PopupMenuItem<int>(
|
|
padding: const EdgeInsets.all(16.0).copyWith(right: 20),
|
|
value: entry.key,
|
|
child: entry.value,
|
|
),
|
|
)
|
|
.toList(),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(24),
|
|
),
|
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
|
position: PopupMenuPosition.under,
|
|
),
|
|
);
|
|
}
|
|
}
|