mobile_skt/lib/widgets/core/sk_appbar.dart

58 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:sk_base_mobile/util/util.dart';
class SkAppbar extends StatelessWidget implements PreferredSizeWidget {
final String title;
final List<Widget>? action;
final bool hideLeading;
final PreferredSizeWidget? bottom;
final Color? backgroundColor;
final Color? iconAndTextColor;
final Function()? onPop;
const SkAppbar(
{super.key,
required this.title,
this.action,
this.hideLeading = false,
this.backgroundColor,
this.iconAndTextColor,
this.onPop,
this.bottom});
@override
Widget build(BuildContext context) {
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: () async {
if (onPop != null) {
onPop!();
} else {
Navigator.pop(context);
}
},
),
title: Text(
title,
style: TextStyle(fontSize: ScreenAdaper.height(30)),
),
actions: action,
);
}
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight);
}