mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
22
lib/view/widget/custom_appbar.dart
Normal file
22
lib/view/widget/custom_appbar.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:macos_window_utils/window_manipulator.dart';
|
||||
|
||||
double? _titlebarHeight;
|
||||
|
||||
class CustomAppBar extends AppBar implements PreferredSizeWidget {
|
||||
CustomAppBar({
|
||||
super.key,
|
||||
super.title,
|
||||
super.actions,
|
||||
super.centerTitle,
|
||||
super.leading,
|
||||
super.backgroundColor,
|
||||
}) : super(toolbarHeight: (_titlebarHeight ?? 0) + kToolbarHeight);
|
||||
|
||||
static Future<void> updateTitlebarHeight() async {
|
||||
final newTitlebarHeight = await WindowManipulator.getTitlebarHeight();
|
||||
if (_titlebarHeight != newTitlebarHeight) {
|
||||
_titlebarHeight = newTitlebarHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user