mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
covered films model updateShouldNotifyDependent
This commit is contained in:
parent
d1b96399bb
commit
2accf9f2b3
1 changed files with 53 additions and 9 deletions
|
@ -50,19 +50,19 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void expectPredefinedFilmsCount(int count) {
|
void expectPredefinedFilmsCount(int count) {
|
||||||
expect(find.text('Predefined films count: $count'), findsOneWidget);
|
expect(find.text(_PredefinedFilmsCount.text(count)), findsOneWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void expectCustomFilmsCount(int count) {
|
void expectCustomFilmsCount(int count) {
|
||||||
expect(find.text('Custom films count: $count'), findsOneWidget);
|
expect(find.text(_CustomFilmsCount.text(count)), findsOneWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void expectFilmsInUseCount(int count) {
|
void expectFilmsInUseCount(int count) {
|
||||||
expect(find.text('Films in use count: $count'), findsOneWidget);
|
expect(find.text(_FilmsInUseCount.text(count)), findsOneWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void expectSelectedFilmName(String name) {
|
void expectSelectedFilmName(String name) {
|
||||||
expect(find.text('Selected film: $name'), findsOneWidget);
|
expect(find.text(_SelectedFilm.text(name)), findsOneWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
group(
|
group(
|
||||||
|
@ -234,15 +234,15 @@ class _Application extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return const MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text("Predefined films count: ${Films.predefinedFilmsOf(context).length}"),
|
_PredefinedFilmsCount(),
|
||||||
Text("Custom films count: ${Films.customFilmsOf(context).length}"),
|
_CustomFilmsCount(),
|
||||||
Text("Films in use count: ${Films.inUseOf(context).length}"),
|
_FilmsInUseCount(),
|
||||||
Text("Selected film: ${Films.selectedOf(context).name}"),
|
_SelectedFilm(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -251,6 +251,50 @@ class _Application extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _PredefinedFilmsCount extends StatelessWidget {
|
||||||
|
static String text(int count) => "Predefined films count: $count";
|
||||||
|
|
||||||
|
const _PredefinedFilmsCount();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Text(text(Films.predefinedFilmsOf(context).length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomFilmsCount extends StatelessWidget {
|
||||||
|
static String text(int count) => "Custom films count: $count";
|
||||||
|
|
||||||
|
const _CustomFilmsCount();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Text(text(Films.customFilmsOf(context).length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FilmsInUseCount extends StatelessWidget {
|
||||||
|
static String text(int count) => "Films in use count: $count";
|
||||||
|
|
||||||
|
const _FilmsInUseCount();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Text(text(Films.inUseOf(context).length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectedFilm extends StatelessWidget {
|
||||||
|
static String text(String name) => "Selected film: $name}";
|
||||||
|
|
||||||
|
const _SelectedFilm();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Text(text(Films.selectedOf(context).name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mockPredefinedFilms = [
|
const mockPredefinedFilms = [
|
||||||
FilmExponential(id: '1', name: 'Mock film 2x', iso: 400, exponent: 1.34),
|
FilmExponential(id: '1', name: 'Mock film 2x', iso: 400, exponent: 1.34),
|
||||||
FilmExponential(id: '2', name: 'Mock film 3x', iso: 800, exponent: 1.34),
|
FilmExponential(id: '2', name: 'Mock film 3x', iso: 800, exponent: 1.34),
|
||||||
|
|
Loading…
Reference in a new issue