mobile_skt/lib/widgets/sk_appbar.dart

53 lines
1.4 KiB
Dart
Raw Normal View History

2024-04-01 08:41:52 +08:00
import 'package:flutter/material.dart';
import 'package:sk_base_mobile/app_theme.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;
final PreferredSizeWidget? bottom;
final Color? backgroundColor;
final Color? iconAndTextColor;
const SkAppbar(
{super.key,
required this.title,
this.action,
this.hideLeading = false,
this.backgroundColor,
this.iconAndTextColor,
this.bottom});
2024-04-01 08:41:52 +08:00
@override
Widget build(BuildContext context) {
2024-04-01 14:27:44 +08:00
return AppBar(
titleTextStyle: TextStyle(
color: iconAndTextColor,
fontWeight: FontWeight.w600,
letterSpacing: ScreenAdaper.width(2)),
backgroundColor: backgroundColor,
bottom: bottom,
leading: hideLeading
? const SizedBox()
: IconButton(
icon: Icon(
Icons.arrow_back_ios,
size: ScreenAdaper.height(40),
color: iconAndTextColor,
),
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);
}