mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-27 14:23:18 +03:00
32 lines
753 B
Dart
Executable File
32 lines
753 B
Dart
Executable File
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
PopupMenuItem buildMenuItem({
|
|
required Widget title,
|
|
Widget? leading,
|
|
String? trailing,
|
|
void Function()? action,
|
|
}) =>
|
|
PopupMenuItem(
|
|
enabled: action != null,
|
|
onTap: () {
|
|
// Wait for popup menu to close before running action.
|
|
Timer.run(action!);
|
|
},
|
|
child: ListTile(
|
|
enabled: action != null,
|
|
dense: true,
|
|
contentPadding: EdgeInsets.zero,
|
|
minLeadingWidth: 0,
|
|
title: title,
|
|
leading: leading,
|
|
trailing: trailing != null
|
|
? Opacity(
|
|
opacity: 0.5,
|
|
child: Text(trailing, textScaleFactor: 0.7),
|
|
)
|
|
: null,
|
|
),
|
|
);
|