mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-11 00:10:29 -07:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
|
|
@ -0,0 +1,59 @@
|
|||
import 'package:fladder/screens/shared/default_titlebar.dart';
|
||||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
bool get _isDesktop {
|
||||
if (kIsWeb) return false;
|
||||
return [
|
||||
TargetPlatform.windows,
|
||||
TargetPlatform.linux,
|
||||
TargetPlatform.macOS,
|
||||
].contains(defaultTargetPlatform);
|
||||
}
|
||||
|
||||
class FladderAppbar extends StatelessWidget implements PreferredSize {
|
||||
final double height;
|
||||
final String? label;
|
||||
final bool automaticallyImplyLeading;
|
||||
const FladderAppbar({this.height = 35, this.automaticallyImplyLeading = false, this.label, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (AdaptiveLayout.of(context).isDesktop) {
|
||||
return PreferredSize(
|
||||
preferredSize: Size(double.infinity, height),
|
||||
child: SizedBox(
|
||||
height: height,
|
||||
child: Row(
|
||||
children: [
|
||||
if (automaticallyImplyLeading && context.canPop()) BackButton(),
|
||||
Expanded(
|
||||
child: DefaultTitleBar(
|
||||
label: label,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
} else {
|
||||
return AppBar(
|
||||
toolbarHeight: 0,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface.withOpacity(0),
|
||||
scrolledUnderElevation: 0,
|
||||
elevation: 0,
|
||||
systemOverlayStyle: SystemUiOverlayStyle(),
|
||||
title: const Text(""),
|
||||
automaticallyImplyLeading: automaticallyImplyLeading,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget get child => Container();
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size(double.infinity, _isDesktop ? height : 0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue