mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 00:40:39 +00:00
made SliverScreen
title a widget
This commit is contained in:
parent
dbdc0577b0
commit
cc2ab3b68a
5 changed files with 25 additions and 22 deletions
|
@ -1,15 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/about/widget_settings_section_about.dart';
|
import 'package:lightmeter/providers/films_provider.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/general/widget_settings_section_general.dart';
|
import 'package:lightmeter/screens/films/components/film_formula_input/widget_film_formula_input.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/lightmeter_pro/widget_settings_section_lightmeter_pro.dart';
|
|
||||||
import 'package:lightmeter/screens/settings/components/metering/widget_settings_section_metering.dart';
|
|
||||||
import 'package:lightmeter/screens/settings/components/shared/expandable_section_list/components/expandable_section_list_item/widget_expandable_section_list_item.dart';
|
|
||||||
import 'package:lightmeter/screens/settings/components/shared/expandable_section_list/widget_expandable_section_list.dart';
|
import 'package:lightmeter/screens/settings/components/shared/expandable_section_list/widget_expandable_section_list.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/theme/widget_settings_section_theme.dart';
|
|
||||||
import 'package:lightmeter/screens/settings/flow_settings.dart';
|
|
||||||
import 'package:lightmeter/screens/shared/sliver_screen/screen_sliver.dart';
|
import 'package:lightmeter/screens/shared/sliver_screen/screen_sliver.dart';
|
||||||
import 'package:lightmeter/utils/context_utils.dart';
|
|
||||||
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
|
@ -24,31 +18,29 @@ class _FilmsScreenState extends State<FilmsScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SliverScreen(
|
return SliverScreen(
|
||||||
title: 'Films',
|
title: Text('Films'),
|
||||||
appBarActions: [
|
appBarActions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: _addFilm,
|
||||||
icon: const Icon(Icons.add_outlined),
|
icon: const Icon(Icons.add_outlined),
|
||||||
tooltip: S.of(context).tooltipAdd,
|
tooltip: S.of(context).tooltipAdd,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
slivers: [
|
slivers: [
|
||||||
ExpandableSectionList<Film>(
|
ExpandableSectionList<FilmExponential>(
|
||||||
values: films,
|
values: [],
|
||||||
onSectionTitleTap: () {},
|
onSectionTitleTap: () {},
|
||||||
contentBuilder: (context, value) => [
|
contentBuilder: (context, value) => [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.iso),
|
leading: const Icon(Icons.iso),
|
||||||
title: Text(S.of(context).iso),
|
title: Text(S.of(context).iso),
|
||||||
trailing: Text(value.iso.toString()),
|
trailing: Text(value.iso.toString()),
|
||||||
onTap: () {
|
onTap: () {},
|
||||||
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.equalizer),
|
leading: const Icon(Icons.equalizer),
|
||||||
title: Text('Formula'),
|
title: Text('Formula'),
|
||||||
trailing: Text('x^1.34'),
|
trailing: Text(value.exponent.toString()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
actionsBuilder: (context, value) => [
|
actionsBuilder: (context, value) => [
|
||||||
|
@ -68,4 +60,15 @@ class _FilmsScreenState extends State<FilmsScreen> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _addFilm([EquipmentProfile? copyFrom]) {
|
||||||
|
showDialog<String>(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => const FilmFormulaDialog(),
|
||||||
|
).then((name) {
|
||||||
|
if (name != null) {
|
||||||
|
FilmsProvider.of(context).addFilm(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class LightmeterProScreen extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SliverScreen(
|
child: SliverScreen(
|
||||||
title: S.of(context).proFeaturesTitle,
|
title: Text(S.of(context).proFeaturesTitle),
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
|
@ -28,7 +28,7 @@ class _EquipmentProfilesScreenState extends State<EquipmentProfilesScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SliverScreen(
|
return SliverScreen(
|
||||||
title: S.of(context).equipmentProfiles,
|
title: Text(S.of(context).equipmentProfiles),
|
||||||
appBarActions: [
|
appBarActions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: _addProfile,
|
onPressed: _addProfile,
|
||||||
|
|
|
@ -33,7 +33,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ScaffoldMessenger(
|
return ScaffoldMessenger(
|
||||||
child: SliverScreen(
|
child: SliverScreen(
|
||||||
title: S.of(context).settings,
|
title: Text(S.of(context).settings),
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverList(
|
SliverList(
|
||||||
delegate: SliverChildListDelegate(
|
delegate: SliverChildListDelegate(
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
|
|
||||||
class SliverScreen extends StatelessWidget {
|
class SliverScreen extends StatelessWidget {
|
||||||
final String title;
|
final Widget title;
|
||||||
final List<Widget> appBarActions;
|
final List<Widget> appBarActions;
|
||||||
final List<Widget> slivers;
|
final List<Widget> slivers;
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ class SliverScreen extends StatelessWidget {
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
titlePadding: const EdgeInsets.all(Dimens.paddingM),
|
titlePadding: const EdgeInsets.all(Dimens.paddingM),
|
||||||
title: Text(
|
title: DefaultTextStyle(
|
||||||
title,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
fontSize: Dimens.grid24,
|
fontSize: Dimens.grid24,
|
||||||
),
|
),
|
||||||
|
child: title,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
|
Loading…
Reference in a new issue