From deed76dadb9e13ddd3bd80e2135f278a228b9f30 Mon Sep 17 00:00:00 2001 From: Efrain Date: Sat, 19 Jun 2021 17:22:19 -0500 Subject: [PATCH] [Presentation] Migrate to null safety --- .../ascension_materials_summary.dart | 4 +- lib/main.dart | 4 +- lib/presentation/artifact/artifact_page.dart | 2 +- .../artifacts/artifacts_page.dart | 4 +- .../artifacts/widgets/artifact_card.dart | 30 +++++------ .../artifacts/widgets/artifact_info_card.dart | 9 ++-- .../artifacts/widgets/artifact_stats.dart | 10 ++-- .../calculator_ascension_materials_page.dart | 8 +-- .../widgets/add_edit_item_bottom_sheet.dart | 53 +++++++++---------- .../widgets/add_edit_session_dialog.dart | 20 +++---- .../widgets/ascension_level.dart | 6 +-- .../widgets/ascension_materials_summary.dart | 8 +-- .../widgets/item_card.dart | 24 ++++----- .../widgets/material_item.dart | 12 ++--- .../widgets/session_list_item.dart | 4 +- .../widgets/skill_item.dart | 18 +++---- .../character/character_page.dart | 2 +- ...acter_detail_ascension_materials_card.dart | 6 +-- .../widgets/character_detail_bottom.dart | 6 +-- .../widgets/character_detail_build_card.dart | 28 +++++----- .../character_detail_constellations_card.dart | 14 ++--- .../character_detail_general_card.dart | 22 ++++---- .../character_detail_passive_card.dart | 10 ++-- .../widgets/character_detail_skills_card.dart | 18 +++---- .../widgets/character_detail_stats_card.dart | 8 +-- ...etail_talent_ascension_materials_card.dart | 16 +++--- .../widgets/character_detail_top.dart | 2 +- .../characters/characters_page.dart | 4 +- .../character_ascension_materials.dart | 4 +- .../widgets/character_bottom_sheet.dart | 2 +- .../characters/widgets/character_card.dart | 26 ++++----- ...acter_card_ascension_materials_bottom.dart | 6 +-- lib/presentation/elements/elements_page.dart | 6 +-- .../elements/widgets/element_debuff_card.dart | 10 ++-- .../widgets/element_reaction_card.dart | 28 +++++----- .../game_codes/game_codes_page.dart | 4 +- .../widgets/game_code_list_item.dart | 18 +++---- lib/presentation/home/home_page.dart | 4 +- .../widgets/change_current_day_dialog.dart | 6 +-- .../widgets/char_card_ascension_material.dart | 28 +++++----- lib/presentation/home/widgets/main_title.dart | 6 +-- .../home/widgets/sliver_calculators_card.dart | 4 +- .../home/widgets/sliver_card_item.dart | 8 +-- .../sliver_characters_birthday_card.dart | 2 +- .../widgets/sliver_daily_check_in_card.dart | 4 +- .../home/widgets/sliver_game_codes_card.dart | 4 +- .../home/widgets/sliver_main_title.dart | 4 +- .../home/widgets/sliver_materials_card.dart | 4 +- .../home/widgets/sliver_monsters_card.dart | 4 +- .../widgets/sliver_my_inventory_card.dart | 4 +- .../widgets/sliver_notifications_card.dart | 4 +- .../home/widgets/sliver_settings_card.dart | 4 +- .../home/widgets/sliver_tierlist_card.dart | 4 +- .../home/widgets/sliver_today_main_title.dart | 4 +- .../widgets/sliver_wish_simulator_card.dart | 4 +- .../weapon_card_ascension_material.dart | 14 ++--- .../characters_inventory_tab_page.dart | 2 +- .../widgets/weapons_inventory_tab_page.dart | 2 +- lib/presentation/main_tab_page.dart | 10 ++-- lib/presentation/map/map_page.dart | 4 -- .../widgets/material_detail_bottom.dart | 20 +++---- .../widgets/material_detail_general_card.dart | 12 ++--- .../material/widgets/material_detail_top.dart | 12 ++--- .../materials/materials_page.dart | 4 +- .../materials/widgets/material_card.dart | 42 +++++++-------- lib/presentation/monsters/monsters_page.dart | 4 +- .../monsters/widgets/monster_card.dart | 18 +++---- .../notifications/notifications_page.dart | 6 +-- .../add_edit_notification_bottom_sheet.dart | 4 +- .../forms/notification_circle_item.dart | 18 +++---- .../forms/notification_custom_form.dart | 26 ++++----- .../notification_daily_checkin_form.dart | 18 +++---- .../forms/notification_dropdown_type.dart | 6 +-- .../forms/notification_expedition_form.dart | 20 +++---- .../notification_farming_artifact_form.dart | 18 +++---- .../notification_farming_material_form.dart | 16 +++--- .../forms/notification_furniture_form.dart | 18 +++---- .../forms/notification_gadget_form.dart | 16 +++--- .../widgets/forms/notification_note.dart | 8 +-- .../notification_realm_currency_form.dart | 22 ++++---- .../forms/notification_resin_form.dart | 18 +++---- .../widgets/forms/notification_switch.dart | 4 +- .../forms/notification_title_body.dart | 14 ++--- .../forms/notification_weekly_boss_form.dart | 16 +++--- .../items/notification_list_subtitle.dart | 12 ++--- .../notification_list_subtitle_dates.dart | 8 +-- .../widgets/items/notification_list_tile.dart | 10 ++-- .../notification_realm_currency_subtitle.dart | 16 +++--- .../notification_resin_list_subtitle.dart | 12 ++--- .../settings/widgets/about_settings_card.dart | 4 +- .../widgets/credits_settings_card.dart | 26 ++++----- .../widgets/language_settings_card.dart | 2 +- .../settings/widgets/other_settings.dart | 2 +- .../settings/widgets/settings_card.dart | 4 +- .../widgets/settings_card_content.dart | 10 ++-- .../settings/widgets/theme_settings_card.dart | 2 +- lib/presentation/shared/app_fab.dart | 10 ++-- .../shared/bottom_sheet_title.dart | 6 +-- lib/presentation/shared/bullet_list.dart | 11 ++-- .../shared/child_item_disabled.dart | 4 +- lib/presentation/shared/circle_character.dart | 8 +-- lib/presentation/shared/circle_item.dart | 8 +-- lib/presentation/shared/circle_monster.dart | 8 +-- lib/presentation/shared/circle_weapon.dart | 8 +-- .../shared/comingsoon_new_avatar.dart | 6 +-- .../shared/common_bottom_sheet.dart | 12 ++--- .../shared/common_bottom_sheet_buttons.dart | 19 ++++--- .../shared/common_table_cell.dart | 20 +++---- .../shared/dropdown_button_with_title.dart | 14 ++--- lib/presentation/shared/element_image.dart | 8 +-- .../shared/elements_button_bar.dart | 4 +- .../extensions/app_theme_type_extensions.dart | 2 - .../focus_scope_node_extensions.dart | 2 +- .../shared/extensions/i18n_extensions.dart | 3 +- lib/presentation/shared/genshin_db_icons.dart | 2 +- lib/presentation/shared/gradient_card.dart | 14 ++--- lib/presentation/shared/hawk_fab_menu.dart | 43 +++++++-------- .../shared/image_widget_placeholder.dart | 6 +-- lib/presentation/shared/increment_button.dart | 10 ++-- lib/presentation/shared/info_dialog.dart | 4 +- lib/presentation/shared/item_description.dart | 20 ++++--- .../shared/item_description_card.dart | 6 +-- .../shared/item_description_detail.dart | 14 ++--- .../shared/item_expansion_panel.dart | 10 ++-- .../shared/item_popupmenu_filter.dart | 12 ++--- .../shared/item_quantity_dialog.dart | 8 +-- .../shared/material_item_button.dart | 4 +- .../shared/mixins/app_fab_mixin.dart | 4 +- lib/presentation/shared/nothing_found.dart | 2 +- .../shared/nothing_found_column.dart | 2 +- .../shared/number_picker_dialog.dart | 12 ++--- lib/presentation/shared/page_message.dart | 4 +- lib/presentation/shared/rarity.dart | 4 +- lib/presentation/shared/rarity_rating.dart | 8 +-- .../shared/scaffold_with_fab.dart | 6 +-- lib/presentation/shared/search_box.dart | 10 ++-- .../shared/sliver_nothing_found.dart | 2 +- .../shared/sliver_page_filter.dart | 14 ++--- lib/presentation/shared/sliver_row_grid.dart | 6 +-- .../shared/sliver_scaffold_with_fab.dart | 6 +-- .../shared/smooth_star_rating.dart | 26 ++++----- .../sort_direction_popupmenu_filter.dart | 6 +-- lib/presentation/shared/text_link.dart | 6 +-- .../shared/utils/toast_utils.dart | 2 +- .../shared/weapons_button_bar.dart | 4 +- .../shared/wrapped_ascension_material.dart | 6 +-- lib/presentation/tierlist/tier_list_page.dart | 2 +- .../widgets/rename_tierlist_dialog.dart | 10 ++-- .../tierlist/widgets/tierlist_row.dart | 16 +++--- .../widgets/tierlist_row_color_picker.dart | 11 ++-- .../today_materials/today_materials_page.dart | 4 +- .../sliver_character_ascension_materials.dart | 4 +- .../sliver_weapon_ascension_materials.dart | 4 +- ...eapon_detail_ascension_materials_card.dart | 6 +-- .../weapon/widgets/weapon_detail_bottom.dart | 18 +++---- .../weapon_detail_crafting_materials.dart | 6 +-- .../widgets/weapon_detail_general_card.dart | 18 +++---- .../weapon_detail_refinements_card.dart | 6 +-- .../widgets/weapon_detail_stats_card.dart | 8 +-- .../weapon/widgets/weapon_detaill_top.dart | 18 +++---- lib/presentation/weapons/weapons_page.dart | 4 +- .../weapons/widgets/weapon_card.dart | 50 ++++++++--------- 162 files changed, 831 insertions(+), 848 deletions(-) diff --git a/lib/domain/models/calculator_asc_materials/ascension_materials_summary.dart b/lib/domain/models/calculator_asc_materials/ascension_materials_summary.dart index 7aec087e1..4872da099 100644 --- a/lib/domain/models/calculator_asc_materials/ascension_materials_summary.dart +++ b/lib/domain/models/calculator_asc_materials/ascension_materials_summary.dart @@ -2,7 +2,7 @@ import '../../enums/ascension_material_summary_type.dart'; import '../../enums/material_type.dart'; class AscensionMaterialsSummary { - final AscensionMaterialSummaryType? type; + final AscensionMaterialSummaryType type; final List materials; const AscensionMaterialsSummary({ @@ -14,7 +14,7 @@ class AscensionMaterialsSummary { class MaterialSummary { final String key; final MaterialType materialType; - final String? fullImagePath; + final String fullImagePath; final int quantity; final bool isFromBoss; final List days; diff --git a/lib/main.dart b/lib/main.dart index f83469f43..08323bb27 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,9 +28,9 @@ Future main() async { runApp(MyApp()); } -Future _onDidReceiveLocalNotification(int id, String title, String body, String payload) async {} +Future _onDidReceiveLocalNotification(int id, String? title, String? body, String? payload) async {} -Future _onSelectNotification(String json) async {} +Future _onSelectNotification(String? json) async {} class MyApp extends StatelessWidget { @override diff --git a/lib/presentation/artifact/artifact_page.dart b/lib/presentation/artifact/artifact_page.dart index e1bcf9af5..45fa02a7c 100644 --- a/lib/presentation/artifact/artifact_page.dart +++ b/lib/presentation/artifact/artifact_page.dart @@ -166,7 +166,7 @@ class ArtifactPage extends StatelessWidget { final details = Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(name, style: theme.textTheme.headline5.copyWith(fontWeight: FontWeight.bold, color: Colors.white)), + Text(name, style: theme.textTheme.headline5!.copyWith(fontWeight: FontWeight.bold, color: Colors.white)), Rarity(stars: rarity, starSize: 25, alignment: MainAxisAlignment.start), ], ); diff --git a/lib/presentation/artifacts/artifacts_page.dart b/lib/presentation/artifacts/artifacts_page.dart index b9949616a..5e0c7f0bf 100644 --- a/lib/presentation/artifacts/artifacts_page.dart +++ b/lib/presentation/artifacts/artifacts_page.dart @@ -17,7 +17,7 @@ import 'widgets/artifact_info_card.dart'; class ArtifactsPage extends StatefulWidget { final bool isInSelectionMode; - static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { + static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { final bloc = context.read(); bloc.add(ArtifactsEvent.init(excludeKeys: excludeKeys)); @@ -31,7 +31,7 @@ class ArtifactsPage extends StatefulWidget { } const ArtifactsPage({ - Key key, + Key? key, this.isInSelectionMode = false, }) : super(key: key); diff --git a/lib/presentation/artifacts/widgets/artifact_card.dart b/lib/presentation/artifacts/widgets/artifact_card.dart index a8fb0cf60..97654560b 100644 --- a/lib/presentation/artifacts/widgets/artifact_card.dart +++ b/lib/presentation/artifacts/widgets/artifact_card.dart @@ -24,12 +24,12 @@ class ArtifactCard extends StatelessWidget { final bool isInSelectionMode; const ArtifactCard({ - Key key, - @required this.keyName, - @required this.name, - @required this.image, - @required this.rarity, - @required this.bonus, + Key? key, + required this.keyName, + required this.name, + required this.image, + required this.rarity, + required this.bonus, this.imgWidth = 140, this.imgHeight = 120, this.withElevation = true, @@ -38,11 +38,11 @@ class ArtifactCard extends StatelessWidget { super(key: key); const ArtifactCard.withoutDetails({ - Key key, - @required this.keyName, - @required this.name, - @required this.image, - @required this.rarity, + Key? key, + required this.keyName, + required this.name, + required this.image, + required this.rarity, this.isInSelectionMode = false, }) : imgWidth = 70, imgHeight = 60, @@ -52,8 +52,8 @@ class ArtifactCard extends StatelessWidget { super(key: key); ArtifactCard.item({ - Key key, - @required ArtifactCardModel item, + Key? key, + required ArtifactCardModel item, this.imgWidth = 140, this.imgHeight = 120, this.withElevation = true, @@ -94,12 +94,12 @@ class ArtifactCard extends StatelessWidget { ? Text( name, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ) : Text( name, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), overflow: TextOverflow.ellipsis, ), ), diff --git a/lib/presentation/artifacts/widgets/artifact_info_card.dart b/lib/presentation/artifacts/widgets/artifact_info_card.dart index 191d7cc67..4e593587e 100644 --- a/lib/presentation/artifacts/widgets/artifact_info_card.dart +++ b/lib/presentation/artifacts/widgets/artifact_info_card.dart @@ -8,11 +8,11 @@ import 'package:genshindb/presentation/shared/item_expansion_panel.dart'; class ArtifactInfoCard extends StatelessWidget { final bool isCollapsed; - final Function(bool) expansionCallback; + final Function(bool)? expansionCallback; const ArtifactInfoCard({ - Key key, - @required this.isCollapsed, + Key? key, + required this.isCollapsed, this.expansionCallback, }) : super(key: key); @@ -26,7 +26,6 @@ class ArtifactInfoCard extends StatelessWidget { final hpPercentage = s.translateStatTypeWithoutValue(StatType.hpPercentage); final atkPercentage = s.translateStatTypeWithoutValue(StatType.atkPercentage); final atk = s.translateStatTypeWithoutValue(StatType.atk); - final def = s.translateStatTypeWithoutValue(StatType.defPercentage, removeExtraSigns: true); final defPercentage = s.translateStatTypeWithoutValue(StatType.defPercentage); final energyRecharge = s.translateStatTypeWithoutValue(StatType.energyRechargePercentage, removeExtraSigns: true); final elementaryMastery = s.translateStatTypeWithoutValue(StatType.elementaryMastery); @@ -39,7 +38,7 @@ class ArtifactInfoCard extends StatelessWidget { '${s.clock}: $atkPercentage / $defPercentage / $hpPercentage / $energyRecharge / $elementaryMastery', ); considerations.add( - '${s.goblet}: $atkPercentage / $defPercentage / $hpPercentage / $elementaryMastery / ${s.elementalDmgPercentage} (${s.translateElementType(ElementType.electro)}, ${s.translateElementType(ElementType.hydro)}...)', + '${s.goblet}: $atkPercentage / $defPercentage / $hpPercentage / $elementaryMastery / ${s.physDmgPercentage('').trim()} / ${s.elementalDmgPercentage} (${s.translateElementType(ElementType.electro)}, ${s.translateElementType(ElementType.hydro)}...)', ); considerations.add( '${s.crown}: $atkPercentage / $defPercentage / $hpPercentage / $critRate / $critDmg / $elementaryMastery / ${s.healingBonus}', diff --git a/lib/presentation/artifacts/widgets/artifact_stats.dart b/lib/presentation/artifacts/widgets/artifact_stats.dart index 2ca5439a3..aa7e19035 100644 --- a/lib/presentation/artifacts/widgets/artifact_stats.dart +++ b/lib/presentation/artifacts/widgets/artifact_stats.dart @@ -4,11 +4,11 @@ import 'package:genshindb/generated/l10n.dart'; class ArtifactStats extends StatelessWidget { final List bonus; - final Color textColor; + final Color? textColor; const ArtifactStats({ - Key key, - @required this.bonus, + Key? key, + required this.bonus, this.textColor, }) : super(key: key); @@ -28,12 +28,12 @@ class ArtifactStats extends StatelessWidget { Text( s.xPieces(b.pieces), textAlign: TextAlign.center, - style: theme.textTheme.subtitle2.copyWith(fontSize: 14, color: textColor), + style: theme.textTheme.subtitle2!.copyWith(fontSize: 14, color: textColor), ), Text( b.bonus, textAlign: TextAlign.center, - style: theme.textTheme.bodyText2.copyWith(fontSize: 12, color: textColor), + style: theme.textTheme.bodyText2!.copyWith(fontSize: 12, color: textColor), ), ], ), diff --git a/lib/presentation/calculator_asc_materials/calculator_ascension_materials_page.dart b/lib/presentation/calculator_asc_materials/calculator_ascension_materials_page.dart index ab0d9a0b5..9ef5e30d3 100644 --- a/lib/presentation/calculator_asc_materials/calculator_ascension_materials_page.dart +++ b/lib/presentation/calculator_asc_materials/calculator_ascension_materials_page.dart @@ -23,8 +23,8 @@ class CalculatorAscensionMaterialsPage extends StatelessWidget { final int sessionKey; const CalculatorAscensionMaterialsPage({ - Key key, - @required this.sessionKey, + Key? key, + required this.sessionKey, }) : super(key: key); @override @@ -149,7 +149,7 @@ class CalculatorAscensionMaterialsPage extends StatelessWidget { return; } - context.read().add(CalculatorAscMaterialsItemEvent.load(key: keyName, isCharacter: true)); + context.read().add(CalculatorAscMaterialsItemEvent.load(key: keyName!, isCharacter: true)); await showModalBottomSheet( context: context, @@ -172,7 +172,7 @@ class CalculatorAscensionMaterialsPage extends StatelessWidget { return; } - context.read().add(CalculatorAscMaterialsItemEvent.load(key: keyName, isCharacter: false)); + context.read().add(CalculatorAscMaterialsItemEvent.load(key: keyName!, isCharacter: false)); await showModalBottomSheet( context: context, diff --git a/lib/presentation/calculator_asc_materials/widgets/add_edit_item_bottom_sheet.dart b/lib/presentation/calculator_asc_materials/widgets/add_edit_item_bottom_sheet.dart index 4ef4176d0..2ca9fd612 100644 --- a/lib/presentation/calculator_asc_materials/widgets/add_edit_item_bottom_sheet.dart +++ b/lib/presentation/calculator_asc_materials/widgets/add_edit_item_bottom_sheet.dart @@ -14,29 +14,29 @@ import 'skill_item.dart'; class AddEditItemBottomSheet extends StatelessWidget { final int sessionKey; - final int index; - final String keyName; + final int? index; + final String? keyName; final bool isInEditMode; final bool isAWeapon; final bool isActive; const AddEditItemBottomSheet.toAddItem({ - Key key, - @required this.sessionKey, - @required this.keyName, - @required this.isAWeapon, - }) : index = null, + Key? key, + required this.sessionKey, + required this.keyName, + required this.isAWeapon, + }) : index = null, isInEditMode = false, isActive = true, super(key: key); const AddEditItemBottomSheet.toEditItem({ - Key key, - @required this.sessionKey, - @required this.index, - @required this.isAWeapon, - @required this.isActive, - }) : keyName = null, + Key? key, + required this.sessionKey, + required this.index, + required this.isAWeapon, + required this.isActive, + }) : keyName = null, isInEditMode = true, super(key: key); @@ -60,18 +60,18 @@ class AddEditItemBottomSheet extends StatelessWidget { Text( s.level, textAlign: TextAlign.center, - style: theme.textTheme.subtitle2.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle2!.copyWith(fontWeight: FontWeight.bold), ), Container( margin: const EdgeInsets.only(bottom: 5), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - OutlineButton( + OutlinedButton( onPressed: () => _showLevelPickerDialog(context, state.currentLevel, true), child: Text(s.currentX(state.currentLevel)), ), - OutlineButton( + OutlinedButton( onPressed: () => _showLevelPickerDialog(context, state.desiredLevel, false), child: Text(s.desiredX(state.desiredLevel)), ), @@ -98,7 +98,7 @@ class AddEditItemBottomSheet extends StatelessWidget { children: [ Text( s.useMaterialsFromInventory, - style: theme.textTheme.subtitle2.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle2!.copyWith(fontWeight: FontWeight.bold), ), Container( margin: const EdgeInsets.only(top: 5), @@ -118,17 +118,17 @@ class AddEditItemBottomSheet extends StatelessWidget { ButtonBar( buttonPadding: const EdgeInsets.symmetric(horizontal: 10), children: [ - OutlineButton( + OutlinedButton( onPressed: () => Navigator.pop(context), child: Text(s.cancel, style: TextStyle(color: theme.primaryColor)), ), if (isInEditMode) - OutlineButton( + OutlinedButton( onPressed: () => _removeItem(context), child: Text(s.delete, style: TextStyle(color: theme.primaryColor)), ), if (isInEditMode) - OutlineButton( + OutlinedButton( onPressed: () => isAWeapon ? _applyChangesForWeapon( state.currentLevel, @@ -151,8 +151,7 @@ class AddEditItemBottomSheet extends StatelessWidget { ), child: Text(isActive ? s.inactive : s.active, style: TextStyle(color: theme.primaryColor)), ), - RaisedButton( - color: theme.primaryColor, + ElevatedButton( onPressed: () => isAWeapon ? _applyChangesForWeapon( state.currentLevel, @@ -216,7 +215,7 @@ class AddEditItemBottomSheet extends StatelessWidget { final event = !isInEditMode ? CalculatorAscMaterialsEvent.addWeapon( sessionKey: sessionKey, - key: keyName, + key: keyName!, currentLevel: currentLevel, desiredLevel: desiredLevel, currentAscensionLevel: currentAscensionLevel, @@ -225,7 +224,7 @@ class AddEditItemBottomSheet extends StatelessWidget { ) : CalculatorAscMaterialsEvent.updateWeapon( sessionKey: sessionKey, - index: index, + index: index!, currentLevel: currentLevel, desiredLevel: desiredLevel, currentAscensionLevel: currentAscensionLevel, @@ -250,7 +249,7 @@ class AddEditItemBottomSheet extends StatelessWidget { final event = !isInEditMode ? CalculatorAscMaterialsEvent.addCharacter( sessionKey: sessionKey, - key: keyName, + key: keyName!, currentLevel: currentLevel, desiredLevel: desiredLevel, skills: skills, @@ -260,7 +259,7 @@ class AddEditItemBottomSheet extends StatelessWidget { ) : CalculatorAscMaterialsEvent.updateCharacter( sessionKey: sessionKey, - index: index, + index: index!, currentLevel: currentLevel, desiredLevel: desiredLevel, skills: skills, @@ -274,7 +273,7 @@ class AddEditItemBottomSheet extends StatelessWidget { } void _removeItem(BuildContext context) { - context.read().add(CalculatorAscMaterialsEvent.removeItem(sessionKey: sessionKey, index: index)); + context.read().add(CalculatorAscMaterialsEvent.removeItem(sessionKey: sessionKey, index: index!)); Navigator.pop(context); } diff --git a/lib/presentation/calculator_asc_materials/widgets/add_edit_session_dialog.dart b/lib/presentation/calculator_asc_materials/widgets/add_edit_session_dialog.dart index 5cb33ed34..591fd474d 100644 --- a/lib/presentation/calculator_asc_materials/widgets/add_edit_session_dialog.dart +++ b/lib/presentation/calculator_asc_materials/widgets/add_edit_session_dialog.dart @@ -4,19 +4,19 @@ import 'package:genshindb/application/bloc.dart'; import 'package:genshindb/generated/l10n.dart'; class AddEditSessionDialog extends StatefulWidget { - final int sessionKey; - final String name; + final int? sessionKey; + final String? name; const AddEditSessionDialog.create({ - Key key, + Key? key, }) : sessionKey = null, name = '', super(key: key); const AddEditSessionDialog.update({ - Key key, - @required this.sessionKey, - @required this.name, + Key? key, + required this.sessionKey, + required this.name, }) : super(key: key); @override @@ -24,8 +24,8 @@ class AddEditSessionDialog extends StatefulWidget { } class _AddEditSessionDialogState extends State { - TextEditingController _textEditingController; - String _currentValue; + late TextEditingController _textEditingController; + String? _currentValue; @override void initState() { @@ -82,7 +82,7 @@ class _AddEditSessionDialogState extends State { return; } _currentValue = _textEditingController.text; - context.read().add(CalculatorAscMaterialsSessionFormEvent.nameChanged(name: _currentValue)); + context.read().add(CalculatorAscMaterialsSessionFormEvent.nameChanged(name: _currentValue!)); } void _saveSession() { @@ -100,7 +100,7 @@ class _AddEditSessionDialogState extends State { void _updateSession() => context .read() - .add(CalculatorAscMaterialsSessionsEvent.updateSession(key: widget.sessionKey, name: _textEditingController.text)); + .add(CalculatorAscMaterialsSessionsEvent.updateSession(key: widget.sessionKey!, name: _textEditingController.text)); void _close() => Navigator.pop(context); } diff --git a/lib/presentation/calculator_asc_materials/widgets/ascension_level.dart b/lib/presentation/calculator_asc_materials/widgets/ascension_level.dart index eb7e8f3d3..1c18a1f07 100644 --- a/lib/presentation/calculator_asc_materials/widgets/ascension_level.dart +++ b/lib/presentation/calculator_asc_materials/widgets/ascension_level.dart @@ -9,9 +9,9 @@ class AscensionLevel extends StatelessWidget { final int level; const AscensionLevel({ - Key key, - @required this.isCurrentLevel, - @required this.level, + Key? key, + required this.isCurrentLevel, + required this.level, }) : super(key: key); @override diff --git a/lib/presentation/calculator_asc_materials/widgets/ascension_materials_summary.dart b/lib/presentation/calculator_asc_materials/widgets/ascension_materials_summary.dart index 2790bd316..5bc15b5d9 100644 --- a/lib/presentation/calculator_asc_materials/widgets/ascension_materials_summary.dart +++ b/lib/presentation/calculator_asc_materials/widgets/ascension_materials_summary.dart @@ -11,8 +11,8 @@ class AscensionMaterialsSummaryWidget extends StatelessWidget { final AscensionMaterialsSummary summary; const AscensionMaterialsSummaryWidget({ - Key key, - @required this.summary, + Key? key, + required this.summary, }) : super(key: key); @override @@ -26,7 +26,7 @@ class AscensionMaterialsSummaryWidget extends StatelessWidget { children: [ Text( s.translateAscensionSummaryType(summary.type), - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Wrap( alignment: WrapAlignment.center, @@ -63,7 +63,7 @@ class AscensionMaterialsSummaryWidget extends StatelessWidget { if (materials.isNotEmpty) Text( s.translateDays(materials.expand((e) => e.days).toSet().toList()), - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), if (materials.isNotEmpty) Wrap( diff --git a/lib/presentation/calculator_asc_materials/widgets/item_card.dart b/lib/presentation/calculator_asc_materials/widgets/item_card.dart index e4df81491..6b19e7bbb 100644 --- a/lib/presentation/calculator_asc_materials/widgets/item_card.dart +++ b/lib/presentation/calculator_asc_materials/widgets/item_card.dart @@ -23,16 +23,16 @@ class ItemCard extends StatelessWidget { final bool isActive; const ItemCard({ - Key key, - @required this.sessionKey, - @required this.index, - @required this.itemKey, - @required this.name, - @required this.image, - @required this.rarity, - @required this.isWeapon, - @required this.materials, - @required this.isActive, + Key? key, + required this.sessionKey, + required this.index, + required this.itemKey, + required this.name, + required this.image, + required this.rarity, + required this.isWeapon, + required this.materials, + required this.isActive, }) : super(key: key); @override @@ -81,7 +81,7 @@ class ItemCard extends StatelessWidget { margin: Styles.edgeInsetAll5, child: Text( name, - style: theme.textTheme.headline6.copyWith(color: Colors.white), + style: theme.textTheme.headline6!.copyWith(color: Colors.white), overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, ), @@ -90,7 +90,7 @@ class ItemCard extends StatelessWidget { Text( s.materials, textAlign: TextAlign.center, - style: theme.textTheme.subtitle2.copyWith(color: Colors.white), + style: theme.textTheme.subtitle2!.copyWith(color: Colors.white), ), Container( margin: const EdgeInsets.only(bottom: 12, right: 5, left: 5), diff --git a/lib/presentation/calculator_asc_materials/widgets/material_item.dart b/lib/presentation/calculator_asc_materials/widgets/material_item.dart index 072d0ece6..ba15746fc 100644 --- a/lib/presentation/calculator_asc_materials/widgets/material_item.dart +++ b/lib/presentation/calculator_asc_materials/widgets/material_item.dart @@ -10,13 +10,13 @@ class MaterialItem extends StatelessWidget { final app.MaterialType type; final String image; final int quantity; - final Color textColor; + final Color? textColor; const MaterialItem({ - Key key, - @required this.type, - @required this.image, - @required this.quantity, + Key? key, + required this.type, + required this.image, + required this.quantity, this.textColor, }) : super(key: key); @@ -37,7 +37,7 @@ class MaterialItem extends StatelessWidget { Text( type == app.MaterialType.currency ? CurrencyUtils.formatNumber(quantity) : '$quantity', textAlign: TextAlign.center, - style: textColor != null ? theme.textTheme.subtitle2.copyWith(color: textColor) : theme.textTheme.subtitle2, + style: textColor != null ? theme.textTheme.subtitle2!.copyWith(color: textColor) : theme.textTheme.subtitle2, ), if (quantity == 0) const Icon(Icons.check, color: Colors.green, size: 18), ], diff --git a/lib/presentation/calculator_asc_materials/widgets/session_list_item.dart b/lib/presentation/calculator_asc_materials/widgets/session_list_item.dart index 35102d549..7803e84d5 100644 --- a/lib/presentation/calculator_asc_materials/widgets/session_list_item.dart +++ b/lib/presentation/calculator_asc_materials/widgets/session_list_item.dart @@ -12,8 +12,8 @@ class SessionListItem extends StatelessWidget { final CalculatorSessionModel session; const SessionListItem({ - Key key, - @required this.session, + Key? key, + required this.session, }) : super(key: key); @override diff --git a/lib/presentation/calculator_asc_materials/widgets/skill_item.dart b/lib/presentation/calculator_asc_materials/widgets/skill_item.dart index 0ccde41da..f5438f00a 100644 --- a/lib/presentation/calculator_asc_materials/widgets/skill_item.dart +++ b/lib/presentation/calculator_asc_materials/widgets/skill_item.dart @@ -15,15 +15,15 @@ class SkillItem extends StatelessWidget { final bool isDesiredDecEnabled; const SkillItem({ - Key key, - @required this.index, - @required this.name, - @required this.currentLevel, - @required this.desiredLevel, - @required this.isCurrentIncEnabled, - @required this.isCurrentDecEnabled, - @required this.isDesiredIncEnabled, - @required this.isDesiredDecEnabled, + Key? key, + required this.index, + required this.name, + required this.currentLevel, + required this.desiredLevel, + required this.isCurrentIncEnabled, + required this.isCurrentDecEnabled, + required this.isDesiredIncEnabled, + required this.isDesiredDecEnabled, }) : super(key: key); @override diff --git a/lib/presentation/character/character_page.dart b/lib/presentation/character/character_page.dart index 403c61b01..ccac10218 100644 --- a/lib/presentation/character/character_page.dart +++ b/lib/presentation/character/character_page.dart @@ -5,7 +5,7 @@ import 'widgets/character_detail.dart'; import 'widgets/character_detail_top.dart'; class CharacterPage extends StatelessWidget { - const CharacterPage({Key key}) : super(key: key); + const CharacterPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { 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 6874e3f0a..450a4f787 100644 --- a/lib/presentation/character/widgets/character_detail_ascension_materials_card.dart +++ b/lib/presentation/character/widgets/character_detail_ascension_materials_card.dart @@ -13,9 +13,9 @@ class CharacterDetailAscensionMaterialsCard extends StatelessWidget { final List ascensionMaterials; const CharacterDetailAscensionMaterialsCard({ - Key key, - @required this.elementType, - @required this.ascensionMaterials, + Key? key, + required this.elementType, + required this.ascensionMaterials, }) : super(key: key); @override diff --git a/lib/presentation/character/widgets/character_detail_bottom.dart b/lib/presentation/character/widgets/character_detail_bottom.dart index 20803011c..265b29562 100644 --- a/lib/presentation/character/widgets/character_detail_bottom.dart +++ b/lib/presentation/character/widgets/character_detail_bottom.dart @@ -10,7 +10,7 @@ import 'package:genshindb/presentation/shared/styles.dart'; import 'character_detail.dart'; class CharacterDetailBottom extends StatelessWidget { - const CharacterDetailBottom({Key key}) : super(key: key); + const CharacterDetailBottom({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -61,9 +61,9 @@ class CharacterDetailBottom extends StatelessWidget { talentAscensionMaterials: state.talentAscensionsMaterials, elementType: state.elementType, ), - if (state.multiTalentAscensionMaterials != null && state.multiTalentAscensionMaterials.isNotEmpty) + if (state.multiTalentAscensionMaterials != null && state.multiTalentAscensionMaterials!.isNotEmpty) CharacterDetailTalentAscensionMaterialsCard.withMultiTalents( - multiTalentAscensionMaterials: state.multiTalentAscensionMaterials, + multiTalentAscensionMaterials: state.multiTalentAscensionMaterials!, elementType: state.elementType, ), CharacterDetailPassiveCard(elementType: state.elementType, passives: state.passives), diff --git a/lib/presentation/character/widgets/character_detail_build_card.dart b/lib/presentation/character/widgets/character_detail_build_card.dart index 6d55f8a51..4c97918f9 100644 --- a/lib/presentation/character/widgets/character_detail_build_card.dart +++ b/lib/presentation/character/widgets/character_detail_build_card.dart @@ -21,12 +21,12 @@ class CharacterDetailBuildCard extends StatelessWidget { final replaceDigitRegex = RegExp(r'\d{1}'); CharacterDetailBuildCard({ - Key key, - @required this.elementType, - @required this.isForSupport, - @required this.weapons, - @required this.artifacts, - @required this.subStatsToFocus, + Key? key, + required this.elementType, + required this.isForSupport, + required this.weapons, + required this.artifacts, + required this.subStatsToFocus, }) : super(key: key); @override @@ -44,13 +44,13 @@ class CharacterDetailBuildCard extends StatelessWidget { children: [ Text( isForSupport ? s.support : s.dps, - style: theme.textTheme.headline6.copyWith(color: elementType.getElementColorFromContext(context)), + style: theme.textTheme.headline6!.copyWith(color: elementType.getElementColorFromContext(context)), ), Container( margin: Styles.edgeInsetAll5, child: Text( s.weapons, - style: theme.textTheme.subtitle2.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle2!.copyWith(fontWeight: FontWeight.bold), ), ), _buildWeapons(context), @@ -58,7 +58,7 @@ class CharacterDetailBuildCard extends StatelessWidget { margin: Styles.edgeInsetAll5, child: Text( s.artifacts, - style: theme.textTheme.subtitle2.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle2!.copyWith(fontWeight: FontWeight.bold), ), ), if (subStatsToFocus.isNotEmpty) _buildSubStatsToFocus(context), @@ -125,12 +125,12 @@ class CharacterDetailBuildCard extends StatelessWidget { final items = artifactOrder.mapIndex( (digit, index) { final stat = artifact.stats[index]; - final path = artifact.one.image.replaceFirst(replaceDigitRegex, '$digit'); + final path = artifact.one!.image.replaceFirst(replaceDigitRegex, '$digit'); return ArtifactCard.withoutDetails( name: s.translateStatTypeWithoutValue(stat), image: path, - rarity: artifact.one.rarity, - keyName: artifact.one.key, + rarity: artifact.one!.rarity, + keyName: artifact.one!.key, ); }, ).toList(); @@ -199,7 +199,7 @@ class CharacterDetailBuildCard extends StatelessWidget { child: Text( s.or, textAlign: TextAlign.center, - style: theme.textTheme.subtitle2.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.subtitle2!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ), ), ); @@ -230,7 +230,7 @@ class CharacterDetailBuildCard extends StatelessWidget { margin: Styles.edgeInsetHorizontal5, child: Text( '${s.subStats}: $text', - style: theme.textTheme.subtitle2.copyWith( + style: theme.textTheme.subtitle2!.copyWith( fontWeight: FontWeight.bold, color: elementType.getElementColorFromContext(context), fontSize: 12, diff --git a/lib/presentation/character/widgets/character_detail_constellations_card.dart b/lib/presentation/character/widgets/character_detail_constellations_card.dart index 4d60f61b8..4065096d6 100644 --- a/lib/presentation/character/widgets/character_detail_constellations_card.dart +++ b/lib/presentation/character/widgets/character_detail_constellations_card.dart @@ -12,9 +12,9 @@ class CharacterDetailConstellationsCard extends StatelessWidget { final List constellations; const CharacterDetailConstellationsCard({ - Key key, - @required this.elementType, - @required this.constellations, + Key? key, + required this.elementType, + required this.constellations, }) : super(key: key); @override @@ -48,7 +48,7 @@ class CharacterDetailConstellationsCard extends StatelessWidget { ), Text( model.title, - style: theme.textTheme.subtitle1.copyWith(color: elementType.getElementColorFromContext(context)), + style: theme.textTheme.subtitle1!.copyWith(color: elementType.getElementColorFromContext(context)), textAlign: TextAlign.center, ), Text( @@ -61,7 +61,7 @@ class CharacterDetailConstellationsCard extends StatelessWidget { child: Text( model.description, textAlign: TextAlign.center, - style: theme.textTheme.bodyText2.copyWith(fontSize: 12), + style: theme.textTheme.bodyText2!.copyWith(fontSize: 12), ), ), if (model.descriptions.isNotEmpty) BulletList(items: model.descriptions), @@ -69,9 +69,9 @@ class CharacterDetailConstellationsCard extends StatelessWidget { Container( margin: const EdgeInsets.only(top: 10), child: Text( - model.secondDescription, + model.secondDescription!, textAlign: TextAlign.center, - style: theme.textTheme.bodyText2.copyWith(fontSize: 12), + style: theme.textTheme.bodyText2!.copyWith(fontSize: 12), ), ), ], diff --git a/lib/presentation/character/widgets/character_detail_general_card.dart b/lib/presentation/character/widgets/character_detail_general_card.dart index 845548b4e..497aa1ddc 100644 --- a/lib/presentation/character/widgets/character_detail_general_card.dart +++ b/lib/presentation/character/widgets/character_detail_general_card.dart @@ -23,17 +23,17 @@ class CharacterDetailGeneralCard extends StatelessWidget { final RegionType region; final String role; final bool isFemale; - final String birthday; + final String? birthday; const CharacterDetailGeneralCard({ - Key key, - @required this.name, - @required this.rarity, - @required this.elementType, - @required this.weaponType, - @required this.region, - @required this.role, - @required this.isFemale, + Key? key, + required this.name, + required this.rarity, + required this.elementType, + required this.weaponType, + required this.region, + required this.role, + required this.isFemale, this.birthday, }) : super(key: key); @@ -52,7 +52,7 @@ class CharacterDetailGeneralCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(name, style: theme.textTheme.headline5.copyWith(fontWeight: FontWeight.bold, color: Colors.white)), + Text(name, style: theme.textTheme.headline5!.copyWith(fontWeight: FontWeight.bold, color: Colors.white)), Rarity(stars: rarity, starSize: 25, alignment: MainAxisAlignment.start), ItemDescription( title: s.element, @@ -88,7 +88,7 @@ class CharacterDetailGeneralCard extends StatelessWidget { if (birthday.isNotNullEmptyOrWhitespace) ItemDescription( title: s.birthday, - widget: Text(birthday, style: const TextStyle(color: Colors.white)), + widget: Text(birthday!, style: const TextStyle(color: Colors.white)), useColumn: false, ), ], diff --git a/lib/presentation/character/widgets/character_detail_passive_card.dart b/lib/presentation/character/widgets/character_detail_passive_card.dart index 22dcc9bb0..31276d05a 100644 --- a/lib/presentation/character/widgets/character_detail_passive_card.dart +++ b/lib/presentation/character/widgets/character_detail_passive_card.dart @@ -12,9 +12,9 @@ class CharacterDetailPassiveCard extends StatelessWidget { final List passives; const CharacterDetailPassiveCard({ - Key key, - @required this.elementType, - @required this.passives, + Key? key, + required this.elementType, + required this.passives, }) : super(key: key); @override @@ -49,7 +49,7 @@ class CharacterDetailPassiveCard extends StatelessWidget { ), Text( model.title, - style: theme.textTheme.subtitle1.copyWith(color: elementType.getElementColorFromContext(context)), + style: theme.textTheme.subtitle1!.copyWith(color: elementType.getElementColorFromContext(context)), textAlign: TextAlign.center, ), Text( @@ -62,7 +62,7 @@ class CharacterDetailPassiveCard extends StatelessWidget { child: Text( model.description, textAlign: TextAlign.center, - style: theme.textTheme.bodyText2.copyWith(fontSize: 12), + style: theme.textTheme.bodyText2!.copyWith(fontSize: 12), ), ), if (model.descriptions.isNotEmpty) BulletList(items: model.descriptions) diff --git a/lib/presentation/character/widgets/character_detail_skills_card.dart b/lib/presentation/character/widgets/character_detail_skills_card.dart index 4a2e33899..46f6f1bba 100644 --- a/lib/presentation/character/widgets/character_detail_skills_card.dart +++ b/lib/presentation/character/widgets/character_detail_skills_card.dart @@ -15,9 +15,9 @@ class CharacterDetailSkillsCard extends StatelessWidget { final List skills; const CharacterDetailSkillsCard({ - Key key, - @required this.elementType, - @required this.skills, + Key? key, + required this.elementType, + required this.skills, }) : super(key: key); @override @@ -54,7 +54,7 @@ class CharacterDetailSkillsCard extends StatelessWidget { child: Text( model.title, overflow: TextOverflow.ellipsis, - style: theme.textTheme.headline6.copyWith(color: elementType.getElementColorFromContext(context)), + style: theme.textTheme.headline6!.copyWith(color: elementType.getElementColorFromContext(context)), ), ), Tooltip( @@ -70,7 +70,7 @@ class CharacterDetailSkillsCard extends StatelessWidget { final widgets = []; if (model.description != null) { - widgets.add(Text(model.description, style: theme.textTheme.bodyText2.copyWith(fontSize: 12))); + widgets.add(Text(model.description!, style: theme.textTheme.bodyText2!.copyWith(fontSize: 12))); } if (model.abilities.isNotEmpty) { @@ -82,14 +82,14 @@ class CharacterDetailSkillsCard extends StatelessWidget { children: [ if (e.hasCommonTranslation || e.name.isNotNullEmptyOrWhitespace) Text( - e.hasCommonTranslation ? s.translateCharacterSkillAbilityType(e.type) : e.name, + e.hasCommonTranslation ? s.translateCharacterSkillAbilityType(e.type!) : e.name!, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(color: elementType.getElementColorFromContext(context)), + style: theme.textTheme.subtitle1!.copyWith(color: elementType.getElementColorFromContext(context)), ), - if (e.description != null) Text(e.description, style: theme.textTheme.bodyText2.copyWith(fontSize: 12)), + if (e.description != null) Text(e.description!, style: theme.textTheme.bodyText2!.copyWith(fontSize: 12)), if (e.descriptions.isNotEmpty) BulletList(items: e.descriptions), - if (e.secondDescription != null) Text(e.secondDescription, style: theme.textTheme.bodyText2.copyWith(fontSize: 12)), + if (e.secondDescription != null) Text(e.secondDescription!, style: theme.textTheme.bodyText2!.copyWith(fontSize: 12)), ], ), ), diff --git a/lib/presentation/character/widgets/character_detail_stats_card.dart b/lib/presentation/character/widgets/character_detail_stats_card.dart index 2b7e49750..bfbbcd9e5 100644 --- a/lib/presentation/character/widgets/character_detail_stats_card.dart +++ b/lib/presentation/character/widgets/character_detail_stats_card.dart @@ -14,10 +14,10 @@ class CharacterDetailStatsCard extends StatelessWidget { final List stats; const CharacterDetailStatsCard({ - Key key, - @required this.subStatType, - @required this.elementType, - @required this.stats, + Key? key, + required this.subStatType, + required this.elementType, + required this.stats, }) : super(key: key); @override 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 b5cd38c87..dcb236285 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 @@ -14,17 +14,17 @@ class CharacterDetailTalentAscensionMaterialsCard extends StatelessWidget { final List multiTalentAscensionMaterials; const CharacterDetailTalentAscensionMaterialsCard.withTalents({ - Key key, - @required this.elementType, - @required this.talentAscensionMaterials, - }) : multiTalentAscensionMaterials = const [], + Key? key, + required this.elementType, + required this.talentAscensionMaterials, + }) : multiTalentAscensionMaterials = const [], super(key: key); const CharacterDetailTalentAscensionMaterialsCard.withMultiTalents({ - Key key, - @required this.elementType, - @required this.multiTalentAscensionMaterials, - }) : talentAscensionMaterials = const [], + Key? key, + required this.elementType, + required this.multiTalentAscensionMaterials, + }) : talentAscensionMaterials = const [], super(key: key); @override diff --git a/lib/presentation/character/widgets/character_detail_top.dart b/lib/presentation/character/widgets/character_detail_top.dart index 4719d9522..2505f0838 100644 --- a/lib/presentation/character/widgets/character_detail_top.dart +++ b/lib/presentation/character/widgets/character_detail_top.dart @@ -10,7 +10,7 @@ import '../../character/widgets/character_detail.dart'; class CharacterDetailTop extends StatelessWidget { const CharacterDetailTop({ - Key key, + Key? key, }) : super(key: key); @override diff --git a/lib/presentation/characters/characters_page.dart b/lib/presentation/characters/characters_page.dart index 0bde92fb0..4bb80bfe8 100644 --- a/lib/presentation/characters/characters_page.dart +++ b/lib/presentation/characters/characters_page.dart @@ -16,7 +16,7 @@ import 'widgets/character_card.dart'; class CharactersPage extends StatefulWidget { final bool isInSelectionMode; - static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { + static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { final bloc = context.read(); bloc.add(CharactersEvent.init(excludeKeys: excludeKeys)); @@ -30,7 +30,7 @@ class CharactersPage extends StatefulWidget { } const CharactersPage({ - Key key, + Key? key, this.isInSelectionMode = false, }) : super(key: key); diff --git a/lib/presentation/characters/widgets/character_ascension_materials.dart b/lib/presentation/characters/widgets/character_ascension_materials.dart index 427b059db..1d0085d53 100644 --- a/lib/presentation/characters/widgets/character_ascension_materials.dart +++ b/lib/presentation/characters/widgets/character_ascension_materials.dart @@ -6,8 +6,8 @@ class CharacterAscensionMaterials extends StatelessWidget { final List images; const CharacterAscensionMaterials({ - Key key, - @required this.images, + Key? key, + required this.images, }) : super(key: key); @override diff --git a/lib/presentation/characters/widgets/character_bottom_sheet.dart b/lib/presentation/characters/widgets/character_bottom_sheet.dart index 51028f885..705f88368 100644 --- a/lib/presentation/characters/widgets/character_bottom_sheet.dart +++ b/lib/presentation/characters/widgets/character_bottom_sheet.dart @@ -14,7 +14,7 @@ import 'package:genshindb/presentation/shared/sort_direction_popupmenu_filter.da import 'package:genshindb/presentation/shared/weapons_button_bar.dart'; class CharacterBottomSheet extends StatelessWidget { - const CharacterBottomSheet({Key key}) : super(key: key); + const CharacterBottomSheet({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/presentation/characters/widgets/character_card.dart b/lib/presentation/characters/widgets/character_card.dart index c4e83c502..9465e5a15 100644 --- a/lib/presentation/characters/widgets/character_card.dart +++ b/lib/presentation/characters/widgets/character_card.dart @@ -30,23 +30,23 @@ class CharacterCard extends StatelessWidget { final bool showMaterials; const CharacterCard({ - Key key, - @required this.keyName, - @required this.image, - @required this.name, - @required this.rarity, - @required this.weaponType, - @required this.elementType, - @required this.isNew, - @required this.isComingSoon, - @required this.materials, + Key? key, + required this.keyName, + required this.image, + required this.name, + required this.rarity, + required this.weaponType, + required this.elementType, + required this.isNew, + required this.isComingSoon, + required this.materials, this.isInSelectionMode = false, this.showMaterials = true, }) : super(key: key); CharacterCard.item({ - Key key, - CharacterCardModel char, + Key? key, + required CharacterCardModel char, this.isInSelectionMode = false, this.showMaterials = true, }) : keyName = char.key, @@ -113,7 +113,7 @@ class CharacterCard extends StatelessWidget { child: Text( name, overflow: TextOverflow.ellipsis, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ), ), Rarity(stars: rarity), diff --git a/lib/presentation/characters/widgets/character_card_ascension_materials_bottom.dart b/lib/presentation/characters/widgets/character_card_ascension_materials_bottom.dart index 431d81654..d1721b800 100644 --- a/lib/presentation/characters/widgets/character_card_ascension_materials_bottom.dart +++ b/lib/presentation/characters/widgets/character_card_ascension_materials_bottom.dart @@ -15,9 +15,9 @@ class CharacterCardAscensionMaterialsBottom extends StatelessWidget { final List materials; const CharacterCardAscensionMaterialsBottom({ - Key key, - @required this.weaponType, - @required this.materials, + Key? key, + required this.weaponType, + required this.materials, }) : super(key: key); @override diff --git a/lib/presentation/elements/elements_page.dart b/lib/presentation/elements/elements_page.dart index 08190dcfd..746fdc637 100644 --- a/lib/presentation/elements/elements_page.dart +++ b/lib/presentation/elements/elements_page.dart @@ -23,7 +23,7 @@ class ElementsPage extends StatelessWidget { [ Text( s.elementalDebuffs, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Text(s.elementalDebuffsExplained) ], @@ -37,7 +37,7 @@ class ElementsPage extends StatelessWidget { delegate: SliverChildListDelegate.fixed([ Text( s.elementalReactions, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Text(s.elementalReactionsExplained), ]), @@ -50,7 +50,7 @@ class ElementsPage extends StatelessWidget { delegate: SliverChildListDelegate.fixed([ Text( s.elementalResonances, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Text(s.elementalResonancesExplained), ]), diff --git a/lib/presentation/elements/widgets/element_debuff_card.dart b/lib/presentation/elements/widgets/element_debuff_card.dart index 62713f47d..dda09606c 100644 --- a/lib/presentation/elements/widgets/element_debuff_card.dart +++ b/lib/presentation/elements/widgets/element_debuff_card.dart @@ -8,10 +8,10 @@ class ElementDebuffCard extends StatelessWidget { final String effect; const ElementDebuffCard({ - Key key, - @required this.image, - @required this.name, - @required this.effect, + Key? key, + required this.image, + required this.name, + required this.effect, }) : super(key: key); @override @@ -29,7 +29,7 @@ class ElementDebuffCard extends StatelessWidget { Text( name, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Text(effect, textAlign: TextAlign.center) ], diff --git a/lib/presentation/elements/widgets/element_reaction_card.dart b/lib/presentation/elements/widgets/element_reaction_card.dart index af833a4a4..f38cd0601 100644 --- a/lib/presentation/elements/widgets/element_reaction_card.dart +++ b/lib/presentation/elements/widgets/element_reaction_card.dart @@ -9,24 +9,24 @@ class ElementReactionCard extends StatelessWidget { final List secondary; final bool showPlusIcon; final bool showImages; - final String description; + final String? description; const ElementReactionCard.withImages({ - Key key, - @required this.name, - @required this.effect, - @required this.principal, - @required this.secondary, + Key? key, + required this.name, + required this.effect, + required this.principal, + required this.secondary, this.showPlusIcon = true, }) : showImages = true, description = null, super(key: key); const ElementReactionCard.withoutImage({ - Key key, - @required this.name, - @required this.effect, - @required this.description, + Key? key, + required this.name, + required this.effect, + required this.description, this.showPlusIcon = true, }) : principal = const [], secondary = const [], @@ -57,19 +57,19 @@ class ElementReactionCard extends StatelessWidget { ), if (!showImages) Text( - description, + description!, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Text( name, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), Text( effect, textAlign: TextAlign.center, - style: theme.textTheme.subtitle2.copyWith(fontSize: 12), + style: theme.textTheme.subtitle2!.copyWith(fontSize: 12), ) ], ), diff --git a/lib/presentation/game_codes/game_codes_page.dart b/lib/presentation/game_codes/game_codes_page.dart index b559c8b3e..d984d7b06 100644 --- a/lib/presentation/game_codes/game_codes_page.dart +++ b/lib/presentation/game_codes/game_codes_page.dart @@ -15,7 +15,7 @@ import 'widgets/game_code_list_item.dart'; class GameCodesPage extends StatefulWidget { const GameCodesPage({ - Key key, + Key? key, }) : super(key: key); @override @@ -23,7 +23,7 @@ class GameCodesPage extends StatefulWidget { } class _GameCodesPageState extends State with SingleTickerProviderStateMixin, AppFabMixin { - RefreshController _refreshController; + late RefreshController _refreshController; @override void initState() { diff --git a/lib/presentation/game_codes/widgets/game_code_list_item.dart b/lib/presentation/game_codes/widgets/game_code_list_item.dart index e9749e59b..7305ea030 100644 --- a/lib/presentation/game_codes/widgets/game_code_list_item.dart +++ b/lib/presentation/game_codes/widgets/game_code_list_item.dart @@ -15,18 +15,18 @@ import 'package:genshindb/presentation/shared/wrapped_ascension_material.dart'; class GameCodeListItem extends StatelessWidget { final String code; - final DateTime discoveredOn; - final DateTime expiredOn; + final DateTime? discoveredOn; + final DateTime? expiredOn; final bool isUsed; final bool isExpired; - final AppServerResetTimeType region; + final AppServerResetTimeType? region; final List rewards; GameCodeListItem({ - Key key, - @required GameCodeModel item, - }) : code = item.code, + Key? key, + required GameCodeModel item, + }) : code = item.code, discoveredOn = item.discoveredOn, expiredOn = item.expiredOn, isUsed = item.isUsed, @@ -41,7 +41,7 @@ class GameCodeListItem extends StatelessWidget { final theme = Theme.of(context); final textCodeStyle = !isUsed ? theme.textTheme.subtitle1 - : theme.textTheme.subtitle1.copyWith(decoration: TextDecoration.lineThrough, decorationColor: theme.accentColor, decorationThickness: 2); + : theme.textTheme.subtitle1!.copyWith(decoration: TextDecoration.lineThrough, decorationColor: theme.accentColor, decorationThickness: 2); return Slidable( actionPane: const SlidableDrawerActionPane(), @@ -90,12 +90,12 @@ class GameCodeListItem extends StatelessWidget { crossAxisAlignment: WrapCrossAlignment.center, children: [ Icon( - region != null ? Icons.lock_outlined : Icons.lock_open_outlined, + Icons.lock_outlined, color: theme.accentColor, size: 15, ), Text( - s.onlyX(s.translateServerResetTimeType(region)), + s.onlyX(s.translateServerResetTimeType(region!)), style: theme.textTheme.caption, overflow: TextOverflow.ellipsis, ), diff --git a/lib/presentation/home/home_page.dart b/lib/presentation/home/home_page.dart index aa10785b4..149a85821 100644 --- a/lib/presentation/home/home_page.dart +++ b/lib/presentation/home/home_page.dart @@ -103,7 +103,7 @@ class _HomePageState extends State with AutomaticKeepAliveClientMixin< } } - Widget _buildClickableTitle(String title, String buttonText, BuildContext context, {Function onClick}) { + Widget _buildClickableTitle(String title, String? buttonText, BuildContext context, {Function? onClick}) { final theme = Theme.of(context); final row = buttonText != null ? Row( @@ -123,7 +123,7 @@ class _HomePageState extends State with AutomaticKeepAliveClientMixin< title: Text( title, textAlign: TextAlign.start, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), ), diff --git a/lib/presentation/home/widgets/change_current_day_dialog.dart b/lib/presentation/home/widgets/change_current_day_dialog.dart index 98638d367..41683d28d 100644 --- a/lib/presentation/home/widgets/change_current_day_dialog.dart +++ b/lib/presentation/home/widgets/change_current_day_dialog.dart @@ -5,8 +5,8 @@ class ChangeCurrentDayDialog extends StatefulWidget { final int currentSelectedDay; const ChangeCurrentDayDialog({ - Key key, - @required this.currentSelectedDay, + Key? key, + required this.currentSelectedDay, }) : super(key: key); @override @@ -14,7 +14,7 @@ class ChangeCurrentDayDialog extends StatefulWidget { } class _ChangeCurrentDayDialogState extends State { - int currentSelectedDay; + late int currentSelectedDay; @override void initState() { diff --git a/lib/presentation/home/widgets/char_card_ascension_material.dart b/lib/presentation/home/widgets/char_card_ascension_material.dart index a09fe6116..4ad2a48ef 100644 --- a/lib/presentation/home/widgets/char_card_ascension_material.dart +++ b/lib/presentation/home/widgets/char_card_ascension_material.dart @@ -9,24 +9,24 @@ class CharCardAscensionMaterial extends StatelessWidget { final String name; final String image; final List charImgs; - final String bossName; + final String? bossName; final List days; const CharCardAscensionMaterial.fromDays({ - Key key, - @required this.name, - @required this.image, - @required this.days, - @required this.charImgs, + Key? key, + required this.name, + required this.image, + required this.days, + required this.charImgs, }) : bossName = null, super(key: key); const CharCardAscensionMaterial.fromBoss({ - Key key, - @required this.name, - @required this.image, - @required this.bossName, - @required this.charImgs, + Key? key, + required this.name, + required this.image, + required this.bossName, + required this.charImgs, }) : days = const [], super(key: key); @@ -35,7 +35,7 @@ class CharCardAscensionMaterial extends StatelessWidget { final s = S.of(context); final theme = Theme.of(context); final chars = charImgs.map((e) => CircleCharacter(image: e)).toList(); - final obtainOn = days.isNotEmpty ? s.translateDays(days) : bossName; + final obtainOn = days.isNotEmpty ? s.translateDays(days) : bossName!; return Card( margin: Styles.edgeInsetAll10, @@ -58,7 +58,7 @@ class CharCardAscensionMaterial extends StatelessWidget { name, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Tooltip( @@ -66,7 +66,7 @@ class CharCardAscensionMaterial extends StatelessWidget { child: Text( obtainOn, textAlign: TextAlign.center, - style: theme.textTheme.subtitle2.copyWith(fontSize: 12), + style: theme.textTheme.subtitle2!.copyWith(fontSize: 12), ), ), ], diff --git a/lib/presentation/home/widgets/main_title.dart b/lib/presentation/home/widgets/main_title.dart index 5782a6990..6796e180c 100644 --- a/lib/presentation/home/widgets/main_title.dart +++ b/lib/presentation/home/widgets/main_title.dart @@ -6,8 +6,8 @@ class MainTitle extends StatelessWidget { final String title; const MainTitle({ - Key key, - @required this.title, + Key? key, + required this.title, }) : super(key: key); @override @@ -17,7 +17,7 @@ class MainTitle extends StatelessWidget { margin: Styles.edgeInsetHorizontal16, child: Text( title, - style: theme.textTheme.headline6.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.headline6!.copyWith(fontWeight: FontWeight.bold), overflow: TextOverflow.ellipsis, ), ); diff --git a/lib/presentation/home/widgets/sliver_calculators_card.dart b/lib/presentation/home/widgets/sliver_calculators_card.dart index 4b02b7be5..bd62df464 100644 --- a/lib/presentation/home/widgets/sliver_calculators_card.dart +++ b/lib/presentation/home/widgets/sliver_calculators_card.dart @@ -10,8 +10,8 @@ class SliverCalculatorsCard extends StatelessWidget { final bool iconToTheLeft; const SliverCalculatorsCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_card_item.dart b/lib/presentation/home/widgets/sliver_card_item.dart index a77cda475..09d8d0bb8 100644 --- a/lib/presentation/home/widgets/sliver_card_item.dart +++ b/lib/presentation/home/widgets/sliver_card_item.dart @@ -8,10 +8,10 @@ class SliverCardItem extends StatelessWidget { final Function(BuildContext) onClick; const SliverCardItem({ - Key key, - @required this.icon, - @required this.onClick, - @required this.children, + Key? key, + required this.icon, + required this.onClick, + required this.children, this.iconToTheLeft = false, }) : super(key: key); diff --git a/lib/presentation/home/widgets/sliver_characters_birthday_card.dart b/lib/presentation/home/widgets/sliver_characters_birthday_card.dart index 07d39bbb5..2c87dbafc 100644 --- a/lib/presentation/home/widgets/sliver_characters_birthday_card.dart +++ b/lib/presentation/home/widgets/sliver_characters_birthday_card.dart @@ -45,7 +45,7 @@ class SliverCharactersBirthdayCard extends StatelessWidget { message: s.happyBirthday, child: Text( s.happyBirthday, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, ), diff --git a/lib/presentation/home/widgets/sliver_daily_check_in_card.dart b/lib/presentation/home/widgets/sliver_daily_check_in_card.dart index 003045fe3..fb79e95f8 100644 --- a/lib/presentation/home/widgets/sliver_daily_check_in_card.dart +++ b/lib/presentation/home/widgets/sliver_daily_check_in_card.dart @@ -7,8 +7,8 @@ class SliverDailyCheckInCard extends StatelessWidget { final bool iconToTheLeft; const SliverDailyCheckInCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_game_codes_card.dart b/lib/presentation/home/widgets/sliver_game_codes_card.dart index 3402996c9..b385a20cb 100644 --- a/lib/presentation/home/widgets/sliver_game_codes_card.dart +++ b/lib/presentation/home/widgets/sliver_game_codes_card.dart @@ -10,8 +10,8 @@ class SliverGameCodesCard extends StatelessWidget { final bool iconToTheLeft; const SliverGameCodesCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_main_title.dart b/lib/presentation/home/widgets/sliver_main_title.dart index 9ae5bbbf6..b057313e5 100644 --- a/lib/presentation/home/widgets/sliver_main_title.dart +++ b/lib/presentation/home/widgets/sliver_main_title.dart @@ -6,8 +6,8 @@ class SliverMainTitle extends StatelessWidget { final String title; const SliverMainTitle({ - Key key, - @required this.title, + Key? key, + required this.title, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_materials_card.dart b/lib/presentation/home/widgets/sliver_materials_card.dart index f54e1a0ce..c0d004824 100644 --- a/lib/presentation/home/widgets/sliver_materials_card.dart +++ b/lib/presentation/home/widgets/sliver_materials_card.dart @@ -11,8 +11,8 @@ class SliverMaterialsCard extends StatelessWidget { final bool iconToTheLeft; const SliverMaterialsCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_monsters_card.dart b/lib/presentation/home/widgets/sliver_monsters_card.dart index 10fc08379..782a7d06e 100644 --- a/lib/presentation/home/widgets/sliver_monsters_card.dart +++ b/lib/presentation/home/widgets/sliver_monsters_card.dart @@ -10,8 +10,8 @@ class SliverMonstersCard extends StatelessWidget { final bool iconToTheLeft; const SliverMonstersCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_my_inventory_card.dart b/lib/presentation/home/widgets/sliver_my_inventory_card.dart index 0d14eb06f..7b104f75c 100644 --- a/lib/presentation/home/widgets/sliver_my_inventory_card.dart +++ b/lib/presentation/home/widgets/sliver_my_inventory_card.dart @@ -9,8 +9,8 @@ class SliverMyInventoryCard extends StatelessWidget { final bool iconToTheLeft; const SliverMyInventoryCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_notifications_card.dart b/lib/presentation/home/widgets/sliver_notifications_card.dart index e816475d4..8e05af99e 100644 --- a/lib/presentation/home/widgets/sliver_notifications_card.dart +++ b/lib/presentation/home/widgets/sliver_notifications_card.dart @@ -9,8 +9,8 @@ class SliverNotificationsCard extends StatelessWidget { final bool iconToTheLeft; const SliverNotificationsCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_settings_card.dart b/lib/presentation/home/widgets/sliver_settings_card.dart index 80e017b5d..2e842e2c0 100644 --- a/lib/presentation/home/widgets/sliver_settings_card.dart +++ b/lib/presentation/home/widgets/sliver_settings_card.dart @@ -8,8 +8,8 @@ class SliverSettingsCard extends StatelessWidget { final bool iconToTheLeft; const SliverSettingsCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_tierlist_card.dart b/lib/presentation/home/widgets/sliver_tierlist_card.dart index e41e41998..4de71ebe5 100644 --- a/lib/presentation/home/widgets/sliver_tierlist_card.dart +++ b/lib/presentation/home/widgets/sliver_tierlist_card.dart @@ -11,8 +11,8 @@ class SliverTierList extends StatelessWidget { final bool iconToTheLeft; const SliverTierList({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/sliver_today_main_title.dart b/lib/presentation/home/widgets/sliver_today_main_title.dart index 5f5b63033..587c19b65 100644 --- a/lib/presentation/home/widgets/sliver_today_main_title.dart +++ b/lib/presentation/home/widgets/sliver_today_main_title.dart @@ -8,7 +8,7 @@ import 'package:genshindb/presentation/shared/loading.dart'; import 'package:genshindb/presentation/shared/styles.dart'; class SliverTodayMainTitle extends StatelessWidget { - const SliverTodayMainTitle({Key key}) : super(key: key); + const SliverTodayMainTitle({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -25,7 +25,7 @@ class SliverTodayMainTitle extends StatelessWidget { child: RichText( text: TextSpan( text: s.todayAscensionMaterials, - style: theme.textTheme.headline6.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.headline6!.copyWith(fontWeight: FontWeight.bold), children: [ TextSpan( text: ' [ ${state.dayName} ]', diff --git a/lib/presentation/home/widgets/sliver_wish_simulator_card.dart b/lib/presentation/home/widgets/sliver_wish_simulator_card.dart index 6b698baf3..d16054e5f 100644 --- a/lib/presentation/home/widgets/sliver_wish_simulator_card.dart +++ b/lib/presentation/home/widgets/sliver_wish_simulator_card.dart @@ -9,8 +9,8 @@ class SliverWishSimulatorCard extends StatelessWidget { final bool iconToTheLeft; const SliverWishSimulatorCard({ - Key key, - @required this.iconToTheLeft, + Key? key, + required this.iconToTheLeft, }) : super(key: key); @override diff --git a/lib/presentation/home/widgets/weapon_card_ascension_material.dart b/lib/presentation/home/widgets/weapon_card_ascension_material.dart index d4e05408d..a1fc09500 100644 --- a/lib/presentation/home/widgets/weapon_card_ascension_material.dart +++ b/lib/presentation/home/widgets/weapon_card_ascension_material.dart @@ -12,11 +12,11 @@ class WeaponCardAscensionMaterial extends StatelessWidget { final List weapons; const WeaponCardAscensionMaterial({ - Key key, - @required this.name, - @required this.image, - @required this.days, - @required this.weapons, + Key? key, + required this.name, + required this.image, + required this.days, + required this.weapons, }) : super(key: key); @override @@ -40,7 +40,7 @@ class WeaponCardAscensionMaterial extends StatelessWidget { name, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Tooltip( @@ -49,7 +49,7 @@ class WeaponCardAscensionMaterial extends StatelessWidget { obtainOn, textAlign: TextAlign.center, overflow: TextOverflow.visible, - style: theme.textTheme.subtitle2.copyWith(fontSize: 12), + style: theme.textTheme.subtitle2!.copyWith(fontSize: 12), ), ), SizedBox( diff --git a/lib/presentation/inventory/widgets/characters_inventory_tab_page.dart b/lib/presentation/inventory/widgets/characters_inventory_tab_page.dart index 36ec2c674..ec8ba7870 100644 --- a/lib/presentation/inventory/widgets/characters_inventory_tab_page.dart +++ b/lib/presentation/inventory/widgets/characters_inventory_tab_page.dart @@ -64,6 +64,6 @@ class _CharactersInventoryTabPageState extends State return; } - inventoryBloc.add(InventoryEvent.addCharacter(key: keyName)); + inventoryBloc.add(InventoryEvent.addCharacter(key: keyName!)); } } diff --git a/lib/presentation/inventory/widgets/weapons_inventory_tab_page.dart b/lib/presentation/inventory/widgets/weapons_inventory_tab_page.dart index 71ee63e4b..0a6d330ff 100644 --- a/lib/presentation/inventory/widgets/weapons_inventory_tab_page.dart +++ b/lib/presentation/inventory/widgets/weapons_inventory_tab_page.dart @@ -64,6 +64,6 @@ class _WeaponsInventoryTabPageState extends State with return; } - inventoryBloc.add(InventoryEvent.addWeapon(key: keyName)); + inventoryBloc.add(InventoryEvent.addWeapon(key: keyName!)); } } diff --git a/lib/presentation/main_tab_page.dart b/lib/presentation/main_tab_page.dart index 951bf7493..86cda2f36 100644 --- a/lib/presentation/main_tab_page.dart +++ b/lib/presentation/main_tab_page.dart @@ -20,18 +20,18 @@ class MainTabPage extends StatefulWidget { class _MainTabPageState extends State with SingleTickerProviderStateMixin { bool _didChangeDependencies = false; - TabController _tabController; - int _index; + late TabController _tabController; + late int _index; final _defaultIndex = 2; final _pages = [ const CharactersPage(), const WeaponsPage(), HomePage(), - ArtifactsPage(), + const ArtifactsPage(), MapPage(), ]; - DateTime backButtonPressTime; + DateTime? backButtonPressTime; @override void initState() { @@ -144,7 +144,7 @@ class _MainTabPageState extends State with SingleTickerProviderStat final s = S.of(context); final now = DateTime.now(); - final mustWait = backButtonPressTime == null || now.difference(backButtonPressTime) > ToastUtils.toastDuration; + final mustWait = backButtonPressTime == null || now.difference(backButtonPressTime!) > ToastUtils.toastDuration; if (mustWait) { backButtonPressTime = now; diff --git a/lib/presentation/map/map_page.dart b/lib/presentation/map/map_page.dart index ccec0e270..e03fada00 100644 --- a/lib/presentation/map/map_page.dart +++ b/lib/presentation/map/map_page.dart @@ -89,11 +89,7 @@ class _MapPageState extends State { url: state.mapUrl, userAgent: state.userAgent, ignoreSSLErrors: true, - withJavascript: true, - withLocalStorage: true, appCacheEnabled: true, - clearCookies: false, - clearCache: false, initialChild: const Center( child: CircularProgressIndicator(), ), diff --git a/lib/presentation/material/widgets/material_detail_bottom.dart b/lib/presentation/material/widgets/material_detail_bottom.dart index 4e168b6c4..8e64cd791 100644 --- a/lib/presentation/material/widgets/material_detail_bottom.dart +++ b/lib/presentation/material/widgets/material_detail_bottom.dart @@ -13,7 +13,7 @@ import 'package:genshindb/presentation/shared/styles.dart'; import 'package:genshindb/presentation/shared/wrapped_ascension_material.dart'; class MaterialDetailBottom extends StatelessWidget { - final String description; + final String? description; final int rarity; final List charImgs; final List weaponImgs; @@ -22,14 +22,14 @@ class MaterialDetailBottom extends StatelessWidget { final List droppedBy; const MaterialDetailBottom({ - Key key, - @required this.description, - @required this.rarity, - @required this.charImgs, - @required this.weaponImgs, - @required this.obtainedFrom, - @required this.relatedTo, - @required this.droppedBy, + Key? key, + this.description, + required this.rarity, + required this.charImgs, + required this.weaponImgs, + required this.obtainedFrom, + required this.relatedTo, + required this.droppedBy, }) : super(key: key); @override @@ -43,7 +43,7 @@ class MaterialDetailBottom extends StatelessWidget { padding: Styles.edgeInsetAll10, child: Column( children: [ - if (description.isNotNullEmptyOrWhitespace) _buildDescription(description, rarity, context), + if (description.isNotNullEmptyOrWhitespace) _buildDescription(description!, rarity, context), if (obtainedFrom.isNotEmpty) ItemDescriptionDetail( title: s.obtainedFrom, diff --git a/lib/presentation/material/widgets/material_detail_general_card.dart b/lib/presentation/material/widgets/material_detail_general_card.dart index e1873e0c6..6c7a8b819 100644 --- a/lib/presentation/material/widgets/material_detail_general_card.dart +++ b/lib/presentation/material/widgets/material_detail_general_card.dart @@ -14,11 +14,11 @@ class MaterialDetailGeneralCard extends StatelessWidget { final List days; const MaterialDetailGeneralCard({ - Key key, - @required this.name, - @required this.rarity, - @required this.type, - @required this.days, + Key? key, + required this.name, + required this.rarity, + required this.type, + required this.days, }) : super(key: key); @override @@ -30,7 +30,7 @@ class MaterialDetailGeneralCard extends StatelessWidget { children: [ Text( name, - style: theme.textTheme.headline5.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.headline5!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ), Rarity(stars: rarity, starSize: 25, alignment: MainAxisAlignment.start), ItemDescription( diff --git a/lib/presentation/material/widgets/material_detail_top.dart b/lib/presentation/material/widgets/material_detail_top.dart index e923fe965..1a892c202 100644 --- a/lib/presentation/material/widgets/material_detail_top.dart +++ b/lib/presentation/material/widgets/material_detail_top.dart @@ -14,12 +14,12 @@ class MaterialDetailTop extends StatelessWidget { final List days; const MaterialDetailTop({ - Key key, - @required this.name, - @required this.rarity, - @required this.type, - @required this.image, - @required this.days, + Key? key, + required this.name, + required this.rarity, + required this.type, + required this.image, + required this.days, }) : super(key: key); @override diff --git a/lib/presentation/materials/materials_page.dart b/lib/presentation/materials/materials_page.dart index c98b080e8..c78e2eb74 100644 --- a/lib/presentation/materials/materials_page.dart +++ b/lib/presentation/materials/materials_page.dart @@ -15,7 +15,7 @@ import 'widgets/material_card.dart'; class MaterialsPage extends StatelessWidget { final bool isInSelectionMode; - static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { + static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { final bloc = context.read(); bloc.add(MaterialsEvent.init(excludeKeys: excludeKeys)); @@ -29,7 +29,7 @@ class MaterialsPage extends StatelessWidget { } const MaterialsPage({ - Key key, + Key? key, this.isInSelectionMode = false, }) : super(key: key); diff --git a/lib/presentation/materials/widgets/material_card.dart b/lib/presentation/materials/widgets/material_card.dart index 9f9632a5d..5bd0c5b64 100644 --- a/lib/presentation/materials/widgets/material_card.dart +++ b/lib/presentation/materials/widgets/material_card.dart @@ -17,7 +17,7 @@ const double defaultHeight = 60; class MaterialCard extends StatelessWidget { final String keyName; - final String name; + final String? name; final String image; final int rarity; final double imgWidth; @@ -31,12 +31,12 @@ class MaterialCard extends StatelessWidget { final int usedQuantity; const MaterialCard({ - Key key, - @required this.keyName, - @required this.name, - @required this.image, - @required this.rarity, - @required this.type, + Key? key, + required this.keyName, + required this.name, + required this.image, + required this.rarity, + required this.type, this.imgWidth = defaultWidth, this.imgHeight = defaultHeight, this.withElevation = true, @@ -48,8 +48,8 @@ class MaterialCard extends StatelessWidget { super(key: key); MaterialCard.item({ - Key key, - @required MaterialCardModel item, + Key? key, + required MaterialCardModel item, this.imgWidth = defaultWidth, this.imgHeight = defaultHeight, this.withElevation = true, @@ -66,11 +66,11 @@ class MaterialCard extends StatelessWidget { super(key: key); const MaterialCard.withoutDetails({ - Key key, - @required this.keyName, - @required this.image, - @required this.rarity, - @required this.type, + Key? key, + required this.keyName, + required this.image, + required this.rarity, + required this.type, this.isInSelectionMode = false, }) : name = null, imgWidth = defaultWidth, @@ -83,8 +83,8 @@ class MaterialCard extends StatelessWidget { super(key: key); MaterialCard.quantity({ - Key key, - @required MaterialCardModel item, + Key? key, + required MaterialCardModel item, this.isInSelectionMode = false, }) : keyName = item.key, name = item.name, @@ -137,7 +137,7 @@ class MaterialCard extends StatelessWidget { ), child: Text( ' - ${CurrencyUtils.formatNumber(usedQuantity)} ', - style: theme.textTheme.subtitle2.copyWith(color: Colors.white), + style: theme.textTheme.subtitle2!.copyWith(color: Colors.white), ), ), ), @@ -149,17 +149,17 @@ class MaterialCard extends StatelessWidget { margin: const EdgeInsets.only(bottom: 5), child: Text( CurrencyUtils.formatNumber(quantity), - style: theme.textTheme.subtitle2.copyWith(color: Colors.white), + style: theme.textTheme.subtitle2!.copyWith(color: Colors.white), ), ), if (!withoutDetails && !isInQuantityMode) Center( child: Tooltip( - message: name, + message: name!, child: Text( - name, + name!, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), overflow: TextOverflow.ellipsis, ), ), diff --git a/lib/presentation/monsters/monsters_page.dart b/lib/presentation/monsters/monsters_page.dart index 83382e7b7..271069efa 100644 --- a/lib/presentation/monsters/monsters_page.dart +++ b/lib/presentation/monsters/monsters_page.dart @@ -15,7 +15,7 @@ import 'widgets/monster_card.dart'; class MonstersPage extends StatelessWidget { final bool isInSelectionMode; - static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { + static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { final bloc = context.read(); bloc.add(MonstersEvent.init(excludeKeys: excludeKeys)); @@ -29,7 +29,7 @@ class MonstersPage extends StatelessWidget { } const MonstersPage({ - Key key, + Key? key, this.isInSelectionMode = false, }) : super(key: key); diff --git a/lib/presentation/monsters/widgets/monster_card.dart b/lib/presentation/monsters/widgets/monster_card.dart index 785eaee63..6cc12916c 100644 --- a/lib/presentation/monsters/widgets/monster_card.dart +++ b/lib/presentation/monsters/widgets/monster_card.dart @@ -16,18 +16,18 @@ class MonsterCard extends StatelessWidget { final bool isInSelectionMode; const MonsterCard({ - Key key, - @required this.itemKey, - @required this.image, - @required this.name, - @required this.type, - @required this.isComingSoon, + Key? key, + required this.itemKey, + required this.image, + required this.name, + required this.type, + required this.isComingSoon, this.isInSelectionMode = false, }) : super(key: key); MonsterCard.item({ - Key key, - @required MonsterCardModel item, + Key? key, + required MonsterCardModel item, this.isInSelectionMode = false, }) : itemKey = item.key, type = item.type, @@ -72,7 +72,7 @@ class MonsterCard extends StatelessWidget { child: Text( name, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), ), diff --git a/lib/presentation/notifications/notifications_page.dart b/lib/presentation/notifications/notifications_page.dart index 294088d06..4d397458a 100644 --- a/lib/presentation/notifications/notifications_page.dart +++ b/lib/presentation/notifications/notifications_page.dart @@ -95,9 +95,9 @@ class _NotificationsPageState extends State with SingleTicker createdAt: element.createdAt, completesAt: element.completesAt, note: element.note, - initialRealmCurrency: element.realmCurrency, - currentRankType: element.realmRankType, - currentTrustRank: element.realmTrustRank, + initialRealmCurrency: element.realmCurrency!, + currentRankType: element.realmRankType!, + currentTrustRank: element.realmTrustRank!, useTwentyFourHoursFormat: useTwentyFourHoursFormat, ); break; diff --git a/lib/presentation/notifications/widgets/add_edit_notification_bottom_sheet.dart b/lib/presentation/notifications/widgets/add_edit_notification_bottom_sheet.dart index 3b0af7055..637607e64 100644 --- a/lib/presentation/notifications/widgets/add_edit_notification_bottom_sheet.dart +++ b/lib/presentation/notifications/widgets/add_edit_notification_bottom_sheet.dart @@ -19,8 +19,8 @@ class AddEditNotificationBottomSheet extends StatelessWidget { final bool isInEditMode; const AddEditNotificationBottomSheet({ - Key key, - @required this.isInEditMode, + Key? key, + required this.isInEditMode, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_circle_item.dart b/lib/presentation/notifications/widgets/forms/notification_circle_item.dart index a687ab711..2c14fa6b3 100644 --- a/lib/presentation/notifications/widgets/forms/notification_circle_item.dart +++ b/lib/presentation/notifications/widgets/forms/notification_circle_item.dart @@ -13,24 +13,24 @@ import 'package:genshindb/presentation/weapons/weapons_page.dart'; class NotificationCircleItem extends StatelessWidget { final AppNotificationType type; - final AppNotificationItemType itemType; + final AppNotificationItemType? itemType; final bool showOtherImages; final List images; NotificationItemImage get selected => images.firstWhere((el) => el.isSelected); const NotificationCircleItem({ - Key key, - @required this.type, - @required this.images, + Key? key, + required this.type, + required this.images, this.showOtherImages = false, }) : itemType = null, super(key: key); const NotificationCircleItem.custom({ - Key key, - @required this.itemType, - @required this.images, + Key? key, + required this.itemType, + required this.images, this.showOtherImages = false, }) : type = AppNotificationType.custom, super(key: key); @@ -155,12 +155,12 @@ class NotificationCircleItem extends StatelessWidget { _onItemSelected(keyName, context); } - void _onItemSelected(String keyName, BuildContext context) { + void _onItemSelected(String? keyName, BuildContext context) { if (keyName.isNullEmptyOrWhitespace) { return; } - context.read().add(NotificationEvent.keySelected(keyName: keyName)); + context.read().add(NotificationEvent.keySelected(keyName: keyName!)); } void _changeSelectedImg(String newValue, BuildContext context) => diff --git a/lib/presentation/notifications/widgets/forms/notification_custom_form.dart b/lib/presentation/notifications/widgets/forms/notification_custom_form.dart index 50c1b77bf..20723f6f9 100644 --- a/lib/presentation/notifications/widgets/forms/notification_custom_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_custom_form.dart @@ -29,18 +29,18 @@ class NotificationCustomForm extends StatelessWidget { final bool useTwentyFourHoursFormat; const NotificationCustomForm({ - Key key, - @required this.itemType, - @required this.title, - @required this.body, - @required this.note, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, - @required this.scheduledDate, - @required this.language, - @required this.useTwentyFourHoursFormat, + Key? key, + required this.itemType, + required this.title, + required this.body, + required this.note, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, + required this.scheduledDate, + required this.language, + required this.useTwentyFourHoursFormat, }) : super(key: key); @override @@ -104,7 +104,7 @@ class NotificationCustomForm extends StatelessWidget { initialTime: TimeOfDay.fromDateTime(scheduledDate), builder: (context, child) => MediaQuery( data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: useTwentyFourHoursFormat), - child: child, + child: child!, ), ); if (time == null) { diff --git a/lib/presentation/notifications/widgets/forms/notification_daily_checkin_form.dart b/lib/presentation/notifications/widgets/forms/notification_daily_checkin_form.dart index 28acf417a..be1ac2b0d 100644 --- a/lib/presentation/notifications/widgets/forms/notification_daily_checkin_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_daily_checkin_form.dart @@ -1,7 +1,6 @@ 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/notifications/widgets/forms/notification_note.dart'; import 'notification_circle_item.dart'; @@ -19,19 +18,18 @@ class NotificationDailyCheckIn extends StatelessWidget { final bool showOtherImages; const NotificationDailyCheckIn({ - Key key, - @required this.title, - @required this.body, - @required this.note, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, + Key? key, + required this.title, + required this.body, + required this.note, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override Widget build(BuildContext context) { - final s = S.of(context); return Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.spaceEvenly, diff --git a/lib/presentation/notifications/widgets/forms/notification_dropdown_type.dart b/lib/presentation/notifications/widgets/forms/notification_dropdown_type.dart index b04872bef..8a4699884 100644 --- a/lib/presentation/notifications/widgets/forms/notification_dropdown_type.dart +++ b/lib/presentation/notifications/widgets/forms/notification_dropdown_type.dart @@ -13,9 +13,9 @@ class NotificationDropdownType extends StatelessWidget { final bool isExpanded; const NotificationDropdownType({ - Key key, - @required this.selectedValue, - @required this.isInEditMode, + Key? key, + required this.selectedValue, + required this.isInEditMode, this.isExpanded = true, }) : super(key: key); diff --git a/lib/presentation/notifications/widgets/forms/notification_expedition_form.dart b/lib/presentation/notifications/widgets/forms/notification_expedition_form.dart index 609e94d3d..697bb2e5a 100644 --- a/lib/presentation/notifications/widgets/forms/notification_expedition_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_expedition_form.dart @@ -25,16 +25,16 @@ class NotificationExpeditionForm extends StatelessWidget { final bool showOtherImages; const NotificationExpeditionForm({ - Key key, - @required this.title, - @required this.body, - @required this.note, - @required this.timeType, - @required this.showNotification, - @required this.withTimeReduction, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, + Key? key, + required this.title, + required this.body, + required this.note, + required this.timeType, + required this.showNotification, + required this.withTimeReduction, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_farming_artifact_form.dart b/lib/presentation/notifications/widgets/forms/notification_farming_artifact_form.dart index e7f948608..c2ae22b4e 100644 --- a/lib/presentation/notifications/widgets/forms/notification_farming_artifact_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_farming_artifact_form.dart @@ -26,15 +26,15 @@ class NotificationFarmingArtifactForm extends StatelessWidget { final bool showOtherImages; const NotificationFarmingArtifactForm({ - Key key, - @required this.title, - @required this.body, - @required this.note, - @required this.artifactFarmingTimeType, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, + Key? key, + required this.title, + required this.body, + required this.note, + required this.artifactFarmingTimeType, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_farming_material_form.dart b/lib/presentation/notifications/widgets/forms/notification_farming_material_form.dart index ba8af8180..df6478e59 100644 --- a/lib/presentation/notifications/widgets/forms/notification_farming_material_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_farming_material_form.dart @@ -13,21 +13,21 @@ const _type = AppNotificationType.farmingMaterials; class NotificationFarmingMaterialForm extends StatelessWidget { final String title; final String body; - final String note; + final String? note; final bool showNotification; final bool isInEditMode; final List images; final bool showOtherImages; const NotificationFarmingMaterialForm({ - Key key, - this.title, - this.body, + Key? key, + required this.title, + required this.body, this.note, - this.showNotification, - this.isInEditMode, - this.images, - this.showOtherImages, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_furniture_form.dart b/lib/presentation/notifications/widgets/forms/notification_furniture_form.dart index 0c54d020e..f49f31380 100644 --- a/lib/presentation/notifications/widgets/forms/notification_furniture_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_furniture_form.dart @@ -26,15 +26,15 @@ class NotificationFurnitureForm extends StatelessWidget { final bool showOtherImages; const NotificationFurnitureForm({ - Key key, - @required this.timeType, - @required this.title, - @required this.body, - @required this.note, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, + Key? key, + required this.timeType, + required this.title, + required this.body, + required this.note, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_gadget_form.dart b/lib/presentation/notifications/widgets/forms/notification_gadget_form.dart index eaef52aaf..4ef02324a 100644 --- a/lib/presentation/notifications/widgets/forms/notification_gadget_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_gadget_form.dart @@ -13,21 +13,21 @@ const _type = AppNotificationType.gadget; class NotificationGadgetForm extends StatelessWidget { final String title; final String body; - final String note; + final String? note; final bool showNotification; final bool isInEditMode; final List images; final bool showOtherImages; const NotificationGadgetForm({ - Key key, - this.title, - this.body, + Key? key, + required this.title, + required this.body, this.note, - this.showNotification, - this.isInEditMode, - this.images, - this.showOtherImages, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_note.dart b/lib/presentation/notifications/widgets/forms/notification_note.dart index db355750c..713fd01a3 100644 --- a/lib/presentation/notifications/widgets/forms/notification_note.dart +++ b/lib/presentation/notifications/widgets/forms/notification_note.dart @@ -4,17 +4,17 @@ import 'package:genshindb/application/bloc.dart'; import 'package:genshindb/generated/l10n.dart'; class NotificationNote extends StatefulWidget { - final String note; + final String? note; - const NotificationNote({Key key, @required this.note}) : super(key: key); + const NotificationNote({Key? key, required this.note}) : super(key: key); @override _NotificationNoteState createState() => _NotificationNoteState(); } class _NotificationNoteState extends State { - TextEditingController _textController; - String _currentValue; + late TextEditingController _textController; + String? _currentValue; @override void initState() { diff --git a/lib/presentation/notifications/widgets/forms/notification_realm_currency_form.dart b/lib/presentation/notifications/widgets/forms/notification_realm_currency_form.dart index 213cfa273..18efad9d2 100644 --- a/lib/presentation/notifications/widgets/forms/notification_realm_currency_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_realm_currency_form.dart @@ -30,17 +30,17 @@ class NotificationRealmCurrency extends StatelessWidget { final int currentTrustRank; const NotificationRealmCurrency({ - Key key, - @required this.title, - @required this.body, - @required this.currentRealmCurrency, - @required this.note, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, - @required this.currentRankType, - @required this.currentTrustRank, + Key? key, + required this.title, + required this.body, + required this.currentRealmCurrency, + required this.note, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, + required this.currentRankType, + required this.currentTrustRank, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_resin_form.dart b/lib/presentation/notifications/widgets/forms/notification_resin_form.dart index 2bb5379df..c05f3cb8c 100644 --- a/lib/presentation/notifications/widgets/forms/notification_resin_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_resin_form.dart @@ -24,15 +24,15 @@ class NotificationResinForm extends StatelessWidget { final bool showOtherImages; const NotificationResinForm({ - Key key, - @required this.title, - @required this.body, - @required this.currentResin, - @required this.note, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, + Key? key, + required this.title, + required this.body, + required this.currentResin, + required this.note, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_switch.dart b/lib/presentation/notifications/widgets/forms/notification_switch.dart index 9b058f314..da26e1f71 100644 --- a/lib/presentation/notifications/widgets/forms/notification_switch.dart +++ b/lib/presentation/notifications/widgets/forms/notification_switch.dart @@ -7,8 +7,8 @@ class NotificationSwitch extends StatelessWidget { final bool showNotification; const NotificationSwitch({ - Key key, - @required this.showNotification, + Key? key, + required this.showNotification, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/forms/notification_title_body.dart b/lib/presentation/notifications/widgets/forms/notification_title_body.dart index 8fc706b76..e909d43bc 100644 --- a/lib/presentation/notifications/widgets/forms/notification_title_body.dart +++ b/lib/presentation/notifications/widgets/forms/notification_title_body.dart @@ -8,9 +8,9 @@ class NotificationTitleBody extends StatefulWidget { final String body; const NotificationTitleBody({ - Key key, - @required this.title, - @required this.body, + Key? key, + required this.title, + required this.body, }) : super(key: key); @override @@ -18,11 +18,11 @@ class NotificationTitleBody extends StatefulWidget { } class _NotificationTitleBodyState extends State { - TextEditingController _titleController; - TextEditingController _bodyController; + late TextEditingController _titleController; + late TextEditingController _bodyController; - String _title; - String _body; + late String _title; + late String _body; @override void initState() { diff --git a/lib/presentation/notifications/widgets/forms/notification_weekly_boss_form.dart b/lib/presentation/notifications/widgets/forms/notification_weekly_boss_form.dart index e28dbbca5..cda0c89e5 100644 --- a/lib/presentation/notifications/widgets/forms/notification_weekly_boss_form.dart +++ b/lib/presentation/notifications/widgets/forms/notification_weekly_boss_form.dart @@ -20,14 +20,14 @@ class NotificationWeeklyBossForm extends StatelessWidget { final bool showOtherImages; const NotificationWeeklyBossForm({ - Key key, - @required this.title, - @required this.body, - @required this.note, - @required this.showNotification, - @required this.isInEditMode, - @required this.images, - @required this.showOtherImages, + Key? key, + required this.title, + required this.body, + required this.note, + required this.showNotification, + required this.isInEditMode, + required this.images, + required this.showOtherImages, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/items/notification_list_subtitle.dart b/lib/presentation/notifications/widgets/items/notification_list_subtitle.dart index 78620035c..50259a769 100644 --- a/lib/presentation/notifications/widgets/items/notification_list_subtitle.dart +++ b/lib/presentation/notifications/widgets/items/notification_list_subtitle.dart @@ -6,15 +6,15 @@ import 'notification_list_subtitle_dates.dart'; class NotificationSubtitle extends StatelessWidget { final DateTime createdAt; final DateTime completesAt; - final String note; + final String? note; final List children; final bool useTwentyFourHoursFormat; const NotificationSubtitle({ - Key key, - @required this.createdAt, - @required this.completesAt, - @required this.useTwentyFourHoursFormat, + Key? key, + required this.createdAt, + required this.completesAt, + required this.useTwentyFourHoursFormat, this.note, this.children = const [], }) : super(key: key); @@ -28,7 +28,7 @@ class NotificationSubtitle extends StatelessWidget { children: [ if (note.isNotNullEmptyOrWhitespace) Text( - note, + note!, style: theme.textTheme.subtitle2, overflow: TextOverflow.ellipsis, ), diff --git a/lib/presentation/notifications/widgets/items/notification_list_subtitle_dates.dart b/lib/presentation/notifications/widgets/items/notification_list_subtitle_dates.dart index 1cb2fa5f3..987ddac0e 100644 --- a/lib/presentation/notifications/widgets/items/notification_list_subtitle_dates.dart +++ b/lib/presentation/notifications/widgets/items/notification_list_subtitle_dates.dart @@ -7,10 +7,10 @@ class NotificationListSubtitleDates extends StatelessWidget { final bool useTwentyFourHoursFormat; const NotificationListSubtitleDates({ - Key key, - @required this.createdAt, - @required this.completesAt, - @required this.useTwentyFourHoursFormat, + Key? key, + required this.createdAt, + required this.completesAt, + required this.useTwentyFourHoursFormat, }) : super(key: key); @override diff --git a/lib/presentation/notifications/widgets/items/notification_list_tile.dart b/lib/presentation/notifications/widgets/items/notification_list_tile.dart index 0669b016a..bc69cd5f7 100644 --- a/lib/presentation/notifications/widgets/items/notification_list_tile.dart +++ b/lib/presentation/notifications/widgets/items/notification_list_tile.dart @@ -20,16 +20,16 @@ class NotificationListTitle extends StatelessWidget { final Duration remaining; final DateTime createdAt; final DateTime completesAt; - final String note; + final String? note; final bool showNotification; final Widget subtitle; NotificationListTitle({ - Key key, - @required models.NotificationItem item, - @required this.subtitle, - }) : itemKey = item.key, + Key? key, + required models.NotificationItem item, + required this.subtitle, + }) : itemKey = item.key, type = item.type, image = item.image, remaining = item.remaining, diff --git a/lib/presentation/notifications/widgets/items/notification_realm_currency_subtitle.dart b/lib/presentation/notifications/widgets/items/notification_realm_currency_subtitle.dart index 23cdd619b..fd87191e5 100644 --- a/lib/presentation/notifications/widgets/items/notification_realm_currency_subtitle.dart +++ b/lib/presentation/notifications/widgets/items/notification_realm_currency_subtitle.dart @@ -12,17 +12,17 @@ class NotificationRealmCurrencySubtitle extends StatelessWidget { final int currentTrustRank; final DateTime createdAt; final DateTime completesAt; - final String note; + final String? note; final bool useTwentyFourHoursFormat; const NotificationRealmCurrencySubtitle({ - Key key, - @required this.initialRealmCurrency, - @required this.currentRankType, - @required this.currentTrustRank, - @required this.createdAt, - @required this.completesAt, - @required this.useTwentyFourHoursFormat, + Key? key, + required this.initialRealmCurrency, + required this.currentRankType, + required this.currentTrustRank, + required this.createdAt, + required this.completesAt, + required this.useTwentyFourHoursFormat, this.note, }) : super(key: key); diff --git a/lib/presentation/notifications/widgets/items/notification_resin_list_subtitle.dart b/lib/presentation/notifications/widgets/items/notification_resin_list_subtitle.dart index 80d4b1893..6c18e3f51 100644 --- a/lib/presentation/notifications/widgets/items/notification_resin_list_subtitle.dart +++ b/lib/presentation/notifications/widgets/items/notification_resin_list_subtitle.dart @@ -7,15 +7,15 @@ class NotificationResinSubtitle extends StatelessWidget { final int initialResin; final DateTime createdAt; final DateTime completesAt; - final String note; + final String? note; final bool useTwentyFourHoursFormat; const NotificationResinSubtitle({ - Key key, - @required this.initialResin, - @required this.createdAt, - @required this.completesAt, - @required this.useTwentyFourHoursFormat, + Key? key, + required this.initialResin, + required this.createdAt, + required this.completesAt, + required this.useTwentyFourHoursFormat, this.note, }) : super(key: key); diff --git a/lib/presentation/settings/widgets/about_settings_card.dart b/lib/presentation/settings/widgets/about_settings_card.dart index bc884308f..dd78ce7c6 100644 --- a/lib/presentation/settings/widgets/about_settings_card.dart +++ b/lib/presentation/settings/widgets/about_settings_card.dart @@ -74,7 +74,7 @@ class AboutSettingsCard extends StatelessWidget { margin: const EdgeInsets.only(top: 10), child: Text( s.disclaimer, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Container( @@ -85,7 +85,7 @@ class AboutSettingsCard extends StatelessWidget { margin: const EdgeInsets.only(top: 10), child: Text( s.support, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Container( diff --git a/lib/presentation/settings/widgets/credits_settings_card.dart b/lib/presentation/settings/widgets/credits_settings_card.dart index 8708f7ddd..047929e3a 100644 --- a/lib/presentation/settings/widgets/credits_settings_card.dart +++ b/lib/presentation/settings/widgets/credits_settings_card.dart @@ -28,61 +28,61 @@ class CreditsSettingsCard extends StatelessWidget { margin: const EdgeInsets.only(top: 10), child: Text( s.simplifiedChinese, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), - const BulletList(items: ["2O48#9733"], fontSize: 12), + const BulletList(items: ['2O48#9733'], fontSize: 12), Container( margin: const EdgeInsets.only(top: 10), child: Text( s.russian, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: const [ - Expanded(child: BulletList(items: ["SipTik#8026", "KKTS#8567", "KlimeLime#7577"], fontSize: 12)), - Expanded(child: BulletList(items: ["Avantel#8880", "чебилин#5968", "Anixty#3279"], fontSize: 12)), + Expanded(child: BulletList(items: ['SipTik#8026', 'KKTS#8567', 'KlimeLime#7577'], fontSize: 12)), + Expanded(child: BulletList(items: ['Avantel#8880', 'чебилин#5968', 'Anixty#3279'], fontSize: 12)), ], ), Container( margin: const EdgeInsets.only(top: 10), child: Text( s.portuguese, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: const [ - Expanded(child: BulletList(items: ["Brunoff#0261", "DanPS#4336"], fontSize: 12)), - Expanded(child: BulletList(items: ["JJlago#0406"], fontSize: 12)), + Expanded(child: BulletList(items: ['Brunoff#0261', 'DanPS#4336'], fontSize: 12)), + Expanded(child: BulletList(items: ['JJlago#0406'], fontSize: 12)), ], ), Container( margin: const EdgeInsets.only(top: 10), child: Text( s.italian, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: const [ - Expanded(child: BulletList(items: ["Reniel [Skidex ツ]#7982"], fontSize: 12)), - Expanded(child: BulletList(items: ["Septenebris#7356"], fontSize: 12)), + Expanded(child: BulletList(items: ['Reniel [Skidex ツ]#7982'], fontSize: 12)), + Expanded(child: BulletList(items: ['Septenebris#7356'], fontSize: 12)), ], ), Container( margin: const EdgeInsets.only(top: 10), child: Text( s.japanese, - style: textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), - const BulletList(items: ["Ruri#3080"], fontSize: 12), + const BulletList(items: ['Ruri#3080'], fontSize: 12), ], ), ), diff --git a/lib/presentation/settings/widgets/language_settings_card.dart b/lib/presentation/settings/widgets/language_settings_card.dart index 367a34acf..50fd2e41a 100644 --- a/lib/presentation/settings/widgets/language_settings_card.dart +++ b/lib/presentation/settings/widgets/language_settings_card.dart @@ -54,7 +54,7 @@ class LanguageSettingsCard extends StatelessWidget { height: 0, color: Colors.transparent, ), - onChanged: (v) => _languageChanged(v, context), + onChanged: (v) => _languageChanged(v!, context), items: languages .map>( (lang) => DropdownMenuItem( diff --git a/lib/presentation/settings/widgets/other_settings.dart b/lib/presentation/settings/widgets/other_settings.dart index d5ef4f0c9..5ea1206b1 100644 --- a/lib/presentation/settings/widgets/other_settings.dart +++ b/lib/presentation/settings/widgets/other_settings.dart @@ -81,7 +81,7 @@ class OtherSettings extends StatelessWidget { hint: Text(s.chooseServer), value: settingsState.serverResetTime, underline: Container(height: 0, color: Colors.transparent), - onChanged: (v) => context.read().add(SettingsEvent.serverResetTimeChanged(newValue: v)), + onChanged: (v) => context.read().add(SettingsEvent.serverResetTimeChanged(newValue: v!)), items: AppServerResetTimeType.values .map((type) => DropdownMenuItem(value: type, child: Text(s.translateServerResetTimeType(type)))) .toList(), diff --git a/lib/presentation/settings/widgets/settings_card.dart b/lib/presentation/settings/widgets/settings_card.dart index 3c78f2298..3e05eed23 100644 --- a/lib/presentation/settings/widgets/settings_card.dart +++ b/lib/presentation/settings/widgets/settings_card.dart @@ -5,8 +5,8 @@ class SettingsCard extends StatelessWidget { final Widget child; const SettingsCard({ - Key key, - @required this.child, + Key? key, + required this.child, }) : super(key: key); @override diff --git a/lib/presentation/settings/widgets/settings_card_content.dart b/lib/presentation/settings/widgets/settings_card_content.dart index 9e07e83a5..30f404c72 100644 --- a/lib/presentation/settings/widgets/settings_card_content.dart +++ b/lib/presentation/settings/widgets/settings_card_content.dart @@ -8,11 +8,11 @@ class SettingsCardContent extends StatelessWidget { final Widget child; const SettingsCardContent({ - Key key, - @required this.title, - @required this.subTitle, - @required this.icon, - @required this.child, + Key? key, + required this.title, + required this.subTitle, + required this.icon, + required this.child, }) : super(key: key); @override diff --git a/lib/presentation/settings/widgets/theme_settings_card.dart b/lib/presentation/settings/widgets/theme_settings_card.dart index af136c4d5..120a1d2ee 100644 --- a/lib/presentation/settings/widgets/theme_settings_card.dart +++ b/lib/presentation/settings/widgets/theme_settings_card.dart @@ -51,7 +51,7 @@ class ThemeSettingsCard extends StatelessWidget { height: 0, color: Colors.transparent, ), - onChanged: (v) => _appThemeChanged(v, context), + onChanged: (v) => _appThemeChanged(v!, context), items: AppThemeType.values .map>( (theme) => DropdownMenuItem( diff --git a/lib/presentation/shared/app_fab.dart b/lib/presentation/shared/app_fab.dart index 9fe5f4ce7..9ba5f9117 100644 --- a/lib/presentation/shared/app_fab.dart +++ b/lib/presentation/shared/app_fab.dart @@ -9,12 +9,12 @@ class AppFab extends StatelessWidget { final AnimationController hideFabAnimController; final Widget icon; final bool mini; - final OnClick onPressed; + final OnClick? onPressed; const AppFab({ - Key key, - @required this.scrollController, - @required this.hideFabAnimController, + Key? key, + required this.scrollController, + required this.hideFabAnimController, this.icon = const Icon(Icons.arrow_upward), this.mini = true, this.onPressed, @@ -29,7 +29,7 @@ class AppFab extends StatelessWidget { child: FloatingActionButton( backgroundColor: Theme.of(context).primaryColor, mini: mini, - onPressed: () => onPressed != null ? onPressed() : scrollController.goToTheTop(), + onPressed: () => onPressed != null ? onPressed!() : scrollController.goToTheTop(), heroTag: null, child: icon, ), diff --git a/lib/presentation/shared/bottom_sheet_title.dart b/lib/presentation/shared/bottom_sheet_title.dart index f3bbd507c..42eb3e964 100644 --- a/lib/presentation/shared/bottom_sheet_title.dart +++ b/lib/presentation/shared/bottom_sheet_title.dart @@ -7,9 +7,9 @@ class BottomSheetTitle extends StatelessWidget { final IconData icon; final double iconSize; const BottomSheetTitle({ - Key key, - @required this.title, - @required this.icon, + Key? key, + required this.title, + required this.icon, this.iconSize = 25, }) : super(key: key); diff --git a/lib/presentation/shared/bullet_list.dart b/lib/presentation/shared/bullet_list.dart index c5e06e3bd..a489d6435 100644 --- a/lib/presentation/shared/bullet_list.dart +++ b/lib/presentation/shared/bullet_list.dart @@ -6,12 +6,12 @@ import 'styles.dart'; class BulletList extends StatelessWidget { final List items; final Widget icon; - final Widget Function(int) iconResolver; + final Widget Function(int)? iconResolver; final double fontSize; const BulletList({ - Key key, - @required this.items, + Key? key, + required this.items, this.icon = const Icon(Icons.fiber_manual_record, size: 15), this.iconResolver, this.fontSize = 11, @@ -26,9 +26,8 @@ class BulletList extends StatelessWidget { (e, index) { var leading = icon; if (iconResolver != null) { - leading = iconResolver(index); + leading = iconResolver!(index); } - assert(leading != null); return ListTile( dense: true, @@ -37,7 +36,7 @@ class BulletList extends StatelessWidget { leading: leading, title: Transform.translate( offset: Styles.listItemWithIconOffset, - child: Tooltip(message: e, child: Text(e, style: theme.textTheme.bodyText2.copyWith(fontSize: fontSize))), + child: Tooltip(message: e, child: Text(e, style: theme.textTheme.bodyText2!.copyWith(fontSize: fontSize))), ), ); }, diff --git a/lib/presentation/shared/child_item_disabled.dart b/lib/presentation/shared/child_item_disabled.dart index 165f78fdb..9a11b9dd7 100644 --- a/lib/presentation/shared/child_item_disabled.dart +++ b/lib/presentation/shared/child_item_disabled.dart @@ -5,8 +5,8 @@ class ChildItemDisabled extends StatelessWidget { final bool isDisabled; const ChildItemDisabled({ - Key key, - @required this.child, + Key? key, + required this.child, this.isDisabled = true, }) : super(key: key); diff --git a/lib/presentation/shared/circle_character.dart b/lib/presentation/shared/circle_character.dart index 510080616..55696be2e 100644 --- a/lib/presentation/shared/circle_character.dart +++ b/lib/presentation/shared/circle_character.dart @@ -9,11 +9,11 @@ class CircleCharacter extends StatelessWidget { final String image; final double radius; final bool forDrag; - final Function(String) onTap; + final Function(String)? onTap; const CircleCharacter({ - Key key, - @required this.image, + Key? key, + required this.image, this.radius = 35, this.forDrag = false, this.onTap, @@ -24,7 +24,7 @@ class CircleCharacter extends StatelessWidget { return CircleItem( image: image, forDrag: forDrag, - onTap: (img) => onTap != null ? onTap(img) : _gotoCharacterPage(context), + onTap: (img) => onTap != null ? onTap!(img) : _gotoCharacterPage(context), radius: radius, ); } diff --git a/lib/presentation/shared/circle_item.dart b/lib/presentation/shared/circle_item.dart index ef0bb4718..518f4700e 100644 --- a/lib/presentation/shared/circle_item.dart +++ b/lib/presentation/shared/circle_item.dart @@ -4,11 +4,11 @@ class CircleItem extends StatelessWidget { final String image; final double radius; final bool forDrag; - final Function(String) onTap; + final Function(String)? onTap; const CircleItem({ - Key key, - @required this.image, + Key? key, + required this.image, this.radius = 35, this.forDrag = false, this.onTap, @@ -31,7 +31,7 @@ class CircleItem extends StatelessWidget { child: InkWell( radius: radius, borderRadius: BorderRadius.circular(radius), - onTap: () => onTap != null ? onTap(image) : {}, + onTap: () => onTap != null ? onTap!(image) : {}, child: avatar, ), ); diff --git a/lib/presentation/shared/circle_monster.dart b/lib/presentation/shared/circle_monster.dart index 56ac5d9ee..c6008caab 100644 --- a/lib/presentation/shared/circle_monster.dart +++ b/lib/presentation/shared/circle_monster.dart @@ -7,11 +7,11 @@ import 'circle_item.dart'; class CircleMonster extends StatelessWidget { final String image; final double radius; - final Function(String) onTap; + final Function(String)? onTap; const CircleMonster({ - Key key, - @required this.image, + Key? key, + required this.image, this.radius = 35, this.onTap, }) : super(key: key); @@ -23,7 +23,7 @@ class CircleMonster extends StatelessWidget { return CircleItem( image: image, radius: radius, - onTap: (_) => onTap != null ? onTap(image) : ToastUtils.showWarningToast(fToast, s.comingSoon), + onTap: (_) => onTap != null ? onTap!(image) : ToastUtils.showWarningToast(fToast, s.comingSoon), ); } } diff --git a/lib/presentation/shared/circle_weapon.dart b/lib/presentation/shared/circle_weapon.dart index c01f62209..e14fd251c 100644 --- a/lib/presentation/shared/circle_weapon.dart +++ b/lib/presentation/shared/circle_weapon.dart @@ -9,11 +9,11 @@ class CircleWeapon extends StatelessWidget { final String image; final double radius; final bool forDrag; - final Function(String) onTap; + final Function(String)? onTap; const CircleWeapon({ - Key key, - @required this.image, + Key? key, + required this.image, this.radius = 30, this.forDrag = false, this.onTap, @@ -25,7 +25,7 @@ class CircleWeapon extends StatelessWidget { image: image, radius: radius, forDrag: forDrag, - onTap: (img) => onTap != null ? onTap(img) : _gotoWeaponPage(context), + onTap: (img) => onTap != null ? onTap!(img) : _gotoWeaponPage(context), ); } diff --git a/lib/presentation/shared/comingsoon_new_avatar.dart b/lib/presentation/shared/comingsoon_new_avatar.dart index c76bfb93f..1c2a00d18 100644 --- a/lib/presentation/shared/comingsoon_new_avatar.dart +++ b/lib/presentation/shared/comingsoon_new_avatar.dart @@ -6,9 +6,9 @@ class ComingSoonNewAvatar extends StatelessWidget { final bool isComingSoon; const ComingSoonNewAvatar({ - Key key, - @required this.isNew, - @required this.isComingSoon, + Key? key, + required this.isNew, + required this.isComingSoon, }) : super(key: key); @override diff --git a/lib/presentation/shared/common_bottom_sheet.dart b/lib/presentation/shared/common_bottom_sheet.dart index 591de69be..bb4989f74 100644 --- a/lib/presentation/shared/common_bottom_sheet.dart +++ b/lib/presentation/shared/common_bottom_sheet.dart @@ -9,19 +9,19 @@ class CommonBottomSheet extends StatelessWidget { final String title; final IconData titleIcon; final Widget child; - final Function onOk; - final Function onCancel; + final Function? onOk; + final Function? onCancel; final double iconSize; final bool showOkButton; final bool showCancelButton; const CommonBottomSheet({ - Key key, - @required this.title, - @required this.titleIcon, + Key? key, + required this.title, + required this.titleIcon, this.onOk, this.onCancel, - @required this.child, + required this.child, this.iconSize = 25, this.showOkButton = true, this.showCancelButton = true, diff --git a/lib/presentation/shared/common_bottom_sheet_buttons.dart b/lib/presentation/shared/common_bottom_sheet_buttons.dart index 2a65a6f7d..3787f0445 100644 --- a/lib/presentation/shared/common_bottom_sheet_buttons.dart +++ b/lib/presentation/shared/common_bottom_sheet_buttons.dart @@ -4,14 +4,14 @@ import 'package:genshindb/generated/l10n.dart'; class CommonButtonSheetButtons extends StatelessWidget { final bool showCancelButton; final bool showOkButton; - final Function onOk; - final Function onCancel; + final Function? onOk; + final Function? onCancel; - final String cancelText; - final String okText; + final String? cancelText; + final String? okText; const CommonButtonSheetButtons({ - Key key, + Key? key, this.showCancelButton = true, this.showOkButton = true, this.onOk, @@ -32,14 +32,13 @@ class CommonButtonSheetButtons extends StatelessWidget { buttonPadding: const EdgeInsets.symmetric(horizontal: 10), children: [ if (showCancelButton) - OutlineButton( - onPressed: () => onCancel != null ? onCancel() : Navigator.pop(context), + OutlinedButton( + onPressed: () => onCancel != null ? onCancel!() : Navigator.pop(context), child: Text(cancel, style: TextStyle(color: theme.primaryColor)), ), if (showOkButton) - RaisedButton( - color: theme.primaryColor, - onPressed: onOk != null ? () => onOk() : null, + ElevatedButton( + onPressed: onOk != null ? () => onOk!() : null, child: Text(ok), ) ], diff --git a/lib/presentation/shared/common_table_cell.dart b/lib/presentation/shared/common_table_cell.dart index a12aa5117..d49f914db 100644 --- a/lib/presentation/shared/common_table_cell.dart +++ b/lib/presentation/shared/common_table_cell.dart @@ -4,22 +4,22 @@ import 'package:genshindb/presentation/shared/styles.dart'; class CommonTableCell extends StatelessWidget { final EdgeInsets padding; - final String text; - final TextAlign textAlign; + final String? text; + final TextAlign? textAlign; - final Widget child; + final Widget? child; const CommonTableCell({ - Key key, - @required this.text, + 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, + Key? key, + required this.child, this.padding = Styles.edgeInsetVertical5, }) : text = null, textAlign = null, @@ -30,15 +30,15 @@ class CommonTableCell extends StatelessWidget { return TableCell( verticalAlignment: TableCellVerticalAlignment.middle, child: text.isNullEmptyOrWhitespace - ? child + ? child! : Center( child: Padding( padding: padding, child: Center( child: Tooltip( - message: text, + message: text!, child: Text( - text, + text!, textAlign: textAlign, ), ), diff --git a/lib/presentation/shared/dropdown_button_with_title.dart b/lib/presentation/shared/dropdown_button_with_title.dart index 2281b40b1..9cbdd8d65 100644 --- a/lib/presentation/shared/dropdown_button_with_title.dart +++ b/lib/presentation/shared/dropdown_button_with_title.dart @@ -6,16 +6,16 @@ class DropdownButtonWithTitle extends StatelessWidget { final T currentValue; final bool isExpanded; final Iterable items; - final void Function(T) onChanged; + final void Function(T)? onChanged; final Widget Function(T, int) itemBuilder; final EdgeInsets margin; const DropdownButtonWithTitle({ - Key key, - @required this.title, - @required this.currentValue, - @required this.items, - @required this.itemBuilder, + Key? key, + required this.title, + required this.currentValue, + required this.items, + required this.itemBuilder, this.onChanged, this.isExpanded = true, this.margin = const EdgeInsets.only(bottom: 15, top: 10), @@ -38,7 +38,7 @@ class DropdownButtonWithTitle extends StatelessWidget { isExpanded: isExpanded, hint: Text(title), value: currentValue, - onChanged: onChanged != null ? (v) => onChanged(v) : null, + onChanged: onChanged != null ? (v) => onChanged!(v!) : null, items: items.mapIndex((item, index) => DropdownMenuItem(value: item, child: itemBuilder(item, index))).toList(), ), ], diff --git a/lib/presentation/shared/element_image.dart b/lib/presentation/shared/element_image.dart index c78083110..d862dc802 100644 --- a/lib/presentation/shared/element_image.dart +++ b/lib/presentation/shared/element_image.dart @@ -11,16 +11,16 @@ class ElementImage extends StatelessWidget { final double radius; ElementImage.fromType({ - Key key, - @required this.type, + Key? key, + required this.type, this.useDarkForBackgroundColor = false, this.radius = 25, }) : path = type.getElementAsssetPath(), super(key: key); ElementImage.fromPath({ - Key key, - @required this.path, + Key? key, + required this.path, this.useDarkForBackgroundColor = false, this.radius = 25, }) : type = Assets.getElementTypeFromPath(path), diff --git a/lib/presentation/shared/elements_button_bar.dart b/lib/presentation/shared/elements_button_bar.dart index 6f112dfc7..befad63b1 100644 --- a/lib/presentation/shared/elements_button_bar.dart +++ b/lib/presentation/shared/elements_button_bar.dart @@ -10,8 +10,8 @@ class ElementsButtonBar extends StatelessWidget { final Function(ElementType) onClick; const ElementsButtonBar({ - Key key, - @required this.onClick, + Key? key, + required this.onClick, this.selectedValues = const [], }) : super(key: key); diff --git a/lib/presentation/shared/extensions/app_theme_type_extensions.dart b/lib/presentation/shared/extensions/app_theme_type_extensions.dart index cb2700ce9..0752420c2 100644 --- a/lib/presentation/shared/extensions/app_theme_type_extensions.dart +++ b/lib/presentation/shared/extensions/app_theme_type_extensions.dart @@ -54,7 +54,6 @@ extension AppThemeTypeExtensions on AppAccentColorType { primaryColorDark: color, primarySwatch: MaterialColor(color.value, getSwatch(color)), ); - break; case AppThemeType.light: return ThemeData( visualDensity: VisualDensity.adaptivePlatformDensity, @@ -65,7 +64,6 @@ extension AppThemeTypeExtensions on AppAccentColorType { primaryColorDark: color, primarySwatch: MaterialColor(color.value, getSwatch(color)), ); - break; default: throw Exception('The provided theme = $theme is not valid '); } diff --git a/lib/presentation/shared/extensions/focus_scope_node_extensions.dart b/lib/presentation/shared/extensions/focus_scope_node_extensions.dart index 16643a16e..a0525985f 100644 --- a/lib/presentation/shared/extensions/focus_scope_node_extensions.dart +++ b/lib/presentation/shared/extensions/focus_scope_node_extensions.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; extension FocusScopeNodeExtensions on FocusScopeNode { void removeFocus() { if (!hasPrimaryFocus && focusedChild != null) { - focusedChild.unfocus(); + focusedChild!.unfocus(); } } } diff --git a/lib/presentation/shared/extensions/i18n_extensions.dart b/lib/presentation/shared/extensions/i18n_extensions.dart index 5bc1d8d29..4b7dc0033 100644 --- a/lib/presentation/shared/extensions/i18n_extensions.dart +++ b/lib/presentation/shared/extensions/i18n_extensions.dart @@ -463,8 +463,9 @@ extension I18nExtensions on S { return custom; case AppNotificationType.dailyCheckIn: return dailyCheckIn; + default: + throw Exception('Invalid app notification type = $type'); } - throw Exception('Invalid app notification type = $type'); } String translateExpeditionTimeType(ExpeditionTimeType type) { diff --git a/lib/presentation/shared/genshin_db_icons.dart b/lib/presentation/shared/genshin_db_icons.dart index 181f6827d..669b8c4fe 100644 --- a/lib/presentation/shared/genshin_db_icons.dart +++ b/lib/presentation/shared/genshin_db_icons.dart @@ -31,7 +31,7 @@ class GenshinDb { GenshinDb._(); static const _kFontFam = 'GenshinDb'; - static const String _kFontPkg = null; + static const String? _kFontPkg = null; static const IconData male = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData female = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); diff --git a/lib/presentation/shared/gradient_card.dart b/lib/presentation/shared/gradient_card.dart index 1843c1e47..36dc4228d 100644 --- a/lib/presentation/shared/gradient_card.dart +++ b/lib/presentation/shared/gradient_card.dart @@ -4,18 +4,18 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; class GradientCard extends StatelessWidget { - final ShapeBorder shape; + final ShapeBorder? shape; final Clip clipBehavior; final EdgeInsetsGeometry margin; final bool semanticContainer; - final Widget child; + final Widget? child; final LinearGradient gradient; - final double elevation; - final Color shadowColor; + final double? elevation; + final Color? shadowColor; const GradientCard({ - Key key, - @required this.gradient, + Key? key, + required this.gradient, this.shape, this.margin = const EdgeInsets.all(4), this.clipBehavior = Clip.none, @@ -38,7 +38,7 @@ class GradientCard extends StatelessWidget { shape: shape ?? const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), clipBehavior: clipBehavior, child: Container( - margin: margin ?? const EdgeInsets.all(4), + margin: margin, decoration: ShapeDecoration( shape: shape ?? const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), gradient: gradient, diff --git a/lib/presentation/shared/hawk_fab_menu.dart b/lib/presentation/shared/hawk_fab_menu.dart index d2cc86e92..c0a626520 100644 --- a/lib/presentation/shared/hawk_fab_menu.dart +++ b/lib/presentation/shared/hawk_fab_menu.dart @@ -7,19 +7,18 @@ class HawkFabMenu extends StatefulWidget { final Widget body; final List items; final double blur; - final AnimatedIconData icon; - final Color fabColor; - final Color iconColor; + final AnimatedIconData? icon; + final Color? fabColor; + final Color? iconColor; + HawkFabMenu({ - @required this.body, - @required this.items, - this.blur: 5.0, + required this.body, + required this.items, + this.blur = 5.0, this.icon, this.fabColor, this.iconColor, - }) { - assert(this.items.isNotEmpty); - } + }) : assert(items.isNotEmpty); @override _HawkFabMenuState createState() => _HawkFabMenuState(); @@ -30,13 +29,13 @@ class _HawkFabMenuState extends State with TickerProviderStateMixin bool _isOpen = false; /// The [Duration] for every animation - Duration _duration = Duration(milliseconds: 500); + final Duration _duration = const Duration(milliseconds: 500); /// Animation controller that animates the menu item - AnimationController _iconAnimationCtrl; + late AnimationController _iconAnimationCtrl; /// Animation that animates the menu item - Animation _iconAnimationTween; + late Animation _iconAnimationTween; @override void initState() { @@ -113,9 +112,7 @@ class _HawkFabMenuState extends State with TickerProviderStateMixin )..forward(), child: Column( crossAxisAlignment: CrossAxisAlignment.end, - children: this - .widget - .items + children: widget.items .map( (item) => _MenuItemWidget( item: item, @@ -174,8 +171,8 @@ class _MenuItemWidget extends StatelessWidget { final Function toggleMenu; const _MenuItemWidget({ - @required this.item, - @required this.toggleMenu, + required this.item, + required this.toggleMenu, }); /// Closes the menu and calls the function for a particular menu item @@ -231,18 +228,18 @@ class HawkFabMenuItem { Function ontap; /// Background color for icon - Color color; + Color? color; /// Text color for label - Color labelColor; + Color? labelColor; /// Background color for label - Color labelBackgroundColor; + Color? labelBackgroundColor; HawkFabMenuItem({ - @required this.label, - @required this.ontap, - @required this.icon, + required this.label, + required this.ontap, + required this.icon, this.color, this.labelBackgroundColor, this.labelColor, diff --git a/lib/presentation/shared/image_widget_placeholder.dart b/lib/presentation/shared/image_widget_placeholder.dart index c45adaf2f..a613a02fe 100644 --- a/lib/presentation/shared/image_widget_placeholder.dart +++ b/lib/presentation/shared/image_widget_placeholder.dart @@ -2,11 +2,11 @@ import 'package:flutter/material.dart'; class ImageWidgetPlaceholder extends StatelessWidget { final ImageProvider image; - final Widget placeholder; + final Widget? placeholder; const ImageWidgetPlaceholder({ - Key key, - this.image, + Key? key, + required this.image, this.placeholder, }) : super(key: key); diff --git a/lib/presentation/shared/increment_button.dart b/lib/presentation/shared/increment_button.dart index 7fd7032c0..20e38265b 100644 --- a/lib/presentation/shared/increment_button.dart +++ b/lib/presentation/shared/increment_button.dart @@ -11,11 +11,11 @@ class IncrementButton extends StatelessWidget { final Function(int) onAdd; const IncrementButton({ - Key key, - @required this.title, - @required this.value, - @required this.onMinus, - @required this.onAdd, + Key? key, + required this.title, + required this.value, + required this.onMinus, + required this.onAdd, this.incrementIsDisabled = false, this.decrementIsDisabled = false, }) : super(key: key); diff --git a/lib/presentation/shared/info_dialog.dart b/lib/presentation/shared/info_dialog.dart index 9f0a3aced..2f12ce634 100644 --- a/lib/presentation/shared/info_dialog.dart +++ b/lib/presentation/shared/info_dialog.dart @@ -6,8 +6,8 @@ class InfoDialog extends StatelessWidget { final List explanations; const InfoDialog({ - Key key, - @required this.explanations, + Key? key, + required this.explanations, }) : super(key: key); @override diff --git a/lib/presentation/shared/item_description.dart b/lib/presentation/shared/item_description.dart index dd2f24912..16d8a9705 100644 --- a/lib/presentation/shared/item_description.dart +++ b/lib/presentation/shared/item_description.dart @@ -1,25 +1,23 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'styles.dart'; class ItemDescription extends StatelessWidget { final String title; - final String subTitle; + final String? subTitle; final bool useColumn; - final Widget widget; + final Widget? widget; const ItemDescription({ - Key key, - @required this.title, + Key? key, + required this.title, this.useColumn = true, this.subTitle, this.widget, }) : super(key: key); const ItemDescription.row({ - Key key, + Key? key, this.widget, }) : title = '', useColumn = false, @@ -38,11 +36,11 @@ class ItemDescription extends StatelessWidget { child: Text( title, overflow: TextOverflow.ellipsis, - style: theme.textTheme.subtitle2.copyWith(color: Colors.white), + style: theme.textTheme.subtitle2!.copyWith(color: Colors.white), ), ), Center( - child: Text(subTitle, style: theme.textTheme.bodyText2.copyWith(fontSize: 12)), + child: Text(subTitle!, style: theme.textTheme.bodyText2!.copyWith(fontSize: 12)), ), ], ), @@ -56,10 +54,10 @@ class ItemDescription extends StatelessWidget { children: [ Text( '$title: ', - style: theme.textTheme.subtitle2.copyWith(color: Colors.white), + style: theme.textTheme.subtitle2!.copyWith(color: Colors.white), overflow: TextOverflow.ellipsis, ), - widget, + widget!, ], ), ); diff --git a/lib/presentation/shared/item_description_card.dart b/lib/presentation/shared/item_description_card.dart index 112b44b54..f62f2f148 100644 --- a/lib/presentation/shared/item_description_card.dart +++ b/lib/presentation/shared/item_description_card.dart @@ -8,8 +8,8 @@ class ItemDescriptionCard extends StatelessWidget { final List widgets; const ItemDescriptionCard({ - Key key, - @required this.description, + Key? key, + required this.description, this.widgets = const [], }) : super(key: key); @@ -32,7 +32,7 @@ class ItemDescriptionCard extends StatelessWidget { contentPadding: EdgeInsets.zero, title: Transform.translate( offset: Styles.listItemWithIconOffset, - child: Text(s.description, style: theme.textTheme.headline6.copyWith(color: Colors.amber)), + child: Text(s.description, style: theme.textTheme.headline6!.copyWith(color: Colors.amber)), ), ), Text(description, style: const TextStyle(fontSize: 12)), diff --git a/lib/presentation/shared/item_description_detail.dart b/lib/presentation/shared/item_description_detail.dart index c47cdc971..fe1780c93 100644 --- a/lib/presentation/shared/item_description_detail.dart +++ b/lib/presentation/shared/item_description_detail.dart @@ -5,14 +5,14 @@ import 'styles.dart'; class ItemDescriptionDetail extends StatelessWidget { final String title; - final Widget body; + final Widget? body; final Color textColor; const ItemDescriptionDetail({ - Key key, - @required this.title, - @required this.body, - @required this.textColor, + Key? key, + required this.title, + this.body, + required this.textColor, }) : super(key: key); @override @@ -37,7 +37,7 @@ class ItemDescriptionDetail extends StatelessWidget { children: [ Text( title, - style: theme.textTheme.headline5.copyWith(color: textColor, fontWeight: FontWeight.bold), + style: theme.textTheme.headline5!.copyWith(color: textColor, fontWeight: FontWeight.bold), overflow: TextOverflow.ellipsis, ), Divider(color: textColor, thickness: 2), @@ -46,7 +46,7 @@ class ItemDescriptionDetail extends StatelessWidget { ), ), ), - if (body != null) body + if (body != null) body! ], ); } diff --git a/lib/presentation/shared/item_expansion_panel.dart b/lib/presentation/shared/item_expansion_panel.dart index e1787016a..0c0d4daf7 100644 --- a/lib/presentation/shared/item_expansion_panel.dart +++ b/lib/presentation/shared/item_expansion_panel.dart @@ -7,12 +7,12 @@ class ItemExpansionPanel extends StatelessWidget { final Widget body; final Icon icon; final bool isCollapsed; - final Function(bool) expansionCallback; + final Function(bool)? expansionCallback; const ItemExpansionPanel({ - Key key, - @required this.title, - @required this.body, + Key? key, + required this.title, + required this.body, this.icon = const Icon(Icons.settings), this.isCollapsed = false, this.expansionCallback, @@ -41,7 +41,7 @@ class ItemExpansionPanel extends StatelessWidget { message: title, child: Text( title, - style: theme.textTheme.headline6.copyWith(color: theme.accentColor), + style: theme.textTheme.headline6!.copyWith(color: theme.accentColor), overflow: TextOverflow.ellipsis, ), ), diff --git a/lib/presentation/shared/item_popupmenu_filter.dart b/lib/presentation/shared/item_popupmenu_filter.dart index 39ae24219..ae3a18ba7 100644 --- a/lib/presentation/shared/item_popupmenu_filter.dart +++ b/lib/presentation/shared/item_popupmenu_filter.dart @@ -14,12 +14,12 @@ class ItemPopupMenuFilter extends StatelessWidget { final PopupMenuItemText itemText; const ItemPopupMenuFilter({ - Key key, - @required this.tooltipText, - @required this.selectedValue, - @required this.values, - @required this.onSelected, - @required this.itemText, + Key? key, + required this.tooltipText, + required this.selectedValue, + required this.values, + required this.onSelected, + required this.itemText, this.exclude = const [], this.icon = const Icon(Icons.filter_list), }) : super(key: key); diff --git a/lib/presentation/shared/item_quantity_dialog.dart b/lib/presentation/shared/item_quantity_dialog.dart index 35989e339..b50807c9e 100644 --- a/lib/presentation/shared/item_quantity_dialog.dart +++ b/lib/presentation/shared/item_quantity_dialog.dart @@ -8,8 +8,8 @@ class ItemQuantityDialog extends StatefulWidget { final int quantityLength; const ItemQuantityDialog({ - Key key, - @required this.quantity, + Key? key, + required this.quantity, this.quantityLength = 10, }) : super(key: key); @@ -18,8 +18,8 @@ class ItemQuantityDialog extends StatefulWidget { } class _ItemQuantityDialogState extends State { - TextEditingController _textEditingController; - String _currentValue; + late TextEditingController _textEditingController; + late String _currentValue; @override void initState() { diff --git a/lib/presentation/shared/material_item_button.dart b/lib/presentation/shared/material_item_button.dart index c25fe991c..87191c6cb 100644 --- a/lib/presentation/shared/material_item_button.dart +++ b/lib/presentation/shared/material_item_button.dart @@ -8,8 +8,8 @@ class MaterialItemButton extends StatelessWidget { final double size; const MaterialItemButton({ - Key key, - @required this.image, + Key? key, + required this.image, this.size = 30, }) : super(key: key); diff --git a/lib/presentation/shared/mixins/app_fab_mixin.dart b/lib/presentation/shared/mixins/app_fab_mixin.dart index 6ad15032a..6a6ec7270 100644 --- a/lib/presentation/shared/mixins/app_fab_mixin.dart +++ b/lib/presentation/shared/mixins/app_fab_mixin.dart @@ -3,8 +3,8 @@ import 'package:genshindb/presentation/shared/app_fab.dart'; import 'package:genshindb/presentation/shared/extensions/scroll_controller_extensions.dart'; mixin AppFabMixin on State, SingleTickerProviderStateMixin { - ScrollController scrollController; - AnimationController hideFabAnimController; + late ScrollController scrollController; + late AnimationController hideFabAnimController; bool isInitiallyVisible = false; bool hideOnTop = true; diff --git a/lib/presentation/shared/nothing_found.dart b/lib/presentation/shared/nothing_found.dart index 8e4c09657..cd55b3ea8 100644 --- a/lib/presentation/shared/nothing_found.dart +++ b/lib/presentation/shared/nothing_found.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:genshindb/generated/l10n.dart'; class NothingFound extends StatelessWidget { - final String msg; + final String? msg; final IconData icon; final EdgeInsets padding; diff --git a/lib/presentation/shared/nothing_found_column.dart b/lib/presentation/shared/nothing_found_column.dart index e9c2cc9a7..9104623e7 100644 --- a/lib/presentation/shared/nothing_found_column.dart +++ b/lib/presentation/shared/nothing_found_column.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'nothing_found.dart'; class NothingFoundColumn extends StatelessWidget { - final String msg; + final String? msg; final IconData icon; final EdgeInsets padding; diff --git a/lib/presentation/shared/number_picker_dialog.dart b/lib/presentation/shared/number_picker_dialog.dart index 875e490ee..d0691ab7d 100644 --- a/lib/presentation/shared/number_picker_dialog.dart +++ b/lib/presentation/shared/number_picker_dialog.dart @@ -9,14 +9,14 @@ class NumberPickerDialog extends StatefulWidget { final int maxItemLevel; final int value; final String title; - final ItemBuilder itemBuilder; + final ItemBuilder? itemBuilder; const NumberPickerDialog({ - Key key, - @required this.minItemLevel, - @required this.maxItemLevel, - @required this.value, - @required this.title, + Key? key, + required this.minItemLevel, + required this.maxItemLevel, + required this.value, + required this.title, this.itemBuilder, }) : super(key: key); diff --git a/lib/presentation/shared/page_message.dart b/lib/presentation/shared/page_message.dart index d0088add1..a1fa4a0a1 100644 --- a/lib/presentation/shared/page_message.dart +++ b/lib/presentation/shared/page_message.dart @@ -6,8 +6,8 @@ class PageMessage extends StatelessWidget { final List children; const PageMessage({ - Key key, - @required this.text, + Key? key, + required this.text, this.useScaffold = true, this.children = const [], }) : super(key: key); diff --git a/lib/presentation/shared/rarity.dart b/lib/presentation/shared/rarity.dart index f64ff07df..3649616de 100644 --- a/lib/presentation/shared/rarity.dart +++ b/lib/presentation/shared/rarity.dart @@ -6,8 +6,8 @@ class Rarity extends StatelessWidget { final MainAxisAlignment alignment; const Rarity({ - Key key, - @required this.stars, + Key? key, + required this.stars, this.starSize = 20, this.alignment = MainAxisAlignment.center, }) : super(key: key); diff --git a/lib/presentation/shared/rarity_rating.dart b/lib/presentation/shared/rarity_rating.dart index eb89d412c..7b418bb9a 100644 --- a/lib/presentation/shared/rarity_rating.dart +++ b/lib/presentation/shared/rarity_rating.dart @@ -8,9 +8,9 @@ class RarityRating extends StatelessWidget { final Function(int) onRated; const RarityRating({ - Key key, - @required this.rarity, - @required this.onRated, + Key? key, + required this.rarity, + required this.onRated, this.size = 35.0, this.stars = 5, }) : super(key: key); @@ -22,7 +22,7 @@ class RarityRating extends StatelessWidget { child: SmoothStarRating( rating: rarity.toDouble(), allowHalfRating: false, - onRated: (v) => onRated(v.toInt()), + onRated: (v) => onRated(v!.toInt()), size: size, color: Colors.yellow, starCount: stars, diff --git a/lib/presentation/shared/scaffold_with_fab.dart b/lib/presentation/shared/scaffold_with_fab.dart index 2035ce75c..3d80478b0 100644 --- a/lib/presentation/shared/scaffold_with_fab.dart +++ b/lib/presentation/shared/scaffold_with_fab.dart @@ -5,11 +5,11 @@ import 'mixins/app_fab_mixin.dart'; class ScaffoldWithFab extends StatefulWidget { final Widget child; - final PreferredSizeWidget appbar; + final PreferredSizeWidget? appbar; const ScaffoldWithFab({ - Key key, - @required this.child, + Key? key, + required this.child, this.appbar, }) : super(key: key); diff --git a/lib/presentation/shared/search_box.dart b/lib/presentation/shared/search_box.dart index 4186070e3..e7c9a1eaa 100644 --- a/lib/presentation/shared/search_box.dart +++ b/lib/presentation/shared/search_box.dart @@ -4,14 +4,14 @@ import 'package:genshindb/generated/l10n.dart'; typedef SearchChanged = void Function(String val); class SearchBox extends StatefulWidget { - final String value; + final String? value; final bool showClearButton; final SearchChanged searchChanged; const SearchBox({ - Key key, - @required this.value, - @required this.searchChanged, + Key? key, + this.value, + required this.searchChanged, this.showClearButton = true, }) : super(key: key); @@ -21,7 +21,7 @@ class SearchBox extends StatefulWidget { class _SearchBoxState extends State { final _searchFocusNode = FocusNode(); - TextEditingController _searchBoxTextController; + late TextEditingController _searchBoxTextController; @override void initState() { diff --git a/lib/presentation/shared/sliver_nothing_found.dart b/lib/presentation/shared/sliver_nothing_found.dart index a8b7eb7ed..ae22fedfb 100644 --- a/lib/presentation/shared/sliver_nothing_found.dart +++ b/lib/presentation/shared/sliver_nothing_found.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'nothing_found_column.dart'; class SliverNothingFound extends StatelessWidget { - final String msg; + final String? msg; final IconData icon; final EdgeInsets padding; diff --git a/lib/presentation/shared/sliver_page_filter.dart b/lib/presentation/shared/sliver_page_filter.dart index 0bbaadb47..6eebf7fb4 100644 --- a/lib/presentation/shared/sliver_page_filter.dart +++ b/lib/presentation/shared/sliver_page_filter.dart @@ -7,21 +7,21 @@ typedef OnPressed = void Function(); class SliverPageFilter extends StatelessWidget { final String title; - final String search; + final String? search; final OnPressed onPressed; final Function(String) searchChanged; const SliverPageFilter({ - Key key, - @required this.title, - @required this.search, - @required this.onPressed, - @required this.searchChanged, + Key? key, + required this.title, + this.search, + required this.onPressed, + required this.searchChanged, }) : super(key: key); @override Widget build(BuildContext context) { - final showClearButton = search != null && search.isNotEmpty; + final showClearButton = search != null && search!.isNotEmpty; return SliverToBoxAdapter( child: Column( children: [ diff --git a/lib/presentation/shared/sliver_row_grid.dart b/lib/presentation/shared/sliver_row_grid.dart index ac3d0c7b3..7ea4476de 100644 --- a/lib/presentation/shared/sliver_row_grid.dart +++ b/lib/presentation/shared/sliver_row_grid.dart @@ -8,9 +8,9 @@ class SliverRowGrid extends StatelessWidget { final Widget Function(int) builder; const SliverRowGrid({ - Key key, - @required this.itemsCount, - @required this.builder, + Key? key, + required this.itemsCount, + required this.builder, this.crossAxisCount = 2, this.crossAxisSpacing = 5, }) : super(key: key); diff --git a/lib/presentation/shared/sliver_scaffold_with_fab.dart b/lib/presentation/shared/sliver_scaffold_with_fab.dart index d04c281b4..fff7b25e7 100644 --- a/lib/presentation/shared/sliver_scaffold_with_fab.dart +++ b/lib/presentation/shared/sliver_scaffold_with_fab.dart @@ -5,11 +5,11 @@ import 'mixins/app_fab_mixin.dart'; class SliverScaffoldWithFab extends StatefulWidget { final List slivers; - final PreferredSizeWidget appbar; + final PreferredSizeWidget? appbar; const SliverScaffoldWithFab({ - Key key, - @required this.slivers, + Key? key, + required this.slivers, this.appbar, }) : super(key: key); diff --git a/lib/presentation/shared/smooth_star_rating.dart b/lib/presentation/shared/smooth_star_rating.dart index a5cdc9d11..90fd79a2b 100644 --- a/lib/presentation/shared/smooth_star_rating.dart +++ b/lib/presentation/shared/smooth_star_rating.dart @@ -3,14 +3,14 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -typedef RatingChangeCallback = void Function(double rating); +typedef RatingChangeCallback = void Function(double? rating); class SmoothStarRating extends StatefulWidget { final int starCount; final double rating; - final RatingChangeCallback onRated; - final Color color; - final Color borderColor; + final RatingChangeCallback? onRated; + final Color? color; + final Color? borderColor; final double size; final bool allowHalfRating; final IconData filledIconData; @@ -45,8 +45,8 @@ class _SmoothStarRatingState extends State { //tracks for user tapping on this widget bool isWidgetTapped = false; - double currentRating; - Timer debounceTimer; + double? currentRating; + Timer? debounceTimer; @override void initState() { @@ -72,13 +72,13 @@ class _SmoothStarRatingState extends State { Widget buildStar(BuildContext context, int index) { Icon icon; - if (index >= currentRating) { + if (index >= currentRating!) { icon = Icon( widget.defaultIconData, color: widget.borderColor ?? Theme.of(context).primaryColor, size: widget.size, ); - } else if (index > currentRating - (widget.allowHalfRating ? halfStarThreshold : 1.0) && index < currentRating) { + } else if (index > currentRating! - (widget.allowHalfRating ? halfStarThreshold : 1.0) && index < currentRating!) { icon = Icon( widget.halfFilledIconData, color: widget.color ?? Theme.of(context).primaryColor, @@ -107,7 +107,7 @@ class _SmoothStarRatingState extends State { isWidgetTapped = false; //reset }, onHover: (event) { - RenderBox box = context.findRenderObject() as RenderBox; + final box = context.findRenderObject() as RenderBox; var _pos = box.globalToLocal(event.position); var i = _pos.dx / widget.size; var newRating = widget.allowHalfRating ? i : i.round().toDouble(); @@ -139,7 +139,7 @@ class _SmoothStarRatingState extends State { currentRating = newRating; }); if (widget.onRated != null) { - widget.onRated(normalizeRating(currentRating)); + widget.onRated!(normalizeRating(currentRating!)); } }, onHorizontalDragUpdate: (dragDetails) { @@ -162,7 +162,7 @@ class _SmoothStarRatingState extends State { debounceTimer = Timer(Duration(milliseconds: 100), () { if (widget.onRated != null) { currentRating = normalizeRating(newRating); - widget.onRated(currentRating); + widget.onRated!(currentRating); } }); }, @@ -187,7 +187,7 @@ class _SmoothStarRatingState extends State { }); }, onTapUp: (e) { - if (widget.onRated != null) widget.onRated(currentRating); + if (widget.onRated != null) widget.onRated!(currentRating); }, onHorizontalDragUpdate: (dragDetails) { RenderBox box = context.findRenderObject() as RenderBox; @@ -207,7 +207,7 @@ class _SmoothStarRatingState extends State { debounceTimer = Timer(Duration(milliseconds: 100), () { if (widget.onRated != null) { currentRating = normalizeRating(newRating); - widget.onRated(currentRating); + widget.onRated!(currentRating); } }); }, diff --git a/lib/presentation/shared/sort_direction_popupmenu_filter.dart b/lib/presentation/shared/sort_direction_popupmenu_filter.dart index b26b4aafa..59cc0fb58 100644 --- a/lib/presentation/shared/sort_direction_popupmenu_filter.dart +++ b/lib/presentation/shared/sort_direction_popupmenu_filter.dart @@ -10,9 +10,9 @@ class SortDirectionPopupMenuFilter extends StatelessWidget { final Function(SortDirectionType) onSelected; const SortDirectionPopupMenuFilter({ - Key key, - @required this.selectedSortDirection, - @required this.onSelected, + Key? key, + required this.selectedSortDirection, + required this.onSelected, }) : super(key: key); @override diff --git a/lib/presentation/shared/text_link.dart b/lib/presentation/shared/text_link.dart index 5f5180d6c..6882c2998 100644 --- a/lib/presentation/shared/text_link.dart +++ b/lib/presentation/shared/text_link.dart @@ -7,9 +7,9 @@ class TextLink extends StatelessWidget { final String url; const TextLink({ - Key key, - @required this.text, - @required this.url, + Key? key, + required this.text, + required this.url, }) : super(key: key); @override diff --git a/lib/presentation/shared/utils/toast_utils.dart b/lib/presentation/shared/utils/toast_utils.dart index 85494cef6..49061f559 100644 --- a/lib/presentation/shared/utils/toast_utils.dart +++ b/lib/presentation/shared/utils/toast_utils.dart @@ -62,7 +62,7 @@ class ToastUtils { ); } - static Widget _buildToast(String msg, Color textColor, Color bgColor, Icon icon, BuildContext context) { + static Widget _buildToast(String msg, Color textColor, Color bgColor, Icon icon, BuildContext? context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0), decoration: BoxDecoration( diff --git a/lib/presentation/shared/weapons_button_bar.dart b/lib/presentation/shared/weapons_button_bar.dart index 2cfbe83a5..802123a25 100644 --- a/lib/presentation/shared/weapons_button_bar.dart +++ b/lib/presentation/shared/weapons_button_bar.dart @@ -10,8 +10,8 @@ class WeaponsButtonBar extends StatelessWidget { final Function(WeaponType) onClick; const WeaponsButtonBar({ - Key key, - @required this.onClick, + Key? key, + required this.onClick, this.selectedValues = const [], }) : super(key: key); diff --git a/lib/presentation/shared/wrapped_ascension_material.dart b/lib/presentation/shared/wrapped_ascension_material.dart index 39426c52c..cb82006d8 100644 --- a/lib/presentation/shared/wrapped_ascension_material.dart +++ b/lib/presentation/shared/wrapped_ascension_material.dart @@ -8,9 +8,9 @@ class WrappedAscensionMaterial extends StatelessWidget { final double size; const WrappedAscensionMaterial({ - Key key, - @required this.image, - @required this.quantity, + Key? key, + required this.image, + required this.quantity, this.size = 30, }) : super(key: key); diff --git a/lib/presentation/tierlist/tier_list_page.dart b/lib/presentation/tierlist/tier_list_page.dart index 7399beb9f..bcf38a80f 100644 --- a/lib/presentation/tierlist/tier_list_page.dart +++ b/lib/presentation/tierlist/tier_list_page.dart @@ -119,7 +119,7 @@ class _TierListPageState extends State { } final bytes = await screenshotController.capture(pixelRatio: 1.5); - await ImageGallerySaver.saveImage(bytes, quality: 100); + await ImageGallerySaver.saveImage(bytes!, quality: 100); ToastUtils.showSucceedToast(fToast, s.imgSavedSuccessfully); bloc.add(const TierListEvent.screenshotTaken(succeed: true)); } catch (e, trace) { diff --git a/lib/presentation/tierlist/widgets/rename_tierlist_dialog.dart b/lib/presentation/tierlist/widgets/rename_tierlist_dialog.dart index bd829b6ac..1595ac2b6 100644 --- a/lib/presentation/tierlist/widgets/rename_tierlist_dialog.dart +++ b/lib/presentation/tierlist/widgets/rename_tierlist_dialog.dart @@ -8,9 +8,9 @@ class RenameTierListRowDialog extends StatefulWidget { final String title; const RenameTierListRowDialog({ - Key key, - @required this.index, - @required this.title, + Key? key, + required this.index, + required this.title, }) : super(key: key); @override @@ -18,8 +18,8 @@ class RenameTierListRowDialog extends StatefulWidget { } class _RenameTierListRowDialogState extends State { - TextEditingController _textController; - String _currentValue; + late TextEditingController _textController; + late String _currentValue; @override void initState() { diff --git a/lib/presentation/tierlist/widgets/tierlist_row.dart b/lib/presentation/tierlist/widgets/tierlist_row.dart index b13b6517d..7f6b2f3b5 100644 --- a/lib/presentation/tierlist/widgets/tierlist_row.dart +++ b/lib/presentation/tierlist/widgets/tierlist_row.dart @@ -28,13 +28,13 @@ class TierListRow extends StatelessWidget { final bool isTheLastRow; const TierListRow({ - Key key, - @required this.index, - @required this.title, - @required this.color, - @required this.images, - @required this.numberOfRows, - @required this.isTheLastRow, + Key? key, + required this.index, + required this.title, + required this.color, + required this.images, + required this.numberOfRows, + required this.isTheLastRow, this.showButtons = true, this.isUpButtonEnabled = true, this.isDownButtonEnabled = true, @@ -44,7 +44,7 @@ class TierListRow extends StatelessWidget { Widget build(BuildContext context) { final s = S.of(context); return DragTarget( - builder: (BuildContext context, List incoming, List rejected) => Column( + builder: (BuildContext context, List incoming, List rejected) => Column( children: [ IntrinsicHeight( child: Row( diff --git a/lib/presentation/tierlist/widgets/tierlist_row_color_picker.dart b/lib/presentation/tierlist/widgets/tierlist_row_color_picker.dart index dd6cd602a..db526e956 100644 --- a/lib/presentation/tierlist/widgets/tierlist_row_color_picker.dart +++ b/lib/presentation/tierlist/widgets/tierlist_row_color_picker.dart @@ -6,8 +6,8 @@ class TierListRowColorPicker extends StatefulWidget { final Color currentColor; const TierListRowColorPicker({ - Key key, - @required this.currentColor, + Key? key, + required this.currentColor, }) : super(key: key); @override @@ -15,7 +15,7 @@ class TierListRowColorPicker extends StatefulWidget { } class _TierListRowColorPickerState extends State { - Color selectedColor; + Color? selectedColor; @override Widget build(BuildContext context) { @@ -32,16 +32,15 @@ class _TierListRowColorPickerState extends State { }, ), actions: [ - OutlineButton( + OutlinedButton( onPressed: () => Navigator.of(context).pop(widget.currentColor), child: Text( s.cancel, style: TextStyle(color: theme.primaryColor), ), ), - RaisedButton( + ElevatedButton( onPressed: () => Navigator.of(context).pop(selectedColor ?? widget.currentColor), - color: theme.accentColor, child: Text(s.ok), ), ], diff --git a/lib/presentation/today_materials/today_materials_page.dart b/lib/presentation/today_materials/today_materials_page.dart index 2fb62ce82..bca8754e8 100644 --- a/lib/presentation/today_materials/today_materials_page.dart +++ b/lib/presentation/today_materials/today_materials_page.dart @@ -26,7 +26,7 @@ class TodayMaterialsPage extends StatelessWidget { sliver: SliverToBoxAdapter( child: Text( s.forCharacters, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), ), @@ -36,7 +36,7 @@ class TodayMaterialsPage extends StatelessWidget { sliver: SliverToBoxAdapter( child: Text( s.forWeapons, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), ), ), ), diff --git a/lib/presentation/today_materials/widgets/sliver_character_ascension_materials.dart b/lib/presentation/today_materials/widgets/sliver_character_ascension_materials.dart index 7f6ae2268..27bf83b73 100644 --- a/lib/presentation/today_materials/widgets/sliver_character_ascension_materials.dart +++ b/lib/presentation/today_materials/widgets/sliver_character_ascension_materials.dart @@ -6,8 +6,8 @@ class SliverCharacterAscensionMaterials extends StatelessWidget { final List charAscMaterials; const SliverCharacterAscensionMaterials({ - Key key, - @required this.charAscMaterials, + Key? key, + required this.charAscMaterials, }) : super(key: key); @override diff --git a/lib/presentation/today_materials/widgets/sliver_weapon_ascension_materials.dart b/lib/presentation/today_materials/widgets/sliver_weapon_ascension_materials.dart index bac6da94a..8ce96ea10 100644 --- a/lib/presentation/today_materials/widgets/sliver_weapon_ascension_materials.dart +++ b/lib/presentation/today_materials/widgets/sliver_weapon_ascension_materials.dart @@ -7,8 +7,8 @@ class SliverWeaponAscensionMaterials extends StatelessWidget { final List weaponAscMaterials; const SliverWeaponAscensionMaterials({ - Key key, - @required this.weaponAscMaterials, + Key? key, + required this.weaponAscMaterials, }) : super(key: key); @override diff --git a/lib/presentation/weapon/widgets/weapon_detail_ascension_materials_card.dart b/lib/presentation/weapon/widgets/weapon_detail_ascension_materials_card.dart index b8af08cc6..71d893230 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_ascension_materials_card.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_ascension_materials_card.dart @@ -10,9 +10,9 @@ class WeaponDetailAscensionMaterialsCard extends StatelessWidget { final List ascensionMaterials; const WeaponDetailAscensionMaterialsCard({ - Key key, - @required this.rarityColor, - @required this.ascensionMaterials, + Key? key, + required this.rarityColor, + required this.ascensionMaterials, }) : super(key: key); @override diff --git a/lib/presentation/weapon/widgets/weapon_detail_bottom.dart b/lib/presentation/weapon/widgets/weapon_detail_bottom.dart index 35525c1e5..5e537153c 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_bottom.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_bottom.dart @@ -23,15 +23,15 @@ class WeaponDetailBottom extends StatelessWidget { final List charImgs; const WeaponDetailBottom({ - Key key, - @required this.description, - @required this.rarity, - @required this.secondaryStatType, - @required this.craftingMaterials, - @required this.ascensionMaterials, - @required this.refinements, - @required this.stats, - @required this.charImgs, + Key? key, + required this.description, + required this.rarity, + required this.secondaryStatType, + required this.craftingMaterials, + required this.ascensionMaterials, + required this.refinements, + required this.stats, + required this.charImgs, }) : super(key: key); @override diff --git a/lib/presentation/weapon/widgets/weapon_detail_crafting_materials.dart b/lib/presentation/weapon/widgets/weapon_detail_crafting_materials.dart index 7e63859ce..17c8d13ae 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_crafting_materials.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_crafting_materials.dart @@ -9,9 +9,9 @@ class WeaponCraftingMaterials extends StatelessWidget { final Color rarityColor; const WeaponCraftingMaterials({ - Key key, - @required this.materials, - @required this.rarityColor, + Key? key, + required this.materials, + required this.rarityColor, }) : super(key: key); @override diff --git a/lib/presentation/weapon/widgets/weapon_detail_general_card.dart b/lib/presentation/weapon/widgets/weapon_detail_general_card.dart index 7606e8616..c8208318f 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_general_card.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_general_card.dart @@ -17,14 +17,14 @@ class WeaponDetailGeneralCard extends StatelessWidget { 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, + 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 @@ -36,7 +36,7 @@ class WeaponDetailGeneralCard extends StatelessWidget { children: [ Text( name, - style: theme.textTheme.headline5.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.headline5!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ), Rarity(stars: rarity, starSize: 25, alignment: MainAxisAlignment.start), ItemDescription( diff --git a/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart b/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart index 30ce3623e..7d5e364d0 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_refinements_card.dart @@ -10,9 +10,9 @@ class WeaponDetailRefinementsCard extends StatelessWidget { final List refinements; const WeaponDetailRefinementsCard({ - Key key, - @required this.rarityColor, - @required this.refinements, + Key? key, + required this.rarityColor, + required this.refinements, }) : super(key: key); @override diff --git a/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart b/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart index 0f2fbbb9b..5c0ceded4 100644 --- a/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart +++ b/lib/presentation/weapon/widgets/weapon_detail_stats_card.dart @@ -13,10 +13,10 @@ class WeaponDetailStatsCard extends StatelessWidget { final List stats; const WeaponDetailStatsCard({ - Key key, - @required this.secondaryStatType, - @required this.rarityColor, - @required this.stats, + Key? key, + required this.secondaryStatType, + required this.rarityColor, + required this.stats, }) : super(key: key); @override diff --git a/lib/presentation/weapon/widgets/weapon_detaill_top.dart b/lib/presentation/weapon/widgets/weapon_detaill_top.dart index bef5bf5db..93e29488e 100644 --- a/lib/presentation/weapon/widgets/weapon_detaill_top.dart +++ b/lib/presentation/weapon/widgets/weapon_detaill_top.dart @@ -21,15 +21,15 @@ class WeaponDetailTop extends StatelessWidget { 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, + 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 diff --git a/lib/presentation/weapons/weapons_page.dart b/lib/presentation/weapons/weapons_page.dart index 7ea496bae..79c7bdefa 100644 --- a/lib/presentation/weapons/weapons_page.dart +++ b/lib/presentation/weapons/weapons_page.dart @@ -16,7 +16,7 @@ import 'widgets/weapon_card.dart'; class WeaponsPage extends StatefulWidget { final bool isInSelectionMode; - static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { + static Future forSelection(BuildContext context, {List excludeKeys = const []}) async { final bloc = context.read(); bloc.add(WeaponsEvent.init(excludeKeys: excludeKeys)); @@ -30,7 +30,7 @@ class WeaponsPage extends StatefulWidget { } const WeaponsPage({ - Key key, + Key? key, this.isInSelectionMode = false, }) : super(key: key); diff --git a/lib/presentation/weapons/widgets/weapon_card.dart b/lib/presentation/weapons/widgets/weapon_card.dart index 5ff2bdb0f..1e599c85f 100644 --- a/lib/presentation/weapons/widgets/weapon_card.dart +++ b/lib/presentation/weapons/widgets/weapon_card.dart @@ -21,10 +21,10 @@ class WeaponCard extends StatelessWidget { final String image; final String name; final int rarity; - final int baseAtk; - final WeaponType type; - final StatType subStatType; - final double subStatValue; + final int? baseAtk; + final WeaponType? type; + final StatType? subStatType; + final double? subStatValue; final bool isComingSoon; final double imgWidth; @@ -34,16 +34,16 @@ class WeaponCard extends StatelessWidget { final bool withElevation; const WeaponCard({ - Key key, - @required this.keyName, - @required this.image, - @required this.name, - @required this.rarity, - @required this.baseAtk, - @required this.type, - @required this.subStatType, - @required this.subStatValue, - @required this.isComingSoon, + Key? key, + required this.keyName, + required this.image, + required this.name, + required this.rarity, + required this.baseAtk, + required this.type, + required this.subStatType, + required this.subStatValue, + required this.isComingSoon, this.imgWidth = 160, this.imgHeight = 140, this.isInSelectionMode = false, @@ -52,12 +52,12 @@ class WeaponCard extends StatelessWidget { super(key: key); const WeaponCard.withoutDetails({ - Key key, - @required this.keyName, - @required this.image, - @required this.name, - @required this.rarity, - @required this.isComingSoon, + Key? key, + required this.keyName, + required this.image, + required this.name, + required this.rarity, + required this.isComingSoon, this.imgWidth = 80, this.imgHeight = 70, }) : type = null, @@ -70,8 +70,8 @@ class WeaponCard extends StatelessWidget { super(key: key); WeaponCard.item({ - Key key, - WeaponCardModel weapon, + Key? key, + required WeaponCardModel weapon, this.imgWidth = 160, this.imgHeight = 140, this.isInSelectionMode = false, @@ -132,7 +132,7 @@ class WeaponCard extends StatelessWidget { child: Text( name, overflow: TextOverflow.ellipsis, - style: theme.textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold, color: Colors.white), + style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ), ), ), @@ -157,13 +157,13 @@ class WeaponCard extends StatelessWidget { style: const TextStyle(color: Colors.white), ), Text( - '${s.type}: ${s.translateWeaponType(type)}', + '${s.type}: ${s.translateWeaponType(type!)}', textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, style: const TextStyle(color: Colors.white), ), Text( - '${s.subStat}: ${s.translateStatType(subStatType, subStatValue)}', + '${s.subStat}: ${s.translateStatType(subStatType!, subStatValue!)}', textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, style: const TextStyle(color: Colors.white),