mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 11:35:56 +00:00
feat: add customed titlebar
This commit is contained in:
66
flutter/lib/desktop/widgets/titlebar_widget.dart
Normal file
66
flutter/lib/desktop/widgets/titlebar_widget.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const sidebarColor = Color(0xFF0C6AF6);
|
||||
const backgroundStartColor = Color(0xFF7BBCF5);
|
||||
const backgroundEndColor = Color(0xFF0CCBF6);
|
||||
|
||||
class DesktopTitleBar extends StatelessWidget {
|
||||
final Widget? child;
|
||||
|
||||
const DesktopTitleBar({Key? key, this.child}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [backgroundStartColor, backgroundEndColor],
|
||||
stops: [0.0, 1.0]),
|
||||
),
|
||||
child: WindowTitleBarBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: MoveWindow(
|
||||
child: child,
|
||||
)),
|
||||
const WindowButtons()
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final buttonColors = WindowButtonColors(
|
||||
iconNormal: const Color(0xFF805306),
|
||||
mouseOver: const Color(0xFFF6A00C),
|
||||
mouseDown: const Color(0xFF805306),
|
||||
iconMouseOver: const Color(0xFF805306),
|
||||
iconMouseDown: const Color(0xFFFFD500));
|
||||
|
||||
final closeButtonColors = WindowButtonColors(
|
||||
mouseOver: const Color(0xFFD32F2F),
|
||||
mouseDown: const Color(0xFFB71C1C),
|
||||
iconNormal: const Color(0xFF805306),
|
||||
iconMouseOver: Colors.white);
|
||||
|
||||
class WindowButtons extends StatelessWidget {
|
||||
const WindowButtons({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
MinimizeWindowButton(colors: buttonColors),
|
||||
MaximizeWindowButton(colors: buttonColors),
|
||||
CloseWindowButton(colors: closeButtonColors),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user