Untitled
unknown
dart
a year ago
2.3 kB
7
Indexable
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:providerbase/core/constants/assets.dart';
import 'package:providerbase/core/constants/navigator.dart';
import 'package:providerbase/presentation/notifiers/theme/theme_notifier.dart';
import 'package:providerbase/presentation/props/main_app_bar_props/main_app_bar_props.dart';
import 'package:providerbase/presentation/resources/color_manager.dart';
import 'package:providerbase/presentation/resources/font_manager.dart';
class MainAppBar extends StatelessWidget implements PreferredSizeWidget {
const MainAppBar({super.key, required this.props});
final MainAppBarProps props;
@override
Widget build(BuildContext context) {
ThemeNotifier themeNotifier = Provider.of<ThemeNotifier>(context);
return AppBar(
elevation: 1,
bottom: PreferredSize(
preferredSize: Size(100, 100),
child: props.bottom ?? SizedBox(),
),
titleSpacing: 0,
shadowColor: props.showSahdow == false
? Colors.transparent
: Colors.black.withOpacity(0.3),
backgroundColor: props.titleTextColor ?? Theme.of(context).primaryColor,
foregroundColor: Theme.of(context).primaryColor,
surfaceTintColor: Theme.of(context).primaryColor,
centerTitle: props.centerTitle,
leadingWidth: 60,
automaticallyImplyLeading: false,
leading: Padding(
padding: const EdgeInsets.only(right: 10),
child: IconButton(
onPressed: () => goBack(context: context),
icon: SvgPicture.asset(
Assets.backIcon,
color: props.titleTextColor != null ? ColorManager.white : null,
),
),
),
title: Text(
props.title,
style: themeNotifier.getTheme().textTheme.displaySmall?.copyWith(
fontSize: FontSize.s18,
color: props.titleTextColor != null
? ColorManager.white
: ColorManager.black,
fontWeight: FontWeight.w800),
),
actions: [props.trailing]);
}
@override
Size get preferredSize => Size.fromHeight(
props.bottom == null ? kToolbarHeight : kToolbarHeight + 60);
}
Editor is loading...
Leave a Comment