76 lines
2.4 KiB
Dart
76 lines
2.4 KiB
Dart
import 'package:didvan/config/theme_data.dart';
|
|
import 'package:didvan/constants/app_icons.dart';
|
|
import 'package:didvan/models/view/app_bar_data.dart';
|
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class DidvanAppBar extends StatelessWidget {
|
|
final AppBarData appBarData;
|
|
final bool hasBorder;
|
|
final Color? backgroundColor;
|
|
const DidvanAppBar({
|
|
Key? key,
|
|
required this.appBarData,
|
|
this.hasBorder = false,
|
|
this.backgroundColor = Colors.transparent,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: appBarData.isSmall ? 56 : 72,
|
|
width: MediaQuery.of(context).size.width,
|
|
padding:
|
|
EdgeInsets.only(right: 4, left: appBarData.trailing == null ? 20 : 0),
|
|
decoration: BoxDecoration(
|
|
border: hasBorder
|
|
? Border(
|
|
bottom: BorderSide(
|
|
color: Theme.of(context).colorScheme.cardBorder,
|
|
),
|
|
)
|
|
: null,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
color: Theme.of(context).colorScheme.title,
|
|
icon: const Icon(
|
|
DidvanIcons.back_regular,
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Align(
|
|
alignment: Alignment.centerRight,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
if (appBarData.title != null)
|
|
DidvanText(
|
|
appBarData.title!,
|
|
style: Theme.of(context).textTheme.headline3,
|
|
color: Theme.of(context).colorScheme.title,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
if (appBarData.subtitle != null)
|
|
DidvanText(
|
|
appBarData.subtitle!,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.clip,
|
|
style: Theme.of(context).textTheme.overline,
|
|
color: Theme.of(context).colorScheme.caption,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if (appBarData.trailing != null) appBarData.trailing!,
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|