-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #309 from aeecleclair/Rework-MapNotifier
Optimisation: Improve image management in every module
- Loading branch information
Showing
61 changed files
with
1,801 additions
and
2,182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:myecl/admin/class/simple_group.dart'; | ||
import 'package:myecl/admin/providers/group_list_provider.dart'; | ||
import 'package:myecl/tools/providers/map_provider.dart'; | ||
import 'package:myecl/tools/token_expire_wrapper.dart'; | ||
|
||
class SimpleGroupLogoNotifier extends MapNotifier<SimpleGroup, Image> { | ||
SimpleGroupLogoNotifier() : super(); | ||
} | ||
|
||
final allGroupLogosProvider = StateNotifierProvider<SimpleGroupLogoNotifier, | ||
AsyncValue<Map<SimpleGroup, AsyncValue<List<Image>>?>>>((ref) { | ||
Map<SimpleGroup, AsyncValue<List<Image>>?>>((ref) { | ||
SimpleGroupLogoNotifier simpleGroupLogoNotifier = SimpleGroupLogoNotifier(); | ||
tokenExpireWrapperAuth(ref, () async { | ||
ref.watch(allGroupListProvider).maybeWhen(data: (allGroup) { | ||
simpleGroupLogoNotifier.loadTList(allGroup); | ||
return simpleGroupLogoNotifier; | ||
}, orElse: () { | ||
simpleGroupLogoNotifier.loadTList([]); | ||
return simpleGroupLogoNotifier; | ||
}); | ||
}); | ||
return simpleGroupLogoNotifier; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:myecl/advert/class/advert.dart'; | ||
import 'package:myecl/advert/providers/advert_list_provider.dart'; | ||
import 'package:myecl/tools/providers/map_provider.dart'; | ||
import 'package:myecl/tools/token_expire_wrapper.dart'; | ||
|
||
class AdvertPosterNotifier extends MapNotifier<Advert, Image> { | ||
AdvertPosterNotifier() : super(); | ||
class AdvertPostersNotifier extends MapNotifier<String, Image> { | ||
AdvertPostersNotifier() : super(); | ||
} | ||
|
||
final advertPostersProvider = StateNotifierProvider<AdvertPosterNotifier, | ||
AsyncValue<Map<Advert, AsyncValue<List<Image>>?>>>((ref) { | ||
AdvertPosterNotifier advertPosterNotifier = AdvertPosterNotifier(); | ||
tokenExpireWrapperAuth(ref, () async { | ||
ref.watch(advertListProvider).maybeWhen(data: (advert) { | ||
advertPosterNotifier.loadTList(advert); | ||
return advertPosterNotifier; | ||
}, orElse: () { | ||
advertPosterNotifier.loadTList([]); | ||
return advertPosterNotifier; | ||
}); | ||
}); | ||
final advertPostersProvider = StateNotifierProvider<AdvertPostersNotifier, | ||
Map<String, AsyncValue<List<Image>>?>>((ref) { | ||
AdvertPostersNotifier advertPosterNotifier = AdvertPostersNotifier(); | ||
return advertPosterNotifier; | ||
}); |
Oops, something went wrong.