2022-09-02 15:35:25 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class CustomSliverAppBar extends StatelessWidget {
|
|
|
|
final Widget title;
|
2022-09-06 15:40:49 +02:00
|
|
|
final List<Widget>? actions;
|
2022-09-02 15:35:25 +02:00
|
|
|
final PreferredSizeWidget? bottom;
|
|
|
|
|
|
|
|
const CustomSliverAppBar({
|
|
|
|
Key? key,
|
|
|
|
required this.title,
|
2022-09-06 15:40:49 +02:00
|
|
|
this.actions,
|
2022-09-02 15:35:25 +02:00
|
|
|
this.bottom,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SliverAppBar(
|
|
|
|
pinned: true,
|
|
|
|
snap: false,
|
|
|
|
floating: false,
|
|
|
|
expandedHeight: 100.0,
|
|
|
|
automaticallyImplyLeading: false,
|
|
|
|
backgroundColor: MaterialStateColor.resolveWith(
|
|
|
|
(states) => states.contains(MaterialState.scrolledUnder)
|
2022-09-05 04:32:36 +02:00
|
|
|
? Theme.of(context).colorScheme.surface
|
|
|
|
: Theme.of(context).canvasColor,
|
2022-09-02 15:35:25 +02:00
|
|
|
),
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
titlePadding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 23.0,
|
|
|
|
horizontal: 20.0,
|
|
|
|
),
|
|
|
|
title: title,
|
|
|
|
),
|
2022-09-06 15:40:49 +02:00
|
|
|
actions: actions,
|
2022-09-02 15:35:25 +02:00
|
|
|
bottom: bottom,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|