mirror of
https://github.com/foss42/apidash.git
synced 2025-05-23 17:26:45 +08:00
85 lines
2.3 KiB
Dart
85 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:apidash/consts.dart';
|
|
|
|
class EditorTitleActions extends StatelessWidget {
|
|
const EditorTitleActions({
|
|
super.key,
|
|
this.onRenamePressed,
|
|
this.onDuplicatePressed,
|
|
this.onDeletePressed,
|
|
});
|
|
|
|
final void Function()? onRenamePressed;
|
|
final void Function()? onDuplicatePressed;
|
|
final void Function()? onDeletePressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var verticalDivider = VerticalDivider(
|
|
width: 2,
|
|
color: Theme.of(context).colorScheme.outlineVariant,
|
|
);
|
|
return ClipRRect(
|
|
borderRadius: kBorderRadius20,
|
|
child: Material(
|
|
color: Colors.transparent,
|
|
child: Ink(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: Theme.of(context).colorScheme.outlineVariant,
|
|
),
|
|
borderRadius: kBorderRadius20,
|
|
),
|
|
child: SizedBox(
|
|
height: 32,
|
|
child: IntrinsicHeight(
|
|
child: Row(
|
|
children: [
|
|
iconButton(
|
|
"Rename",
|
|
Icons.edit_rounded,
|
|
onRenamePressed,
|
|
padding: const EdgeInsets.only(left: 4),
|
|
),
|
|
verticalDivider,
|
|
iconButton(
|
|
"Delete",
|
|
Icons.delete_rounded,
|
|
onDeletePressed,
|
|
),
|
|
verticalDivider,
|
|
iconButton(
|
|
"Duplicate",
|
|
Icons.copy_rounded,
|
|
onDuplicatePressed,
|
|
padding: const EdgeInsets.only(right: 4),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget iconButton(
|
|
String tooltip, IconData iconData, void Function()? onPressed,
|
|
{EdgeInsets padding = const EdgeInsets.all(0)}) {
|
|
return Tooltip(
|
|
message: tooltip,
|
|
child: IconButton(
|
|
style: ButtonStyle(
|
|
padding: MaterialStateProperty.all(const EdgeInsets.all(0) + padding),
|
|
shape: MaterialStateProperty.all(const ContinuousRectangleBorder()),
|
|
),
|
|
onPressed: onPressed,
|
|
icon: Icon(
|
|
iconData,
|
|
size: 16,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|