mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
sync iap stub with iap changes
This commit is contained in:
parent
b1722160d5
commit
b61a40fd04
4 changed files with 24 additions and 18 deletions
9
.github/workflows/pr_check.yml
vendored
9
.github/workflows/pr_check.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
analyze_and_test:
|
analyze_and_test:
|
||||||
name: Analyze & test
|
name: Analyze & test
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
timeout-minutes: 10
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
@ -47,3 +47,10 @@ jobs:
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: flutter test
|
run: flutter test
|
||||||
|
|
||||||
|
- name: Analyze project source with stub
|
||||||
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
|
run: |
|
||||||
|
bash ./.github/scripts/stub_iap.sh
|
||||||
|
flutter pub get
|
||||||
|
flutter analyze lib --fatal-infos
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:m3_lightmeter_iap/src/providers/iap_products_provider.dart';
|
||||||
export 'src/data/models/iap_product.dart';
|
export 'src/data/models/iap_product.dart';
|
||||||
|
|
||||||
export 'src/providers/equipment_profile_provider.dart';
|
export 'src/providers/equipment_profile_provider.dart';
|
||||||
|
export 'src/providers/films_provider.dart';
|
||||||
export 'src/providers/iap_products_provider.dart';
|
export 'src/providers/iap_products_provider.dart';
|
||||||
|
|
||||||
class IAPProviders extends StatelessWidget {
|
class IAPProviders extends StatelessWidget {
|
||||||
|
|
|
@ -23,6 +23,7 @@ class FilmsProviderState extends State<FilmsProvider> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Films(
|
return Films(
|
||||||
values: const [Film.other()],
|
values: const [Film.other()],
|
||||||
|
filmsInUse: const [Film.other()],
|
||||||
selected: const Film.other(),
|
selected: const Film.other(),
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
|
@ -34,15 +35,28 @@ class FilmsProviderState extends State<FilmsProvider> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Films extends SelectableInheritedModel<Film> {
|
class Films extends SelectableInheritedModel<Film> {
|
||||||
|
final List<Film> filmsInUse;
|
||||||
|
|
||||||
const Films({
|
const Films({
|
||||||
super.key,
|
super.key,
|
||||||
required super.values,
|
required super.values,
|
||||||
|
required this.filmsInUse,
|
||||||
required super.selected,
|
required super.selected,
|
||||||
required super.child,
|
required super.child,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// [Film.other()] + all the custom fields with actual reciprocity formulas
|
||||||
static List<Film> of(BuildContext context) {
|
static List<Film> of(BuildContext context) {
|
||||||
return InheritedModel.inheritFrom<Films>(context, aspect: SelectableAspect.list)!.values;
|
return InheritedModel.inheritFrom<Films>(context)!.values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [Film.other()] + films in use selected by user
|
||||||
|
static List<Film> inUseOf<T>(BuildContext context) {
|
||||||
|
return InheritedModel.inheritFrom<Films>(
|
||||||
|
context,
|
||||||
|
aspect: SelectableAspect.list,
|
||||||
|
)!
|
||||||
|
.filmsInUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Film selectedOf(BuildContext context) {
|
static Film selectedOf(BuildContext context) {
|
||||||
|
|
|
@ -13,22 +13,6 @@ class SelectableInheritedModel<T> extends InheritedModel<SelectableAspect> {
|
||||||
final List<T> values;
|
final List<T> values;
|
||||||
final T selected;
|
final T selected;
|
||||||
|
|
||||||
static List<T> of<T>(BuildContext context) {
|
|
||||||
return InheritedModel.inheritFrom<SelectableInheritedModel<T>>(
|
|
||||||
context,
|
|
||||||
aspect: SelectableAspect.list,
|
|
||||||
)!
|
|
||||||
.values;
|
|
||||||
}
|
|
||||||
|
|
||||||
static T selectedOf<T>(BuildContext context) {
|
|
||||||
return InheritedModel.inheritFrom<SelectableInheritedModel>(
|
|
||||||
context,
|
|
||||||
aspect: SelectableAspect.selected,
|
|
||||||
)!
|
|
||||||
.selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool updateShouldNotify(SelectableInheritedModel oldWidget) => true;
|
bool updateShouldNotify(SelectableInheritedModel oldWidget) => true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue