Files
flutter_server_box/lib/view/page/home/appbar.dart
lollipopkit🏳️‍⚧️ 6e7fee20b8 opt.: routes
2025-04-10 15:28:47 +08:00

44 lines
1.0 KiB
Dart

part of 'home.dart';
final class _AppBar extends StatelessWidget implements PreferredSizeWidget {
final double paddingTop;
const _AppBar(this.paddingTop);
@override
Widget build(BuildContext context) {
return SizedBox(
height: preferredSize.height,
child: isIOS ? Center(child: _buildLogo()) : null,
);
}
Widget _buildLogo() {
final text = Text(
BuildData.name,
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: UIs.primaryColor.isBrightColor ? Colors.black : Colors.white,
),
);
return Container(
decoration: BoxDecoration(
color: UIs.primaryColor,
borderRadius: BorderRadius.circular(11),
),
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
child: text,
);
}
@override
Size get preferredSize {
final height = switch (Pfs.type) {
Pfs.macos => paddingTop + CustomAppBar.sysStatusBarHeight,
_ => paddingTop,
};
return Size.fromHeight(height);
}
}