m3_lightmeter/lib/screens/films/screen_films.dart

75 lines
2.4 KiB
Dart
Raw Normal View History

2024-10-07 13:08:27 +00:00
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
2024-10-21 09:40:11 +00:00
import 'package:lightmeter/providers/films_provider.dart';
import 'package:lightmeter/screens/films/components/film_formula_input/widget_film_formula_input.dart';
2024-10-07 13:08:27 +00:00
import 'package:lightmeter/screens/settings/components/shared/expandable_section_list/widget_expandable_section_list.dart';
import 'package:lightmeter/screens/shared/sliver_screen/screen_sliver.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
class FilmsScreen extends StatefulWidget {
const FilmsScreen({super.key});
@override
State<FilmsScreen> createState() => _FilmsScreenState();
}
class _FilmsScreenState extends State<FilmsScreen> {
@override
Widget build(BuildContext context) {
return SliverScreen(
2024-10-21 09:40:11 +00:00
title: Text('Films'),
2024-10-07 13:08:27 +00:00
appBarActions: [
IconButton(
2024-10-21 09:40:11 +00:00
onPressed: _addFilm,
2024-10-07 13:08:27 +00:00
icon: const Icon(Icons.add_outlined),
tooltip: S.of(context).tooltipAdd,
),
],
slivers: [
2024-10-21 09:40:11 +00:00
ExpandableSectionList<FilmExponential>(
values: [],
2024-10-07 13:08:27 +00:00
onSectionTitleTap: () {},
contentBuilder: (context, value) => [
ListTile(
leading: const Icon(Icons.iso),
title: Text(S.of(context).iso),
trailing: Text(value.iso.toString()),
2024-10-21 09:40:11 +00:00
onTap: () {},
2024-10-07 13:08:27 +00:00
),
ListTile(
leading: const Icon(Icons.equalizer),
title: Text('Formula'),
2024-10-21 09:40:11 +00:00
trailing: Text(value.exponent.toString()),
2024-10-07 13:08:27 +00:00
),
],
actionsBuilder: (context, value) => [
IconButton(
onPressed: () {},
icon: const Icon(Icons.copy_outlined),
tooltip: S.of(context).tooltipCopy,
),
IconButton(
onPressed: () {},
icon: const Icon(Icons.delete_outlined),
tooltip: S.of(context).tooltipDelete,
),
],
),
SliverToBoxAdapter(child: SizedBox(height: MediaQuery.paddingOf(context).bottom)),
],
);
}
2024-10-21 09:40:11 +00:00
void _addFilm([EquipmentProfile? copyFrom]) {
showDialog<String>(
context: context,
builder: (_) => const FilmFormulaDialog(),
).then((name) {
if (name != null) {
FilmsProvider.of(context).addFilm(name);
}
});
}
2024-10-07 13:08:27 +00:00
}