mirror of
https://github.com/foss42/apidash.git
synced 2025-05-30 05:21:15 +08:00
fix: review changes
This commit is contained in:
84
lib/screens/common_widgets/editor_title_actions.dart
Normal file
84
lib/screens/common_widgets/editor_title_actions.dart
Normal file
@ -0,0 +1,84 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user