2.0 KiB
2.0 KiB
Role
You are a Senior Flutter Developer working on "Colosseum's Choice". The core battle and item system are working perfectly. Your goal is to implement the Inventory UI and Navigation System.
Requirements
-
Navigation (
BottomNavigationBar):- Create a main wrapper screen to switch between "Battle" and "Inventory".
- Critical: Use
IndexedStackto preserve the state of theBattleScreen(keep the fight running) while viewing the Inventory.
-
Inventory Screen:
- Display the Player's detailed Stats (Total ATK, Total HP, Armor, etc.).
- List all collected/equipped items (
player.equipment). - Show each item's name and bonus stats (e.g., "Rusty Sword (+2 ATK)").
-
Refactoring:
- Update
main.dartto point to the new Main Wrapper Screen.
- Update
Required Files
Please generate the code for the following files.
1. lib/screens/inventory_screen.dart (New File)
Description:
- Header: Show Player Name, Stage, Total HP, Total ATK, Current Armor.
- Body: A
ListViewofplayer.equipment. - Item Tile:
CardorListTileshowing:- Leading: Icon (e.g.,
Icons.shieldorIcons.security). - Title: Item Name.
- Subtitle: Description & Stat Bonuses.
- Leading: Icon (e.g.,
- State: Use
Consumer<BattleProvider>to display live data.
2. lib/screens/main_wrapper.dart (New File)
Description:
- Widget:
StatefulWidget. - State: Holds
_currentIndex(0 = Battle, 1 = Inventory). - Build:
- Return a
Scaffold. body:IndexedStackwith children[BattleScreen(), InventoryScreen()].bottomNavigationBar:BottomNavigationBarwith 2 items:- Battle (
Icons.sports_kabaddiorIcons.flash_on). - Inventory (
Icons.backpackorIcons.inventory).
- Battle (
- Theme: Ensure the bottom bar matches the Dark Theme.
- Return a
3. lib/main.dart (Update)
Description:
- Change
homefromBattleScreentoMainWrapper.
Output Format
Please provide the complete code for the 3 files above.