feat: tabbed settings dialog (pill tabs, full-bleed panel), hover color setting, title bar grab cursor (v1.9.2)
This commit is contained in:
1 parent
1a6de71ff6
commit
701eafa744
12 files changed
+1064
-221
No files matched your search
@@ -1,13 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
class CustomTitleBar extends StatelessWidget {
|
||||
import '../services/hover_color.dart';
|
||||
|
||||
class CustomTitleBar extends StatefulWidget {
|
||||
final VoidCallback? onSettings;
|
||||
final VoidCallback? onSaveCrop;
|
||||
final bool visible;
|
||||
|
||||
const CustomTitleBar({super.key, this.onSettings, this.onSaveCrop, this.visible = true});
|
||||
|
||||
@override
|
||||
State<CustomTitleBar> createState() => _CustomTitleBarState();
|
||||
}
|
||||
|
||||
class _CustomTitleBarState extends State<CustomTitleBar> {
|
||||
bool _barHovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
@@ -15,55 +24,66 @@ class CustomTitleBar extends StatelessWidget {
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: AnimatedOpacity(
|
||||
opacity: visible ? 1.0 : 0.0,
|
||||
opacity: widget.visible ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: DragToMoveArea(
|
||||
child: SizedBox(
|
||||
height: 24,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (onSettings != null)
|
||||
Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_BarButton(
|
||||
icon: Icons.settings,
|
||||
onTap: onSettings!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.grab,
|
||||
onEnter: (_) => setState(() => _barHovered = true),
|
||||
onExit: (_) => setState(() => _barHovered = false),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 120),
|
||||
color: _barHovered
|
||||
? Colors.white.withValues(alpha: 0.06)
|
||||
: Colors.transparent,
|
||||
child: DragToMoveArea(
|
||||
child: SizedBox(
|
||||
height: 24,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (onSaveCrop != null)
|
||||
_BarButton(
|
||||
icon: Icons.save_outlined,
|
||||
onTap: onSaveCrop!,
|
||||
Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.onSettings != null)
|
||||
_BarButton(
|
||||
icon: Icons.settings,
|
||||
onTap: widget.onSettings!,
|
||||
),
|
||||
if (widget.onSaveCrop != null)
|
||||
_BarButton(
|
||||
icon: Icons.save_outlined,
|
||||
onTap: widget.onSaveCrop!,
|
||||
),
|
||||
],
|
||||
),
|
||||
_BarButton(
|
||||
icon: Icons.horizontal_rule,
|
||||
onTap: () => windowManager.minimize(),
|
||||
),
|
||||
_BarButton(
|
||||
icon: Icons.close,
|
||||
onTap: () => windowManager.close(),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_BarButton(
|
||||
icon: Icons.horizontal_rule,
|
||||
onTap: () => windowManager.minimize(),
|
||||
),
|
||||
_BarButton(
|
||||
icon: Icons.close,
|
||||
onTap: () => windowManager.close(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -93,14 +113,17 @@ class _BarButtonState extends State<_BarButton> {
|
||||
cursor: SystemMouseCursors.click,
|
||||
onEnter: (_) => setState(() => _hovered = true),
|
||||
onExit: (_) => setState(() => _hovered = false),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 24,
|
||||
color: _hovered ? Colors.red.withValues(alpha: 0.8) : Colors.transparent,
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
child: ValueListenableBuilder<Color>(
|
||||
valueListenable: HoverColor.notifier,
|
||||
builder: (context, hover, _) => Container(
|
||||
width: 32,
|
||||
height: 24,
|
||||
color: _hovered ? hover.withValues(alpha: 0.8) : Colors.transparent,
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user