57 lines
1.5 KiB
Dart
57 lines
1.5 KiB
Dart
import 'package:fcs/helpers/theme.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'local_text.dart';
|
|
|
|
class LocalAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
final String? labelKey;
|
|
final Color? backgroundColor;
|
|
final Color? labelColor;
|
|
final Color? arrowColor;
|
|
final List<Widget>? actions;
|
|
final Widget? titleWidget;
|
|
final Function()? onBack;
|
|
final bool centerTitle;
|
|
|
|
const LocalAppBar(
|
|
{Key? key,
|
|
this.labelKey,
|
|
this.backgroundColor = primaryColor,
|
|
this.labelColor,
|
|
this.arrowColor = Colors.white,
|
|
this.actions,
|
|
this.titleWidget,
|
|
this.onBack,
|
|
this.centerTitle = true})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Size get preferredSize => const Size.fromHeight(56);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppBar(
|
|
elevation: 0,
|
|
centerTitle: centerTitle,
|
|
leading: IconButton(
|
|
icon: Icon(CupertinoIcons.back, color: arrowColor, size: 25),
|
|
onPressed: () {
|
|
if (onBack != null) {
|
|
onBack!();
|
|
} else {
|
|
Navigator.of(context).pop();
|
|
}
|
|
}),
|
|
shadowColor: Colors.transparent,
|
|
backgroundColor: backgroundColor,
|
|
surfaceTintColor: backgroundColor,
|
|
title: titleWidget ??
|
|
(labelKey != null
|
|
? LocalText(context, labelKey!,
|
|
color: labelColor ?? Colors.white, fontSize: 20)
|
|
: const SizedBox()),
|
|
actions: actions,
|
|
);
|
|
}
|
|
}
|