Solian/lib/widgets/app_bar_leading.dart

23 lines
573 B
Dart

import 'package:flutter/material.dart';
import 'package:solian/shells/root_shell.dart';
class AppBarLeadingButton extends StatelessWidget {
const AppBarLeadingButton({super.key});
@override
Widget build(BuildContext context) {
if (Navigator.canPop(context)) {
return BackButton(
onPressed: () => Navigator.pop(context),
);
}
if (rootScaffoldKey.currentState!.hasDrawer) {
return DrawerButton(
onPressed: () => rootScaffoldKey.currentState!.openDrawer(),
);
} else {
return const SizedBox();
}
}
}