Solian/lib/shells/centered_shell.dart
LittleSheep b449735bf5 Better side navigation
🐛 Bug fixes and optimizations
2024-09-13 20:22:10 +08:00

40 lines
1.0 KiB
Dart

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_leading.dart';
import 'package:solian/widgets/app_bar_title.dart';
class CenteredShell extends StatelessWidget {
final bool showAppBar;
final GoRouterState state;
final Widget child;
const CenteredShell({
super.key,
required this.child,
required this.state,
this.showAppBar = true,
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: showAppBar
? AppBar(
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle(state.topRoute?.name?.tr ?? 'page'.tr),
centerTitle: false,
toolbarHeight: AppTheme.toolbarHeight(context),
)
: null,
body: Center(
child: Container(
constraints: const BoxConstraints(maxWidth: 640),
child: child,
),
),
);
}
}