2023-03-30 19:24:18 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-09-18 14:59:53 +00:00
|
|
|
import 'package:lightmeter/generated/l10n.dart';
|
2023-03-30 19:24:18 +00:00
|
|
|
import 'package:lightmeter/res/dimens.dart';
|
|
|
|
|
|
|
|
class SliverScreen extends StatelessWidget {
|
|
|
|
final String title;
|
|
|
|
final List<Widget> appBarActions;
|
|
|
|
final List<Widget> slivers;
|
|
|
|
|
|
|
|
const SliverScreen({
|
|
|
|
required this.title,
|
2023-09-18 14:59:53 +00:00
|
|
|
this.appBarActions = const [],
|
2023-03-30 19:24:18 +00:00
|
|
|
required this.slivers,
|
|
|
|
super.key,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: SafeArea(
|
|
|
|
top: false,
|
|
|
|
bottom: false,
|
|
|
|
child: CustomScrollView(
|
|
|
|
slivers: <Widget>[
|
|
|
|
SliverAppBar(
|
|
|
|
pinned: true,
|
|
|
|
automaticallyImplyLeading: false,
|
2023-09-02 08:32:08 +00:00
|
|
|
expandedHeight: Dimens.sliverAppBarExpandedHeight,
|
2023-03-30 19:24:18 +00:00
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
centerTitle: false,
|
|
|
|
titlePadding: const EdgeInsets.all(Dimens.paddingM),
|
|
|
|
title: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
|
|
fontSize: Dimens.grid24,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-09-18 14:59:53 +00:00
|
|
|
actions: [
|
|
|
|
...appBarActions,
|
|
|
|
if (Navigator.of(context).canPop())
|
|
|
|
IconButton(
|
|
|
|
onPressed: Navigator.of(context).pop,
|
2024-05-20 15:08:37 +00:00
|
|
|
icon: const Icon(Icons.close_outlined),
|
2023-09-18 14:59:53 +00:00
|
|
|
tooltip: S.of(context).tooltipClose,
|
|
|
|
),
|
|
|
|
],
|
2023-03-30 19:24:18 +00:00
|
|
|
),
|
|
|
|
...slivers,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|