mobile_skt/lib/widgets/sk_appbar.dart

36 lines
932 B
Dart
Raw Normal View History

2024-04-01 08:41:52 +08:00
import 'package:flutter/material.dart';
2024-04-01 14:59:20 +08:00
import 'package:sk_base_mobile/util/util.dart';
2024-04-01 08:41:52 +08:00
class SkAppbar extends StatelessWidget implements PreferredSizeWidget {
final String title;
2024-04-01 14:27:44 +08:00
final List<Widget>? action;
final bool hideLeading;
const SkAppbar(
{super.key, required this.title, this.action, this.hideLeading = false});
2024-04-01 08:41:52 +08:00
@override
Widget build(BuildContext context) {
2024-04-01 14:27:44 +08:00
return AppBar(
leading: hideLeading
? const SizedBox()
: IconButton(
icon: Icon(
Icons.arrow_back_ios,
size: ScreenAdaper.height(40),
),
onPressed: () {
Navigator.pop(context);
},
),
2024-04-01 14:59:20 +08:00
title: Text(
title,
2024-04-01 17:35:34 +08:00
style: TextStyle(fontSize: ScreenAdaper.height(30)),
2024-04-01 14:59:20 +08:00
),
2024-04-01 14:27:44 +08:00
actions: action,
);
2024-04-01 08:41:52 +08:00
}
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight);
}