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';
|
2024-07-12 14:31:45 +00:00
|
|
|
import 'package:solian/widgets/app_bar_leading.dart';
|
2024-09-08 04:32:21 +00:00
|
|
|
import 'package:solian/widgets/current_state_action.dart';
|
2024-06-27 06:31:15 +00:00
|
|
|
|
|
|
|
class TitleShell extends StatelessWidget {
|
|
|
|
final bool showAppBar;
|
2024-07-13 10:54:08 +00:00
|
|
|
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,
|
2024-07-13 10:54:08 +00:00
|
|
|
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),
|
|
|
|
),
|
2024-07-13 10:54:08 +00:00
|
|
|
centerTitle: isCenteredTitle,
|
2024-07-12 03:39:44 +00:00
|
|
|
toolbarHeight: SolianTheme.toolbarHeight(context),
|
2024-09-08 04:32:21 +00:00
|
|
|
actions: [
|
|
|
|
const BackgroundStateWidget(),
|
|
|
|
SizedBox(
|
|
|
|
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
|
|
|
|
),
|
|
|
|
],
|
2024-07-12 03:39:44 +00:00
|
|
|
)
|
2024-06-27 06:31:15 +00:00
|
|
|
: null,
|
|
|
|
body: child,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|