feat(proj): init
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:please_pay_me/theme/tokens.dart';
|
||||
import 'package:please_pay_me/ui/atoms/app_text.dart';
|
||||
|
||||
/// Standard iOS navigation bar (44pt) with optional subtitle line.
|
||||
class AppNavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
const AppNavBar({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.leading,
|
||||
this.trailing,
|
||||
this.previousPageTitle,
|
||||
this.transparent = false,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String? subtitle;
|
||||
final Widget? leading;
|
||||
final Widget? trailing;
|
||||
final String? previousPageTitle;
|
||||
final bool transparent;
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(44);
|
||||
|
||||
@override
|
||||
bool shouldFullyObstruct(BuildContext context) => !transparent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoNavigationBar(
|
||||
leading: leading,
|
||||
trailing: trailing,
|
||||
previousPageTitle: previousPageTitle,
|
||||
backgroundColor: transparent
|
||||
? const Color(0x00000000)
|
||||
: AppColors.of(context, AppColors.barBackground),
|
||||
border: transparent
|
||||
? null
|
||||
: Border(
|
||||
bottom: BorderSide(
|
||||
color: AppColors.of(context, AppColors.separator),
|
||||
width: AppSizes.hairline,
|
||||
),
|
||||
),
|
||||
middle: subtitle == null
|
||||
? AppText.headline(title)
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AppText.headline(title, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
AppText.caption(
|
||||
subtitle!,
|
||||
color: AppColors.secondaryLabel,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Large-title bar for the root of a scrollable screen.
|
||||
class AppLargeNavBar extends StatelessWidget {
|
||||
const AppLargeNavBar({super.key, required this.title, this.trailing});
|
||||
|
||||
final String title;
|
||||
final Widget? trailing;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoSliverNavigationBar(
|
||||
largeTitle: AppText.largeTitle(title),
|
||||
trailing: trailing,
|
||||
backgroundColor: AppColors.of(context, AppColors.barBackground),
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: AppColors.of(context, AppColors.separator),
|
||||
width: AppSizes.hairline,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user