diff --git a/lib/application/character/character_bloc.dart b/lib/application/character/character_bloc.dart index 0eeeef38a..58855fd02 100644 --- a/lib/application/character/character_bloc.dart +++ b/lib/application/character/character_bloc.dart @@ -121,6 +121,8 @@ class CharacterBloc extends Bloc { ).toList(), ); }).toList(), + subStatType: char.subStatType, + stats: char.stats, ); } } diff --git a/lib/application/character/character_state.dart b/lib/application/character/character_state.dart index 22d3d5bb2..c5461bacf 100644 --- a/lib/application/character/character_state.dart +++ b/lib/application/character/character_state.dart @@ -22,5 +22,7 @@ abstract class CharacterState with _$CharacterState { @required List passives, @required List constellations, @required List builds, + @required StatType subStatType, + @required List stats, }) = _LoadedState; } diff --git a/lib/application/weapon/weapon_bloc.dart b/lib/application/weapon/weapon_bloc.dart index e107e6b58..aca06662f 100644 --- a/lib/application/weapon/weapon_bloc.dart +++ b/lib/application/weapon/weapon_bloc.dart @@ -64,6 +64,7 @@ class WeaponBloc extends Bloc { }, ).toList(), charImages: charImgs, + stats: weapon.stats, ); } } diff --git a/lib/application/weapon/weapon_state.dart b/lib/application/weapon/weapon_state.dart index 8a548bab9..1e44303c3 100644 --- a/lib/application/weapon/weapon_state.dart +++ b/lib/application/weapon/weapon_state.dart @@ -16,5 +16,6 @@ abstract class WeaponState with _$WeaponState { @required List ascensionMaterials, @required List refinements, @required List charImages, + @required List stats, }) = _LoadedState; } diff --git a/lib/domain/models/db/characters/character_file_model.dart b/lib/domain/models/db/characters/character_file_model.dart index 4af599049..e2b40b884 100644 --- a/lib/domain/models/db/characters/character_file_model.dart +++ b/lib/domain/models/db/characters/character_file_model.dart @@ -38,6 +38,7 @@ abstract class CharacterFileModel implements _$CharacterFileModel { @required List skills, @required List passives, @required List constellations, + @required StatType subStatType, @required List stats, }) = _CharacterFileModel; @@ -56,8 +57,7 @@ abstract class CharacterFileAscensionMaterialModel implements _$CharacterFileAsc const CharacterFileAscensionMaterialModel._(); - factory CharacterFileAscensionMaterialModel.fromJson(Map json) => - _$CharacterFileAscensionMaterialModelFromJson(json); + factory CharacterFileAscensionMaterialModel.fromJson(Map json) => _$CharacterFileAscensionMaterialModelFromJson(json); } @freezed @@ -69,13 +69,11 @@ abstract class CharacterFileTalentAscensionMaterialModel implements _$CharacterF const CharacterFileTalentAscensionMaterialModel._(); - factory CharacterFileTalentAscensionMaterialModel.fromJson(Map json) => - _$CharacterFileTalentAscensionMaterialModelFromJson(json); + factory CharacterFileTalentAscensionMaterialModel.fromJson(Map json) => _$CharacterFileTalentAscensionMaterialModelFromJson(json); } @freezed -abstract class CharacterFileMultiTalentAscensionMaterialModel - implements _$CharacterFileMultiTalentAscensionMaterialModel { +abstract class CharacterFileMultiTalentAscensionMaterialModel implements _$CharacterFileMultiTalentAscensionMaterialModel { factory CharacterFileMultiTalentAscensionMaterialModel({ @required int number, @required List materials, @@ -128,8 +126,7 @@ abstract class CharacterFileArtifactMultipleBuild implements _$CharacterFileArti CharacterFileArtifactMultipleBuild._(); - factory CharacterFileArtifactMultipleBuild.fromJson(Map json) => - _$CharacterFileArtifactMultipleBuildFromJson(json); + factory CharacterFileArtifactMultipleBuild.fromJson(Map json) => _$CharacterFileArtifactMultipleBuildFromJson(json); } @freezed @@ -158,8 +155,7 @@ abstract class CharacterFileSkillAbilityModel implements _$CharacterFileSkillAbi CharacterFileSkillAbilityModel._(); - factory CharacterFileSkillAbilityModel.fromJson(Map json) => - _$CharacterFileSkillAbilityModelFromJson(json); + factory CharacterFileSkillAbilityModel.fromJson(Map json) => _$CharacterFileSkillAbilityModelFromJson(json); } @freezed @@ -191,6 +187,21 @@ abstract class CharacterFileConstellationModel implements _$CharacterFileConstel CharacterFileConstellationModel._(); - factory CharacterFileConstellationModel.fromJson(Map json) => - _$CharacterFileConstellationModelFromJson(json); + factory CharacterFileConstellationModel.fromJson(Map json) => _$CharacterFileConstellationModelFromJson(json); +} + +@freezed +abstract class CharacterFileStatModel implements _$CharacterFileStatModel { + factory CharacterFileStatModel({ + @required int level, + @required double baseHp, + @required double baseAtk, + @required double baseDef, + @required bool isAnAscension, + @required double specificValue, + }) = _CharacterFileStatModel; + + const CharacterFileStatModel._(); + + factory CharacterFileStatModel.fromJson(Map json) => _$CharacterFileStatModelFromJson(json); } diff --git a/lib/domain/models/db/characters/character_file_stat_model.dart b/lib/domain/models/db/characters/character_file_stat_model.dart deleted file mode 100644 index b77220b8c..000000000 --- a/lib/domain/models/db/characters/character_file_stat_model.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:genshindb/domain/enums/enums.dart'; - -part 'character_file_stat_model.freezed.dart'; -part 'character_file_stat_model.g.dart'; - -@freezed -abstract class CharacterFileStatModel implements _$CharacterFileStatModel { - factory CharacterFileStatModel({ - @required int level, - @required double baseHp, - @required double baseAtk, - @required double baseDef, - @required bool isAnAscension, - @required double specificValue, - }) = _CharacterFileStatModel; - - const CharacterFileStatModel._(); - - factory CharacterFileStatModel.fromJson(Map json) => _$CharacterFileStatModelFromJson(json); -} \ No newline at end of file diff --git a/lib/domain/models/db/weapons/weapon_file_model.dart b/lib/domain/models/db/weapons/weapon_file_model.dart index 9056ad8ac..213688466 100644 --- a/lib/domain/models/db/weapons/weapon_file_model.dart +++ b/lib/domain/models/db/weapons/weapon_file_model.dart @@ -23,8 +23,10 @@ abstract class WeaponFileModel implements _$WeaponFileModel { @required StatType secondaryStat, @required double secondaryStatValue, @required ItemLocationType location, + @required bool isComingSoon, @required List ascensionMaterials, @required List refinements, + @required List stats, }) = _WeaponFileModel; WeaponFileModel._(); @@ -55,3 +57,17 @@ abstract class WeaponFileRefinement implements _$WeaponFileRefinement { factory WeaponFileRefinement.fromJson(Map json) => _$WeaponFileRefinementFromJson(json); } + +@freezed +abstract class WeaponFileStatModel implements _$WeaponFileStatModel { + factory WeaponFileStatModel({ + @required int level, + @required double baseAtk, + @required bool isAnAscension, + @required double specificValue, + }) = _WeaponFileStatModel; + + const WeaponFileStatModel._(); + + factory WeaponFileStatModel.fromJson(Map json) => _$WeaponFileStatModelFromJson(json); +} diff --git a/lib/domain/models/models.dart b/lib/domain/models/models.dart index 7fae76049..3c49336a1 100644 --- a/lib/domain/models/models.dart +++ b/lib/domain/models/models.dart @@ -12,7 +12,6 @@ export 'characters/character_talent_ascension_model.dart'; export 'db/artifacts/artifact_file_model.dart'; export 'db/artifacts/artifacts_file.dart'; export 'db/characters/character_file_model.dart'; -export 'db/characters/character_file_stat_model.dart'; export 'db/characters/characters_file.dart'; export 'db/elements/element_debuff_file_model.dart'; export 'db/elements/element_reaction_file_model.dart'; diff --git a/lib/domain/models/weapons/weapon_card_model.dart b/lib/domain/models/weapons/weapon_card_model.dart index 3e317b6f0..ba9d740ce 100644 --- a/lib/domain/models/weapons/weapon_card_model.dart +++ b/lib/domain/models/weapons/weapon_card_model.dart @@ -12,6 +12,7 @@ class WeaponCardModel { final WeaponType type; final StatType subStatType; final double subStatValue; + final bool isComingSoon; const WeaponCardModel({ @required this.key, @@ -22,5 +23,6 @@ class WeaponCardModel { @required this.type, @required this.subStatType, @required this.subStatValue, + @required this.isComingSoon, }); } diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 8a69fccb1..3ec8eed4a 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -25,39 +25,41 @@ class MessageLookup extends MessageLookupByLibrary { static m2(value) => "${value} ATK %"; - static m3(value) => "Constellation ${value}"; + static m3(value) => "Base ${value}"; - static m4(value) => "${value} CRIT ATK"; + static m4(value) => "Constellation ${value}"; - static m5(value) => "${value} CRIT DMG %"; + static m5(value) => "${value} CRIT ATK"; - static m6(value) => "${value} CRIT Rate"; + static m6(value) => "${value} CRIT DMG %"; - static m7(value) => "${value} CRIT Rate %"; + static m7(value) => "${value} CRIT Rate"; - static m8(value) => "${value} DEF %"; + static m8(value) => "${value} CRIT Rate %"; - static m9(value) => "${value} Elementary Mastery"; + static m9(value) => "${value} DEF %"; - static m10(value) => "${value} Energy Recharge %"; + static m10(value) => "${value} Elementary Mastery"; - static m11(value) => "${value} Healing Bonus %"; + static m11(value) => "${value} Energy Recharge %"; - static m12(value) => "${value} HP"; + static m12(value) => "${value} Healing Bonus %"; - static m13(value) => "${value} HP %"; + static m13(value) => "${value} HP"; - static m14(value) => "${value} PHYS DMG Bonus"; + static m14(value) => "${value} HP %"; - static m15(value) => "${value} PHYS DMG %"; + static m15(value) => "${value} PHYS DMG Bonus"; - static m16(value) => "Talent Ascension ${value}"; + static m16(value) => "${value} PHYS DMG %"; - static m17(value) => "Unlocked at ascension level ${value}"; + static m17(value) => "Talent Ascension ${value}"; - static m18(value, x) => "${value} ${x} DMG Bonus %"; + static m18(value) => "Unlocked at ascension level ${value}"; - static m19(value) => "${value} Piece(s)"; + static m19(value, x) => "${value} ${x} DMG Bonus %"; + + static m20(value) => "${value} Piece(s)"; final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => { @@ -81,6 +83,7 @@ class MessageLookup extends MessageLookupByLibrary { "atk" : m1, "atkPercentage" : m2, "baseAtk" : MessageLookupByLibrary.simpleMessage("Base ATK"), + "baseX" : m3, "birthday" : MessageLookupByLibrary.simpleMessage("Birthday"), "bonus" : MessageLookupByLibrary.simpleMessage("Bonus"), "boss" : MessageLookupByLibrary.simpleMessage("Boss"), @@ -107,19 +110,19 @@ class MessageLookup extends MessageLookupByLibrary { "comingSoon" : MessageLookupByLibrary.simpleMessage("Coming soon"), "common" : MessageLookupByLibrary.simpleMessage("Common"), "confirm" : MessageLookupByLibrary.simpleMessage("Confirm"), - "constellationX" : m3, + "constellationX" : m4, "constellations" : MessageLookupByLibrary.simpleMessage("Constellations"), "crafting" : MessageLookupByLibrary.simpleMessage("Crafting"), - "critAtk" : m4, - "critDmgPercentage" : m5, - "critRate" : m6, - "critRatePercentage" : m7, + "critAtk" : m5, + "critDmgPercentage" : m6, + "critRate" : m7, + "critRatePercentage" : m8, "crown" : MessageLookupByLibrary.simpleMessage("Crown"), "currency" : MessageLookupByLibrary.simpleMessage("Currency"), "currentLevel" : MessageLookupByLibrary.simpleMessage("Current level"), "dark" : MessageLookupByLibrary.simpleMessage("Dark"), "day" : MessageLookupByLibrary.simpleMessage("Day"), - "defPercentage" : m8, + "defPercentage" : m9, "deleteRow" : MessageLookupByLibrary.simpleMessage("Delete row"), "desc" : MessageLookupByLibrary.simpleMessage("Descending"), "description" : MessageLookupByLibrary.simpleMessage("Description"), @@ -138,9 +141,9 @@ class MessageLookup extends MessageLookupByLibrary { "elementalResonances" : MessageLookupByLibrary.simpleMessage("Elemental Resonances"), "elementalResonancesExplained" : MessageLookupByLibrary.simpleMessage("Having these types of character in your party will give you the corresponding effect"), "elementalSkill" : MessageLookupByLibrary.simpleMessage("Elemental Skill"), - "elementaryMastery" : m9, + "elementaryMastery" : m10, "elements" : MessageLookupByLibrary.simpleMessage("Elements"), - "energyRechargePercentage" : m10, + "energyRechargePercentage" : m11, "english" : MessageLookupByLibrary.simpleMessage("English"), "female" : MessageLookupByLibrary.simpleMessage("Female"), "filters" : MessageLookupByLibrary.simpleMessage("Filters"), @@ -155,11 +158,11 @@ class MessageLookup extends MessageLookupByLibrary { "goblet" : MessageLookupByLibrary.simpleMessage("Goblet"), "happyBirthday" : MessageLookupByLibrary.simpleMessage("Happy Birthday!"), "healingBonus" : MessageLookupByLibrary.simpleMessage("Healing Bonus"), - "healingBonusPercentage" : m11, + "healingBonusPercentage" : m12, "hold" : MessageLookupByLibrary.simpleMessage("Hold"), "home" : MessageLookupByLibrary.simpleMessage("Home"), - "hp" : m12, - "hpPercentage" : m13, + "hp" : m13, + "hpPercentage" : m14, "imgSavedSuccessfully" : MessageLookupByLibrary.simpleMessage("Image was successfully saved to the gallery"), "issues" : MessageLookupByLibrary.simpleMessage("Issues"), "language" : MessageLookupByLibrary.simpleMessage("Language"), @@ -188,8 +191,8 @@ class MessageLookup extends MessageLookupByLibrary { "others" : MessageLookupByLibrary.simpleMessage("Others"), "partial" : MessageLookupByLibrary.simpleMessage("Partial"), "passives" : MessageLookupByLibrary.simpleMessage("Passives"), - "physDmgBonus" : m14, - "physDmgPercentage" : m15, + "physDmgBonus" : m15, + "physDmgPercentage" : m16, "pickColor" : MessageLookupByLibrary.simpleMessage("Pick a color"), "pieces" : MessageLookupByLibrary.simpleMessage("Pieces"), "plume" : MessageLookupByLibrary.simpleMessage("Plume"), @@ -230,6 +233,7 @@ class MessageLookup extends MessageLookupByLibrary { "spanish" : MessageLookupByLibrary.simpleMessage("Spanish"), "starglitterExchange" : MessageLookupByLibrary.simpleMessage("Starglitter Exchange"), "startByAddingMsg" : MessageLookupByLibrary.simpleMessage("Start by adding some characters / weapons"), + "stats" : MessageLookupByLibrary.simpleMessage("Stats"), "subStat" : MessageLookupByLibrary.simpleMessage("Sub. Stat"), "summary" : MessageLookupByLibrary.simpleMessage("Summary"), "sunday" : MessageLookupByLibrary.simpleMessage("Sunday"), @@ -237,7 +241,7 @@ class MessageLookup extends MessageLookupByLibrary { "supportDps" : MessageLookupByLibrary.simpleMessage("Support DPS"), "supportMsg" : MessageLookupByLibrary.simpleMessage("I made this app in my free time and it is also open source. If you would like to help me, report an issue, have an idea, want a feature to be implemented, etc, please open an issue in my Github:"), "sword" : MessageLookupByLibrary.simpleMessage("Sword"), - "talentAscensionX" : m16, + "talentAscensionX" : m17, "talentsAscension" : MessageLookupByLibrary.simpleMessage("Talents Ascension"), "theme" : MessageLookupByLibrary.simpleMessage("Theme"), "thursday" : MessageLookupByLibrary.simpleMessage("Thursday"), @@ -248,7 +252,7 @@ class MessageLookup extends MessageLookupByLibrary { "tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"), "type" : MessageLookupByLibrary.simpleMessage("Type"), "unknownError" : MessageLookupByLibrary.simpleMessage("Unknown error occurred"), - "unlockedAtAscensionLevelX" : m17, + "unlockedAtAscensionLevelX" : m18, "unlockedAutomatically" : MessageLookupByLibrary.simpleMessage("Unlocked Automatically"), "unreleased" : MessageLookupByLibrary.simpleMessage("Unreleased"), "utility" : MessageLookupByLibrary.simpleMessage("Utility"), @@ -257,8 +261,8 @@ class MessageLookup extends MessageLookupByLibrary { "weapons" : MessageLookupByLibrary.simpleMessage("Weapons"), "wednesday" : MessageLookupByLibrary.simpleMessage("Wednesday"), "wishSimulator" : MessageLookupByLibrary.simpleMessage("Wish simulator"), - "xDmgBonusPercentage" : m18, - "xPieces" : m19, + "xDmgBonusPercentage" : m19, + "xPieces" : m20, "youCanAlsoSendMeAnEmail" : MessageLookupByLibrary.simpleMessage("You can also send me an email") }; } diff --git a/lib/generated/intl/messages_es_ES.dart b/lib/generated/intl/messages_es_ES.dart index 939a0c19a..c5a5ee6d3 100644 --- a/lib/generated/intl/messages_es_ES.dart +++ b/lib/generated/intl/messages_es_ES.dart @@ -25,39 +25,41 @@ class MessageLookup extends MessageLookupByLibrary { static m2(value) => "${value} ATQ %"; - static m3(value) => "Constelación ${value}"; + static m3(value) => "${value} Base"; - static m4(value) => "${value} ATQ CRIT"; + static m4(value) => "Constelación ${value}"; - static m5(value) => "${value} Daño CRIT %"; + static m5(value) => "${value} ATQ CRIT"; - static m6(value) => "${value} Prob. CRIT"; + static m6(value) => "${value} Daño CRIT %"; - static m7(value) => "${value} Prob. CRIT %"; + static m7(value) => "${value} Prob. CRIT"; - static m8(value) => "${value} DEF %"; + static m8(value) => "${value} Prob. CRIT %"; - static m9(value) => "${value} Maestría Elemental"; + static m9(value) => "${value} DEF %"; - static m10(value) => "${value} Recarga de Energía %"; + static m10(value) => "${value} Maestría Elemental"; - static m11(value) => "${value} Bonus de Curación %"; + static m11(value) => "${value} Recarga de Energía %"; - static m12(value) => "${value} Vida"; + static m12(value) => "${value} Bonus de Curación %"; - static m13(value) => "${value} Vida %"; + static m13(value) => "${value} Vida"; - static m14(value) => "${value} Bono Daño FIS."; + static m14(value) => "${value} Vida %"; - static m15(value) => "${value} Daño FIS. %"; + static m15(value) => "${value} Bono Daño FIS."; - static m16(value) => "Talento de Ascención ${value}"; + static m16(value) => "${value} Daño FIS. %"; - static m17(value) => "Desbloqueada en nivel de ascención ${value}"; + static m17(value) => "Talento de Ascención ${value}"; - static m18(value, x) => "${value} Bono de Daño ${x} %"; + static m18(value) => "Desbloqueada en nivel de ascención ${value}"; - static m19(value) => "${value} Pieza(s)"; + static m19(value, x) => "${value} Bono de Daño ${x} %"; + + static m20(value) => "${value} Pieza(s)"; final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => { @@ -81,6 +83,7 @@ class MessageLookup extends MessageLookupByLibrary { "atk" : m1, "atkPercentage" : m2, "baseAtk" : MessageLookupByLibrary.simpleMessage("ATQ Base"), + "baseX" : m3, "birthday" : MessageLookupByLibrary.simpleMessage("Cumpleaños"), "bonus" : MessageLookupByLibrary.simpleMessage("Bonos"), "boss" : MessageLookupByLibrary.simpleMessage("Jefe"), @@ -106,19 +109,19 @@ class MessageLookup extends MessageLookupByLibrary { "clock" : MessageLookupByLibrary.simpleMessage("Reloj"), "comingSoon" : MessageLookupByLibrary.simpleMessage("Próximamente"), "confirm" : MessageLookupByLibrary.simpleMessage("Confirmar"), - "constellationX" : m3, + "constellationX" : m4, "constellations" : MessageLookupByLibrary.simpleMessage("Constelaciones"), "crafting" : MessageLookupByLibrary.simpleMessage("Fabricado"), - "critAtk" : m4, - "critDmgPercentage" : m5, - "critRate" : m6, - "critRatePercentage" : m7, + "critAtk" : m5, + "critDmgPercentage" : m6, + "critRate" : m7, + "critRatePercentage" : m8, "crown" : MessageLookupByLibrary.simpleMessage("Corona"), "currency" : MessageLookupByLibrary.simpleMessage("Moneda"), "currentLevel" : MessageLookupByLibrary.simpleMessage("Nivel actual"), "dark" : MessageLookupByLibrary.simpleMessage("Oscuro"), "day" : MessageLookupByLibrary.simpleMessage("Día"), - "defPercentage" : m8, + "defPercentage" : m9, "deleteRow" : MessageLookupByLibrary.simpleMessage("Borrar fila"), "desc" : MessageLookupByLibrary.simpleMessage("Descendente"), "description" : MessageLookupByLibrary.simpleMessage("Descripción"), @@ -137,9 +140,9 @@ class MessageLookup extends MessageLookupByLibrary { "elementalResonances" : MessageLookupByLibrary.simpleMessage("Resonancias Elementales"), "elementalResonancesExplained" : MessageLookupByLibrary.simpleMessage("Teniendo estos tipos de personajes en tu equipo te daran el effecto correspondiente"), "elementalSkill" : MessageLookupByLibrary.simpleMessage("Habilidad Elemental"), - "elementaryMastery" : m9, + "elementaryMastery" : m10, "elements" : MessageLookupByLibrary.simpleMessage("Elementos"), - "energyRechargePercentage" : m10, + "energyRechargePercentage" : m11, "english" : MessageLookupByLibrary.simpleMessage("Inglés"), "female" : MessageLookupByLibrary.simpleMessage("Mujer"), "filters" : MessageLookupByLibrary.simpleMessage("Filtros"), @@ -154,11 +157,11 @@ class MessageLookup extends MessageLookupByLibrary { "goblet" : MessageLookupByLibrary.simpleMessage("Copa"), "happyBirthday" : MessageLookupByLibrary.simpleMessage("¡Feliz Cumpleaños!"), "healingBonus" : MessageLookupByLibrary.simpleMessage("Bono de curación"), - "healingBonusPercentage" : m11, + "healingBonusPercentage" : m12, "hold" : MessageLookupByLibrary.simpleMessage("Mantener"), "home" : MessageLookupByLibrary.simpleMessage("Inicio"), - "hp" : m12, - "hpPercentage" : m13, + "hp" : m13, + "hpPercentage" : m14, "imgSavedSuccessfully" : MessageLookupByLibrary.simpleMessage("La imagen fue guardada exitósamente en la galería"), "issues" : MessageLookupByLibrary.simpleMessage("Inconvenientes"), "language" : MessageLookupByLibrary.simpleMessage("Lenguaje"), @@ -187,8 +190,8 @@ class MessageLookup extends MessageLookupByLibrary { "others" : MessageLookupByLibrary.simpleMessage("Otros"), "partial" : MessageLookupByLibrary.simpleMessage("Parcial"), "passives" : MessageLookupByLibrary.simpleMessage("Pasivas"), - "physDmgBonus" : m14, - "physDmgPercentage" : m15, + "physDmgBonus" : m15, + "physDmgPercentage" : m16, "pickColor" : MessageLookupByLibrary.simpleMessage("Selecciona un color"), "pieces" : MessageLookupByLibrary.simpleMessage("Piezas"), "plume" : MessageLookupByLibrary.simpleMessage("Pluma"), @@ -229,6 +232,7 @@ class MessageLookup extends MessageLookupByLibrary { "spanish" : MessageLookupByLibrary.simpleMessage("Español"), "starglitterExchange" : MessageLookupByLibrary.simpleMessage("Brillo estelar"), "startByAddingMsg" : MessageLookupByLibrary.simpleMessage("Empieza por agregar algunos personajes / armas"), + "stats" : MessageLookupByLibrary.simpleMessage("Estadísticas"), "subStat" : MessageLookupByLibrary.simpleMessage("Sub. Stat"), "summary" : MessageLookupByLibrary.simpleMessage("Resúmen"), "sunday" : MessageLookupByLibrary.simpleMessage("Domingo"), @@ -236,7 +240,7 @@ class MessageLookup extends MessageLookupByLibrary { "supportDps" : MessageLookupByLibrary.simpleMessage("DPS de Soporte"), "supportMsg" : MessageLookupByLibrary.simpleMessage("Hice esta aplicación en mi tiempo libre y también es de código abierto. Si deseas ayudarme, informar de un problema, tienes una idea, deseas que se implemente una funcionalidad, etc., crea un issue en mi Github:"), "sword" : MessageLookupByLibrary.simpleMessage("Espada"), - "talentAscensionX" : m16, + "talentAscensionX" : m17, "talentsAscension" : MessageLookupByLibrary.simpleMessage("Talentos de Ascención"), "theme" : MessageLookupByLibrary.simpleMessage("Tema"), "thursday" : MessageLookupByLibrary.simpleMessage("Jueves"), @@ -247,7 +251,7 @@ class MessageLookup extends MessageLookupByLibrary { "tuesday" : MessageLookupByLibrary.simpleMessage("Martes"), "type" : MessageLookupByLibrary.simpleMessage("Tipo"), "unknownError" : MessageLookupByLibrary.simpleMessage("Un error desconocido ha ocurrido"), - "unlockedAtAscensionLevelX" : m17, + "unlockedAtAscensionLevelX" : m18, "unlockedAutomatically" : MessageLookupByLibrary.simpleMessage("Desbloqueada Automáticamente"), "unreleased" : MessageLookupByLibrary.simpleMessage("No Publicado"), "utility" : MessageLookupByLibrary.simpleMessage("Utilidad"), @@ -256,8 +260,8 @@ class MessageLookup extends MessageLookupByLibrary { "weapons" : MessageLookupByLibrary.simpleMessage("Armas"), "wednesday" : MessageLookupByLibrary.simpleMessage("Miércoles"), "wishSimulator" : MessageLookupByLibrary.simpleMessage("Simulador de Deseos"), - "xDmgBonusPercentage" : m18, - "xPieces" : m19, + "xDmgBonusPercentage" : m19, + "xPieces" : m20, "youCanAlsoSendMeAnEmail" : MessageLookupByLibrary.simpleMessage("También puedes enviarme un correo") }; } diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 9d3e7ec5c..8f4840cd8 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -2024,6 +2024,26 @@ class S { args: [], ); } + + /// `Stats` + String get stats { + return Intl.message( + 'Stats', + name: 'stats', + desc: '', + args: [], + ); + } + + /// `Base {value}` + String baseX(Object value) { + return Intl.message( + 'Base $value', + name: 'baseX', + desc: '', + args: [value], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/infrastructure/genshin_service.dart b/lib/infrastructure/genshin_service.dart index 7e2738e79..549d4ca7d 100644 --- a/lib/infrastructure/genshin_service.dart +++ b/lib/infrastructure/genshin_service.dart @@ -178,6 +178,7 @@ class GenshinServiceImpl implements GenshinService { type: e.type, subStatType: e.secondaryStat, subStatValue: e.secondaryStatValue, + isComingSoon: e.isComingSoon, ); }, ).toList(); @@ -196,6 +197,7 @@ class GenshinServiceImpl implements GenshinService { type: weapon.type, subStatType: weapon.secondaryStat, subStatValue: weapon.secondaryStatValue, + isComingSoon: weapon.isComingSoon, ); } diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 5431ec1de..217ca8c10 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -197,5 +197,7 @@ "rowSettings": "Row settings", "rename": "Rename", "confirm": "Confirm", - "pickColor": "Pick a color" + "pickColor": "Pick a color", + "stats": "Stats", + "baseX": "Base {value}" } \ No newline at end of file diff --git a/lib/l10n/intl_es_ES.arb b/lib/l10n/intl_es_ES.arb index 44614bb89..b461adeb8 100644 --- a/lib/l10n/intl_es_ES.arb +++ b/lib/l10n/intl_es_ES.arb @@ -196,5 +196,7 @@ "rowSettings": "Ajustes de la fila", "rename": "Renombrar", "confirm": "Confirmar", - "pickColor": "Selecciona un color" + "pickColor": "Selecciona un color", + "stats": "Estadísticas", + "baseX": "{value} Base" } \ No newline at end of file diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index bf2f3b47e..d172127f1 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -197,5 +197,7 @@ "rowSettings": "Row settings", "rename": "Rename", "confirm": "Confirm", - "pickColor": "Pick a color" + "pickColor": "Pick a color", + "stats": "Stats", + "baseX": "Base {value}" } \ No newline at end of file diff --git a/lib/presentation/character/widgets/character_detail.dart b/lib/presentation/character/widgets/character_detail.dart index 64c31ae9f..01047c64a 100644 --- a/lib/presentation/character/widgets/character_detail.dart +++ b/lib/presentation/character/widgets/character_detail.dart @@ -5,6 +5,7 @@ export 'character_detail_constellations_card.dart'; export 'character_detail_general_card.dart'; export 'character_detail_passive_card.dart'; export 'character_detail_skills_card.dart'; +export 'character_detail_stats_card.dart'; export 'character_detail_talent_ascension_materials_card.dart'; export 'character_detail_top.dart'; diff --git a/lib/presentation/character/widgets/character_detail_ascension_materials_card.dart b/lib/presentation/character/widgets/character_detail_ascension_materials_card.dart index c7b6f3882..6874e3f0a 100644 --- a/lib/presentation/character/widgets/character_detail_ascension_materials_card.dart +++ b/lib/presentation/character/widgets/character_detail_ascension_materials_card.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:genshindb/domain/enums/enums.dart'; import 'package:genshindb/domain/models/models.dart'; import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/common_table_cell.dart'; import 'package:genshindb/presentation/shared/extensions/element_type_extensions.dart'; import 'package:genshindb/presentation/shared/item_description_detail.dart'; import 'package:genshindb/presentation/shared/styles.dart'; @@ -24,40 +25,25 @@ class CharacterDetailAscensionMaterialsCard extends StatelessWidget { elevation: Styles.cardTenElevation, margin: Styles.edgeInsetAll5, shape: Styles.cardShape, - child: Table( - columnWidths: const { - 0: FractionColumnWidth(.2), - 1: FractionColumnWidth(.2), - 2: FractionColumnWidth(.6), - }, - children: [ - TableRow( - children: [ - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.rank)), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.level)), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.materials)), - ), - ), - ], - ), - ...ascensionMaterials.map((e) => _buildAscensionRow(e)).toList(), - ], + child: Padding( + padding: Styles.edgeInsetVertical5, + child: Table( + columnWidths: const { + 0: FractionColumnWidth(.2), + 1: FractionColumnWidth(.2), + 2: FractionColumnWidth(.6), + }, + children: [ + TableRow( + children: [ + CommonTableCell(text: s.rank, padding: Styles.edgeInsetAll10), + CommonTableCell(text: s.level, padding: Styles.edgeInsetAll10), + CommonTableCell(text: s.materials, padding: Styles.edgeInsetAll10), + ], + ), + ...ascensionMaterials.map((e) => _buildAscensionRow(e)).toList(), + ], + ), ), ); return ItemDescriptionDetail( @@ -70,26 +56,11 @@ class CharacterDetailAscensionMaterialsCard extends StatelessWidget { TableRow _buildAscensionRow(CharacterFileAscensionMaterialModel model) { final materials = model.materials.map((m) => WrappedAscensionMaterial(image: m.fullImagePath, quantity: m.quantity)).toList(); return TableRow(children: [ - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text('${model.rank}')), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text('${model.level}')), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetVertical5, - child: Wrap(alignment: WrapAlignment.center, children: materials), - ), + CommonTableCell(text: '${model.rank}', padding: Styles.edgeInsetAll10), + CommonTableCell(text: '${model.level}', padding: Styles.edgeInsetAll10), + CommonTableCell.child( + padding: Styles.edgeInsetAll5, + child: Wrap(alignment: WrapAlignment.center, children: materials), ), ]); } diff --git a/lib/presentation/character/widgets/character_detail_bottom.dart b/lib/presentation/character/widgets/character_detail_bottom.dart index 6e3c10b2c..b743a745b 100644 --- a/lib/presentation/character/widgets/character_detail_bottom.dart +++ b/lib/presentation/character/widgets/character_detail_bottom.dart @@ -67,6 +67,12 @@ class CharacterDetailBottom extends StatelessWidget { ), CharacterDetailPassiveCard(elementType: state.elementType, passives: state.passives), CharacterDetailConstellationsCard(elementType: state.elementType, constellations: state.constellations), + if (state.stats.isNotEmpty) + CharacterDetailStatsCard( + elementType: state.elementType, + stats: state.stats, + subStatType: state.subStatType, + ), ], ), ), diff --git a/lib/presentation/character/widgets/character_detail_build_card.dart b/lib/presentation/character/widgets/character_detail_build_card.dart index b63e25390..af93e462f 100644 --- a/lib/presentation/character/widgets/character_detail_build_card.dart +++ b/lib/presentation/character/widgets/character_detail_build_card.dart @@ -76,6 +76,7 @@ class CharacterDetailBuildCard extends StatelessWidget { name: weapon.name, rarity: weapon.rarity, image: weapon.image, + isComingSoon: weapon.isComingSoon, ); widgets.add(child); diff --git a/lib/presentation/character/widgets/character_detail_stats_card.dart b/lib/presentation/character/widgets/character_detail_stats_card.dart new file mode 100644 index 000000000..2b7e49750 --- /dev/null +++ b/lib/presentation/character/widgets/character_detail_stats_card.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; +import 'package:genshindb/domain/enums/enums.dart'; +import 'package:genshindb/domain/models/models.dart'; +import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/common_table_cell.dart'; +import 'package:genshindb/presentation/shared/extensions/element_type_extensions.dart'; +import 'package:genshindb/presentation/shared/extensions/i18n_extensions.dart'; +import 'package:genshindb/presentation/shared/item_description_detail.dart'; +import 'package:genshindb/presentation/shared/styles.dart'; + +class CharacterDetailStatsCard extends StatelessWidget { + final StatType subStatType; + final ElementType elementType; + final List stats; + + const CharacterDetailStatsCard({ + Key key, + @required this.subStatType, + @required this.elementType, + @required this.stats, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final s = S.of(context); + final body = Card( + elevation: Styles.cardTenElevation, + margin: Styles.edgeInsetAll5, + shape: Styles.cardShape, + child: Table( + children: [ + TableRow( + children: [ + CommonTableCell(text: s.level, padding: Styles.edgeInsetAll5), + CommonTableCell(text: s.baseX(s.translateStatTypeWithoutValue(StatType.hp)), padding: Styles.edgeInsetAll5), + CommonTableCell(text: s.baseX(s.translateStatTypeWithoutValue(StatType.atk)), padding: Styles.edgeInsetAll5), + CommonTableCell( + text: s.baseX(s.translateStatTypeWithoutValue(StatType.defPercentage, removeExtraSigns: true)), + padding: Styles.edgeInsetAll5, + ), + CommonTableCell(text: s.translateStatTypeWithoutValue(subStatType), padding: Styles.edgeInsetAll5), + ], + ), + ...stats.map((e) => _buildRow(e)).toList(), + ], + ), + ); + + return ItemDescriptionDetail(title: s.stats, body: body, textColor: elementType.getElementColorFromContext(context)); + } + + TableRow _buildRow(CharacterFileStatModel e) { + final level = e.isAnAscension ? '${e.level}+' : '${e.level}'; + return TableRow( + children: [ + CommonTableCell(text: level, padding: Styles.edgeInsetAll5), + CommonTableCell(text: '${e.baseHp}', padding: Styles.edgeInsetAll5), + CommonTableCell(text: '${e.baseAtk}', padding: Styles.edgeInsetAll5), + CommonTableCell(text: '${e.baseDef}', padding: Styles.edgeInsetAll5), + CommonTableCell(text: '${e.specificValue}', padding: Styles.edgeInsetAll5), + ], + ); + } +} diff --git a/lib/presentation/character/widgets/character_detail_talent_ascension_materials_card.dart b/lib/presentation/character/widgets/character_detail_talent_ascension_materials_card.dart index 8d81c7652..db7a84f57 100644 --- a/lib/presentation/character/widgets/character_detail_talent_ascension_materials_card.dart +++ b/lib/presentation/character/widgets/character_detail_talent_ascension_materials_card.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:genshindb/domain/enums/enums.dart'; import 'package:genshindb/domain/models/models.dart'; import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/common_table_cell.dart'; import 'package:genshindb/presentation/shared/extensions/element_type_extensions.dart'; import 'package:genshindb/presentation/shared/item_description_detail.dart'; import 'package:genshindb/presentation/shared/styles.dart'; @@ -49,32 +50,23 @@ class CharacterDetailTalentAscensionMaterialsCard extends StatelessWidget { elevation: Styles.cardTenElevation, margin: Styles.edgeInsetAll5, shape: Styles.cardShape, - child: Table( - columnWidths: const { - 0: FractionColumnWidth(.2), - 2: FractionColumnWidth(.8), - }, - children: [ - TableRow( - children: [ - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.level)), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.materials)), - ), - ), - ], - ), - ...materials.map((e) => _buildTalentAscensionRow(e)).toList(), - ], + child: Padding( + padding: Styles.edgeInsetVertical5, + child: Table( + columnWidths: const { + 0: FractionColumnWidth(.2), + 2: FractionColumnWidth(.8), + }, + children: [ + TableRow( + children: [ + CommonTableCell(text: s.level, padding: Styles.edgeInsetAll10), + CommonTableCell(text: s.materials, padding: Styles.edgeInsetAll10), + ], + ), + ...materials.map((e) => _buildTalentAscensionRow(e)).toList(), + ], + ), ), ); @@ -87,21 +79,17 @@ class CharacterDetailTalentAscensionMaterialsCard extends StatelessWidget { TableRow _buildTalentAscensionRow(CharacterFileTalentAscensionMaterialModel model) { final materials = model.materials.map((m) => WrappedAscensionMaterial(image: m.fullImagePath, quantity: m.quantity)).toList(); - return TableRow(children: [ - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( + return TableRow( + children: [ + CommonTableCell( + text: '${model.level}', padding: Styles.edgeInsetAll10, - child: Center(child: Text('${model.level}')), ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetVertical5, + CommonTableCell.child( + padding: Styles.edgeInsetAll5, child: Wrap(alignment: WrapAlignment.center, children: materials), ), - ), - ]); + ], + ); } } diff --git a/lib/presentation/shared/common_table_cell.dart b/lib/presentation/shared/common_table_cell.dart new file mode 100644 index 000000000..a12aa5117 --- /dev/null +++ b/lib/presentation/shared/common_table_cell.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:genshindb/domain/extensions/string_extensions.dart'; +import 'package:genshindb/presentation/shared/styles.dart'; + +class CommonTableCell extends StatelessWidget { + final EdgeInsets padding; + final String text; + final TextAlign textAlign; + + final Widget child; + + const CommonTableCell({ + Key key, + @required this.text, + this.textAlign = TextAlign.center, + this.padding = Styles.edgeInsetVertical5, + }) : child = null, + super(key: key); + + const CommonTableCell.child({ + Key key, + @required this.child, + this.padding = Styles.edgeInsetVertical5, + }) : text = null, + textAlign = null, + super(key: key); + + @override + Widget build(BuildContext context) { + return TableCell( + verticalAlignment: TableCellVerticalAlignment.middle, + child: text.isNullEmptyOrWhitespace + ? child + : Center( + child: Padding( + padding: padding, + child: Center( + child: Tooltip( + message: text, + child: Text( + text, + textAlign: textAlign, + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/presentation/weapon/weapon_page.dart b/lib/presentation/weapon/weapon_page.dart index 6fc9eb56f..7176f79c1 100644 --- a/lib/presentation/weapon/weapon_page.dart +++ b/lib/presentation/weapon/weapon_page.dart @@ -1,48 +1,65 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:genshindb/application/bloc.dart'; -import 'package:genshindb/domain/enums/enums.dart'; -import 'package:genshindb/domain/models/models.dart'; -import 'package:genshindb/generated/l10n.dart'; -import 'package:genshindb/presentation/shared/circle_character.dart'; -import 'package:genshindb/presentation/shared/extensions/i18n_extensions.dart'; -import 'package:genshindb/presentation/shared/extensions/rarity_extensions.dart'; -import 'package:genshindb/presentation/shared/item_description.dart'; -import 'package:genshindb/presentation/shared/item_description_detail.dart'; +import 'package:genshindb/presentation/shared/app_fab.dart'; +import 'package:genshindb/presentation/shared/extensions/scroll_controller_extensions.dart'; import 'package:genshindb/presentation/shared/loading.dart'; -import 'package:genshindb/presentation/shared/rarity.dart'; -import 'package:genshindb/presentation/shared/styles.dart'; +import 'package:genshindb/presentation/weapon/widgets/weapon_detail_bottom.dart'; +import 'package:genshindb/presentation/weapon/widgets/weapon_detaill_top.dart'; -import 'widgets/weapon_detail_ascension_materials_card.dart'; -import 'widgets/weapon_detail_refinements_card.dart'; +class WeaponPage extends StatefulWidget { + @override + _WeaponPageState createState() => _WeaponPageState(); +} -class WeaponPage extends StatelessWidget { - final double imageHeight = 320; - final double imgSize = 28; +class _WeaponPageState extends State with SingleTickerProviderStateMixin { + ScrollController _scrollController; + AnimationController _hideFabAnimController; + + @override + void initState() { + super.initState(); + + _scrollController = ScrollController(); + _hideFabAnimController = AnimationController( + vsync: this, + duration: kThemeAnimationDuration, + value: 0, // initially not visible + ); + _scrollController.addListener(() => _scrollController.handleScrollForFab(_hideFabAnimController)); + } @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: SingleChildScrollView( + controller: _scrollController, child: BlocBuilder( builder: (context, state) { return state.map( loading: (_) => const Loading(useScaffold: false), loaded: (s) => Stack( children: [ - _buildTop( - s.name, - s.atk, - s.rarity, - s.secondaryStat, - s.secondaryStatValue, - s.weaponType, - s.locationType, - s.fullImage, - context, + WeaponDetailTop( + name: s.name, + atk: s.atk, + rarity: s.rarity, + secondaryStatType: s.secondaryStat, + secondaryStatValue: s.secondaryStatValue, + type: s.weaponType, + locationType: s.locationType, + image: s.fullImage, + ), + WeaponDetailBottom( + description: s.description, + rarity: s.rarity, + secondaryStatType: s.secondaryStat, + stats: s.stats, + ascensionMaterials: s.ascensionMaterials, + refinements: s.refinements, + charImgs: s.charImages, ), - _buildBottom(s.description, s.rarity, s.ascensionMaterials, s.refinements, s.charImages, context), ], ), ); @@ -50,204 +67,17 @@ class WeaponPage extends StatelessWidget { ), ), ), - ); - } - - Widget _buildTop( - String name, - int atk, - int rarity, - StatType secondaryStatType, - double secondaryStatValue, - WeaponType type, - ItemLocationType locationType, - String image, - BuildContext context, - ) { - final mediaQuery = MediaQuery.of(context); - final isPortrait = mediaQuery.orientation == Orientation.portrait; - final descriptionWidth = mediaQuery.size.width / (isPortrait ? 1.2 : 2); - //TODO: IM NOT SURE HOW THIS WILL LOOK LIKE IN BIGGER DEVICES - // final padding = mediaQuery.padding; - // final screenHeight = mediaQuery.size.height - padding.top - padding.bottom; - - return Container( - decoration: BoxDecoration(gradient: rarity.getRarityGradient()), - child: Stack( - fit: StackFit.passthrough, - alignment: Alignment.center, - children: [ - Align( - alignment: Alignment.topRight, - child: Container( - transform: Matrix4.translationValues(80, -30, 0.0), - child: Opacity( - opacity: 0.5, - child: Image.asset( - image, - width: 350, - height: imageHeight, - ), - ), - ), - ), - Align( - alignment: Alignment.topLeft, - child: Image.asset( - image, - width: 340, - height: imageHeight, - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: Container( - width: descriptionWidth, - margin: const EdgeInsets.symmetric(horizontal: 30), - child: _buildGeneralCard( - name, - atk, - rarity, - secondaryStatType, - secondaryStatValue, - type, - locationType, - context, - ), - ), - ), - Positioned( - top: 0.0, - left: 0.0, - right: 0.0, - child: AppBar(backgroundColor: Colors.transparent, elevation: 0.0), - ), - ], + floatingActionButton: AppFab( + hideFabAnimController: _hideFabAnimController, + scrollController: _scrollController, ), ); } - Widget _buildBottom( - String description, - int rarity, - List ascensionMaterials, - List refinements, - List charImgs, - BuildContext context, - ) { - final s = S.of(context); - return Card( - margin: const EdgeInsets.only(top: 280, right: 10, left: 10), - shape: Styles.cardItemDetailShape, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Column( - children: [ - _buildDescription(description, rarity, context), - if (charImgs.isNotEmpty) - ItemDescriptionDetail( - title: s.builds, - body: Wrap( - alignment: WrapAlignment.center, - children: charImgs.map((e) => CircleCharacter(image: e)).toList(), - ), - textColor: rarity.getRarityColors().last, - ), - if (ascensionMaterials.isNotEmpty) - WeaponDetailAscensionMaterialsCard( - ascensionMaterials: ascensionMaterials, - rarityColor: rarity.getRarityColors().last, - ), - if (refinements.isNotEmpty) - WeaponDetailRefinementsCard( - refinements: refinements, - rarityColor: rarity.getRarityColors().last, - ), - ], - ), - ), - ); - } - - Widget _buildGeneralCard( - String name, - int atk, - int rarity, - StatType statType, - double secondaryStatValue, - WeaponType type, - ItemLocationType locationType, - BuildContext context, - ) { - final s = S.of(context); - final theme = Theme.of(context); - final details = Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - name, - style: theme.textTheme.headline5.copyWith(fontWeight: FontWeight.bold, color: Colors.white), - ), - Rarity(stars: rarity, starSize: 25, alignment: MainAxisAlignment.start), - ItemDescription( - title: s.type, - widget: Text( - s.translateWeaponType(type), - style: const TextStyle(color: Colors.white), - ), - useColumn: false, - ), - ItemDescription( - title: s.baseAtk, - widget: Text( - '$atk', - style: const TextStyle(color: Colors.white), - ), - useColumn: false, - ), - ItemDescription( - title: s.secondaryState, - widget: Text( - s.translateStatType(statType, secondaryStatValue), - style: const TextStyle(color: Colors.white), - ), - useColumn: false, - ), - ItemDescription( - title: s.location, - widget: Text( - s.translateItemLocationType(locationType), - style: const TextStyle(color: Colors.white), - ), - useColumn: false, - ), - ], - ); - - return Card( - color: rarity.getRarityColors().first.withOpacity(0.1), - elevation: Styles.cardTenElevation, - margin: Styles.edgeInsetAll10, - shape: Styles.cardShape, - child: Padding(padding: Styles.edgeInsetAll10, child: details), - ); - } - - Widget _buildDescription(String description, int rarity, BuildContext context) { - final s = S.of(context); - final body = Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - margin: const EdgeInsets.only(bottom: 10), - child: ItemDescriptionDetail( - title: s.description, - body: Container(margin: const EdgeInsets.symmetric(horizontal: 5), child: Text(description)), - textColor: rarity.getRarityColors().last, - ), - ), - ], - ); - return body; + @override + void dispose() { + _scrollController.dispose(); + _hideFabAnimController.dispose(); + super.dispose(); } } diff --git a/lib/presentation/weapon/widgets/weapon_detail_bottom.dart b/lib/presentation/weapon/widgets/weapon_detail_bottom.dart new file mode 100644 index 000000000..a060f92cb --- /dev/null +++ b/lib/presentation/weapon/widgets/weapon_detail_bottom.dart @@ -0,0 +1,94 @@ +import 'package:flutter/material.dart'; +import 'package:genshindb/domain/enums/enums.dart'; +import 'package:genshindb/domain/models/models.dart'; +import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/circle_character.dart'; +import 'package:genshindb/presentation/shared/extensions/rarity_extensions.dart'; +import 'package:genshindb/presentation/shared/item_description_detail.dart'; +import 'package:genshindb/presentation/shared/styles.dart'; +import 'package:genshindb/presentation/weapon/widgets/weapon_detail_stats_card.dart'; + +import 'weapon_detail_ascension_materials_card.dart'; +import 'weapon_detail_refinements_card.dart'; + +class WeaponDetailBottom extends StatelessWidget { + final String description; + final int rarity; + final StatType secondaryStatType; + final List ascensionMaterials; + final List refinements; + final List stats; + final List charImgs; + + const WeaponDetailBottom({ + Key key, + @required this.description, + @required this.rarity, + @required this.secondaryStatType, + @required this.ascensionMaterials, + @required this.refinements, + @required this.stats, + @required this.charImgs, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final s = S.of(context); + final rarityColor = rarity.getRarityColors().last; + return Card( + margin: const EdgeInsets.only(top: 280, right: 10, left: 10), + shape: Styles.cardItemDetailShape, + child: Padding( + padding: Styles.edgeInsetAll10, + child: Column( + children: [ + _buildDescription(description, rarity, context), + if (charImgs.isNotEmpty) + ItemDescriptionDetail( + title: s.builds, + body: Wrap( + alignment: WrapAlignment.center, + children: charImgs.map((e) => CircleCharacter(image: e)).toList(), + ), + textColor: rarityColor, + ), + if (ascensionMaterials.isNotEmpty) + WeaponDetailAscensionMaterialsCard( + ascensionMaterials: ascensionMaterials, + rarityColor: rarityColor, + ), + if (refinements.isNotEmpty) + WeaponDetailRefinementsCard( + refinements: refinements, + rarityColor: rarityColor, + ), + if (stats.isNotEmpty) + WeaponDetailStatsCard( + secondaryStatType: secondaryStatType, + rarityColor: rarityColor, + stats: stats, + ), + ], + ), + ), + ); + } + + Widget _buildDescription(String description, int rarity, BuildContext context) { + final s = S.of(context); + final body = Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + margin: const EdgeInsets.only(bottom: 10), + child: ItemDescriptionDetail( + title: s.description, + body: Container(margin: const EdgeInsets.symmetric(horizontal: 5), child: Text(description)), + textColor: rarity.getRarityColors().last, + ), + ), + ], + ); + return body; + } +} diff --git a/lib/presentation/weapon/widgets/weapon_detail_general_card.dart b/lib/presentation/weapon/widgets/weapon_detail_general_card.dart new file mode 100644 index 000000000..6729b6295 --- /dev/null +++ b/lib/presentation/weapon/widgets/weapon_detail_general_card.dart @@ -0,0 +1,85 @@ +import 'package:flutter/material.dart'; +import 'package:genshindb/domain/enums/enums.dart'; +import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/extensions/i18n_extensions.dart'; +import 'package:genshindb/presentation/shared/extensions/rarity_extensions.dart'; +import 'package:genshindb/presentation/shared/item_description.dart'; +import 'package:genshindb/presentation/shared/rarity.dart'; +import 'package:genshindb/presentation/shared/styles.dart'; + +class WeaponDetailGeneralCard extends StatelessWidget { + final String name; + final int atk; + final int rarity; + final StatType statType; + final double secondaryStatValue; + final WeaponType type; + final ItemLocationType locationType; + + const WeaponDetailGeneralCard({ + Key key, + @required this.name, + @required this.atk, + @required this.rarity, + @required this.statType, + @required this.secondaryStatValue, + @required this.type, + @required this.locationType, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final s = S.of(context); + final theme = Theme.of(context); + final details = Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: theme.textTheme.headline5.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + ), + Rarity(stars: rarity, starSize: 25, alignment: MainAxisAlignment.start), + ItemDescription( + title: s.type, + widget: Text( + s.translateWeaponType(type), + style: const TextStyle(color: Colors.white), + ), + useColumn: false, + ), + ItemDescription( + title: s.baseAtk, + widget: Text( + '$atk', + style: const TextStyle(color: Colors.white), + ), + useColumn: false, + ), + ItemDescription( + title: s.secondaryState, + widget: Text( + s.translateStatType(statType, secondaryStatValue), + style: const TextStyle(color: Colors.white), + ), + useColumn: false, + ), + ItemDescription( + title: s.location, + widget: Text( + s.translateItemLocationType(locationType), + style: const TextStyle(color: Colors.white), + ), + useColumn: false, + ), + ], + ); + + return Card( + color: rarity.getRarityColors().first.withOpacity(0.1), + elevation: Styles.cardTenElevation, + margin: Styles.edgeInsetAll10, + shape: Styles.cardShape, + child: Padding(padding: Styles.edgeInsetAll10, child: details), + ); + } +} diff --git a/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart b/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart index debd5bd93..30ce3623e 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:genshindb/domain/models/models.dart'; import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/common_table_cell.dart'; import 'package:genshindb/presentation/shared/item_description_detail.dart'; import 'package:genshindb/presentation/shared/styles.dart'; @@ -17,30 +18,7 @@ class WeaponDetailRefinementsCard extends StatelessWidget { @override Widget build(BuildContext context) { final s = S.of(context); - final rows = refinements - .map( - (e) => TableRow( - children: [ - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text('${e.level}')), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Center( - child: Padding( - padding: Styles.edgeInsetVertical5, - child: Center(child: Text(e.description)), - ), - ), - ), - ], - ), - ) - .toList(); + final rows = refinements.map((e) => _buildRow(e)).toList(); final body = Card( elevation: Styles.cardTenElevation, @@ -54,20 +32,8 @@ class WeaponDetailRefinementsCard extends StatelessWidget { children: [ TableRow( children: [ - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.level)), - ), - ), - TableCell( - verticalAlignment: TableCellVerticalAlignment.middle, - child: Padding( - padding: Styles.edgeInsetAll10, - child: Center(child: Text(s.description)), - ), - ), + CommonTableCell(text: s.level, padding: Styles.edgeInsetAll10), + CommonTableCell(text: s.description, padding: Styles.edgeInsetAll10), ], ), ...rows, @@ -77,4 +43,13 @@ class WeaponDetailRefinementsCard extends StatelessWidget { return ItemDescriptionDetail(title: s.refinements, body: body, textColor: rarityColor); } + + TableRow _buildRow(WeaponFileRefinementModel e) { + return TableRow( + children: [ + CommonTableCell(text: '${e.level}', padding: Styles.edgeInsetAll10), + CommonTableCell(text: e.description, padding: Styles.edgeInsetAll10, textAlign: TextAlign.start), + ], + ); + } } diff --git a/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart b/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart new file mode 100644 index 000000000..0f2fbbb9b --- /dev/null +++ b/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'package:genshindb/domain/enums/enums.dart'; +import 'package:genshindb/domain/models/db/weapons/weapon_file_model.dart'; +import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/common_table_cell.dart'; +import 'package:genshindb/presentation/shared/extensions/i18n_extensions.dart'; +import 'package:genshindb/presentation/shared/item_description_detail.dart'; +import 'package:genshindb/presentation/shared/styles.dart'; + +class WeaponDetailStatsCard extends StatelessWidget { + final StatType secondaryStatType; + final Color rarityColor; + final List stats; + + const WeaponDetailStatsCard({ + Key key, + @required this.secondaryStatType, + @required this.rarityColor, + @required this.stats, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final s = S.of(context); + final rows = stats.map((e) => _buildRow(e)).toList(); + + final body = Card( + elevation: Styles.cardTenElevation, + shape: Styles.cardShape, + margin: Styles.edgeInsetAll5, + child: Table( + columnWidths: const { + 0: FractionColumnWidth(.2), + 1: FractionColumnWidth(.4), + 2: FractionColumnWidth(.4), + }, + children: [ + TableRow( + children: [ + CommonTableCell(text: s.level), + CommonTableCell(text: s.baseAtk), + CommonTableCell(text: s.translateStatTypeWithoutValue(secondaryStatType)), + ], + ), + ...rows, + ], + ), + ); + + return ItemDescriptionDetail(title: s.stats, body: body, textColor: rarityColor); + } + + TableRow _buildRow(WeaponFileStatModel e) { + final level = e.isAnAscension ? '${e.level}+' : '${e.level}'; + return TableRow( + children: [ + CommonTableCell(text: level), + CommonTableCell(text: '${e.baseAtk}'), + CommonTableCell(text: '${e.specificValue}'), + ], + ); + } +} diff --git a/lib/presentation/weapon/widgets/weapon_detaill_top.dart b/lib/presentation/weapon/widgets/weapon_detaill_top.dart new file mode 100644 index 000000000..960f43a00 --- /dev/null +++ b/lib/presentation/weapon/widgets/weapon_detaill_top.dart @@ -0,0 +1,95 @@ +import 'package:flutter/material.dart'; +import 'package:genshindb/domain/enums/enums.dart'; +import 'package:genshindb/presentation/shared/extensions/rarity_extensions.dart'; + +import 'weapon_detail_general_card.dart'; + +const double imageHeight = 320; +const double imgSize = 28; + +class WeaponDetailTop extends StatelessWidget { + final String name; + final int atk; + final int rarity; + final StatType secondaryStatType; + final double secondaryStatValue; + final WeaponType type; + final ItemLocationType locationType; + final String image; + + const WeaponDetailTop({ + Key key, + @required this.name, + @required this.atk, + @required this.rarity, + @required this.secondaryStatType, + @required this.secondaryStatValue, + @required this.type, + @required this.locationType, + @required this.image, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + final isPortrait = mediaQuery.orientation == Orientation.portrait; + final descriptionWidth = mediaQuery.size.width / (isPortrait ? 1.2 : 2); + //TODO: IM NOT SURE HOW THIS WILL LOOK LIKE IN BIGGER DEVICES + // final padding = mediaQuery.padding; + // final screenHeight = mediaQuery.size.height - padding.top - padding.bottom; + + return Container( + decoration: BoxDecoration(gradient: rarity.getRarityGradient()), + child: Stack( + fit: StackFit.passthrough, + alignment: Alignment.center, + children: [ + Align( + alignment: Alignment.topRight, + child: Container( + transform: Matrix4.translationValues(80, -30, 0.0), + child: Opacity( + opacity: 0.5, + child: Image.asset( + image, + width: 350, + height: imageHeight, + ), + ), + ), + ), + Align( + alignment: Alignment.topLeft, + child: Image.asset( + image, + width: 340, + height: imageHeight, + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: descriptionWidth, + margin: const EdgeInsets.symmetric(horizontal: 30), + child: WeaponDetailGeneralCard( + type: type, + atk: atk, + locationType: locationType, + name: name, + rarity: rarity, + secondaryStatValue: secondaryStatValue, + statType: secondaryStatType, + ), + ), + ), + Positioned( + top: 0.0, + left: 0.0, + right: 0.0, + child: AppBar(backgroundColor: Colors.transparent, elevation: 0.0), + ), + ], + ), + ); + } +} diff --git a/lib/presentation/weapons/weapons_page.dart b/lib/presentation/weapons/weapons_page.dart index 93180e310..6949df771 100644 --- a/lib/presentation/weapons/weapons_page.dart +++ b/lib/presentation/weapons/weapons_page.dart @@ -84,6 +84,7 @@ class _WeaponsPageState extends State with AutomaticKeepAliveClient subStatType: weapon.subStatType, subStatValue: weapon.subStatValue, isInSelectionMode: widget.isInSelectionMode, + isComingSoon: weapon.isComingSoon, ); }, itemCount: weapons.length, diff --git a/lib/presentation/weapons/widgets/weapon_card.dart b/lib/presentation/weapons/widgets/weapon_card.dart index 26c400be2..1e7db4d77 100644 --- a/lib/presentation/weapons/widgets/weapon_card.dart +++ b/lib/presentation/weapons/widgets/weapon_card.dart @@ -5,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:genshindb/application/bloc.dart'; import 'package:genshindb/domain/enums/enums.dart'; import 'package:genshindb/generated/l10n.dart'; +import 'package:genshindb/presentation/shared/comingsoon_new_avatar.dart'; import 'package:genshindb/presentation/shared/extensions/i18n_extensions.dart'; import 'package:genshindb/presentation/shared/extensions/rarity_extensions.dart'; import 'package:genshindb/presentation/shared/gradient_card.dart'; @@ -23,6 +24,7 @@ class WeaponCard extends StatelessWidget { final WeaponType type; final StatType subStatType; final double subStatValue; + final bool isComingSoon; final double imgWidth; final double imgHeight; @@ -40,6 +42,7 @@ class WeaponCard extends StatelessWidget { @required this.type, @required this.subStatType, @required this.subStatValue, + @required this.isComingSoon, this.imgWidth = 160, this.imgHeight = 140, this.isInSelectionMode = false, @@ -53,6 +56,7 @@ class WeaponCard extends StatelessWidget { @required this.image, @required this.name, @required this.rarity, + @required this.isComingSoon, this.imgWidth = 80, this.imgHeight = 70, }) : type = null, @@ -78,11 +82,26 @@ class WeaponCard extends StatelessWidget { padding: Styles.edgeInsetAll5, child: Column( children: [ - FadeInImage( - width: imgWidth, - height: imgHeight, - placeholder: MemoryImage(kTransparentImage), - image: AssetImage(image), + Stack( + alignment: AlignmentDirectional.topCenter, + fit: StackFit.passthrough, + children: [ + FadeInImage( + width: imgWidth, + height: imgHeight, + placeholder: MemoryImage(kTransparentImage), + image: AssetImage(image), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + ComingSoonNewAvatar( + isNew: false, + isComingSoon: isComingSoon, + ), + ], + ), + ], ), if (!withoutDetails) Center(