-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
268 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'dart:io'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:kazumi/utils/storage.dart'; | ||
|
||
class DesktopTitleBar extends StatefulWidget { | ||
const DesktopTitleBar({ | ||
super.key, | ||
required this.child, | ||
this.requireOffset = true, | ||
}); | ||
|
||
final Widget child; | ||
final bool requireOffset; | ||
|
||
@override | ||
State<StatefulWidget> createState() => _DesktopTitleBar(); | ||
} | ||
|
||
class _DesktopTitleBar extends State<DesktopTitleBar> { | ||
bool showWindowButton = | ||
GStorage.setting.get(SettingBoxKey.showWindowButton, defaultValue: false); | ||
|
||
EdgeInsets getInsets() { | ||
if (!showWindowButton) { | ||
return EdgeInsets.zero; | ||
} | ||
if (!widget.requireOffset) { | ||
return EdgeInsets.zero; | ||
} | ||
if (Platform.isMacOS) { | ||
return const EdgeInsets.only(top: 22); | ||
} else if (Platform.isWindows) { | ||
return const EdgeInsets.only(top: 32); | ||
} else { | ||
return EdgeInsets.zero; | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SafeArea( | ||
left: false, | ||
top: true, | ||
right: false, | ||
bottom: false, | ||
minimum: getInsets(), | ||
child: widget.child, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.