Solian/lib/shells/title_shell.dart

41 lines
1.0 KiB
Dart
Raw Normal View History

2024-06-27 06:31:15 +00:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import 'package:solian/theme.dart';
import 'package:solian/widgets/app_bar_title.dart';
import 'package:solian/widgets/app_bar_leading.dart';
2024-06-27 06:31:15 +00:00
class TitleShell extends StatelessWidget {
final bool showAppBar;
final bool isCenteredTitle;
2024-08-01 20:42:38 +00:00
final String? title;
final GoRouterState? state;
2024-06-27 06:31:15 +00:00
final Widget child;
const TitleShell({
super.key,
required this.child,
2024-08-01 20:42:38 +00:00
this.title,
this.state,
2024-06-27 06:31:15 +00:00
this.showAppBar = true,
this.isCenteredTitle = false,
2024-06-27 06:31:15 +00:00
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: showAppBar
? AppBar(
2024-07-12 14:37:58 +00:00
leading: AppBarLeadingButton.adaptive(context),
2024-08-01 20:42:38 +00:00
title: AppBarTitle(
title ?? (state!.topRoute?.name?.tr ?? 'page'.tr),
),
centerTitle: isCenteredTitle,
2024-07-12 03:39:44 +00:00
toolbarHeight: SolianTheme.toolbarHeight(context),
)
2024-06-27 06:31:15 +00:00
: null,
body: child,
);
}
}