Skip to content

Commit

Permalink
[Application] Use item common with name in the today char items
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jan 21, 2024
1 parent f8565cf commit 9330bfd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TodayCharAscensionMaterialsModel {
final String image;
final List<int> days;
final String? bossName;
final List<ItemCommon> characters;
final List<ItemCommonWithName> characters;
bool get isFromBoss => bossName != null;

bool get onlyObtainableInDays => days.isNotEmpty;
Expand Down
4 changes: 2 additions & 2 deletions lib/infrastructure/file/character_file_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class CharacterFileServiceImpl extends CharacterFileService {
List<TodayCharAscensionMaterialsModel> getCharacterAscensionMaterials(int day) {
return _materials.getCharacterAscensionMaterials(day).map((e) {
final translation = _translations.getMaterialTranslation(e.key);
final characters = <ItemCommon>[];
final characters = <ItemCommonWithName>[];

for (final char in _charactersFile.characters) {
if (char.isComingSoon) {
Expand Down Expand Up @@ -174,7 +174,7 @@ class CharacterFileServiceImpl extends CharacterFileService {

final materialIsBeingUsed = normalAscMaterial || specialAscMaterial;
if (materialIsBeingUsed && !characters.any((el) => el.key == char.key)) {
characters.add(_fromCharFileModelToItemCommon(char));
characters.add(_fromCharFileModelToItemCommonWithName(char));
}
}

Expand Down
13 changes: 8 additions & 5 deletions lib/presentation/home/widgets/char_card_ascension_material.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CharCardAscensionMaterial extends StatelessWidget {
final String itemKey;
final String name;
final String image;
final List<ItemCommon> charImgs;
final List<ItemCommonWithName> characters;
final String? bossName;
final List<int> days;

Expand All @@ -18,7 +18,7 @@ class CharCardAscensionMaterial extends StatelessWidget {
required this.name,
required this.image,
required this.days,
required this.charImgs,
required this.characters,
}) : bossName = null;

const CharCardAscensionMaterial.fromBoss({
Expand All @@ -27,7 +27,7 @@ class CharCardAscensionMaterial extends StatelessWidget {
required this.name,
required this.image,
required this.bossName,
required this.charImgs,
required this.characters,
}) : days = const [];

@override
Expand All @@ -41,10 +41,13 @@ class CharCardAscensionMaterial extends StatelessWidget {
height: 70,
child: ListView.builder(
shrinkWrap: true,
itemCount: charImgs.length,
itemCount: characters.length,
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemBuilder: (ctx, index) => CharacterIconImage.circleItem(item: charImgs[index]),
itemBuilder: (ctx, index) {
final item = characters[index];
return CharacterIconImage(itemKey: item.key, image: item.iconImage);
},
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class SliverCharacterAscensionMaterials extends StatelessWidget {
itemBuilder: (ctx, index) {
final e = charAscMaterials[index];
return e.isFromBoss
? CharCardAscensionMaterial.fromBoss(itemKey: e.key, name: e.name, image: e.image, bossName: e.bossName, charImgs: e.characters)
: CharCardAscensionMaterial.fromDays(itemKey: e.key, name: e.name, image: e.image, days: e.days, charImgs: e.characters);
? CharCardAscensionMaterial.fromBoss(itemKey: e.key, name: e.name, image: e.image, bossName: e.bossName, characters: e.characters)
: CharCardAscensionMaterial.fromDays(itemKey: e.key, name: e.name, image: e.image, days: e.days, characters: e.characters);
},
),
),
Expand All @@ -53,8 +53,8 @@ class SliverCharacterAscensionMaterials extends StatelessWidget {
itemBuilder: (context, index) {
final e = charAscMaterials[index];
return e.isFromBoss
? CharCardAscensionMaterial.fromBoss(itemKey: e.key, name: e.name, image: e.image, bossName: e.bossName, charImgs: e.characters)
: CharCardAscensionMaterial.fromDays(itemKey: e.key, name: e.name, image: e.image, days: e.days, charImgs: e.characters);
? CharCardAscensionMaterial.fromBoss(itemKey: e.key, name: e.name, image: e.image, bossName: e.bossName, characters: e.characters)
: CharCardAscensionMaterial.fromDays(itemKey: e.key, name: e.name, image: e.image, days: e.days, characters: e.characters);
},
);
}
Expand Down

0 comments on commit 9330bfd

Please sign in to comment.