mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
3ae4d69110
Fixes all issues in `flutter analyze`. <Reviewed> Commits: * chore: migrate deprecated text style * chore: migrate `toggleableActiveColor` to individual theme * chore: don't use 'BuildContext's across async gaps
51 lines
1.4 KiB
Dart
51 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CustomSliverAppBar extends StatelessWidget {
|
|
const CustomSliverAppBar({
|
|
Key? key,
|
|
required this.title,
|
|
this.actions,
|
|
this.bottom,
|
|
this.isMainView = false,
|
|
this.onBackButtonPressed,
|
|
}) : super(key: key);
|
|
final Widget title;
|
|
final List<Widget>? actions;
|
|
final PreferredSizeWidget? bottom;
|
|
final bool isMainView;
|
|
final Function()? onBackButtonPressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SliverAppBar(
|
|
pinned: true,
|
|
expandedHeight: 100.0,
|
|
automaticallyImplyLeading: !isMainView,
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
titlePadding: EdgeInsets.only(
|
|
bottom: bottom != null ? 16.0 : 14.0,
|
|
left: isMainView ? 20.0 : 55.0,
|
|
),
|
|
title: title,
|
|
),
|
|
leading: isMainView
|
|
? null
|
|
: IconButton(
|
|
icon: Icon(
|
|
Icons.arrow_back,
|
|
color: Theme.of(context).textTheme.titleLarge!.color,
|
|
),
|
|
onPressed:
|
|
onBackButtonPressed ?? () => Navigator.of(context).pop(),
|
|
),
|
|
backgroundColor: MaterialStateColor.resolveWith(
|
|
(states) => states.contains(MaterialState.scrolledUnder)
|
|
? Theme.of(context).colorScheme.surface
|
|
: Theme.of(context).canvasColor,
|
|
),
|
|
actions: actions,
|
|
bottom: bottom,
|
|
);
|
|
}
|
|
}
|