game/prompt/03_inventory_ui_request.md

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

  1. Navigation (BottomNavigationBar):

    • Create a main wrapper screen to switch between "Battle" and "Inventory".
    • Critical: Use IndexedStack to preserve the state of the BattleScreen (keep the fight running) while viewing the Inventory.
  2. 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)").
  3. Refactoring:

    • Update main.dart to point to the new Main Wrapper Screen.

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 ListView of player.equipment.
  • Item Tile: Card or ListTile showing:
    • Leading: Icon (e.g., Icons.shield or Icons.security).
    • Title: Item Name.
    • Subtitle: Description & Stat Bonuses.
  • 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: IndexedStack with children [BattleScreen(), InventoryScreen()].
    • bottomNavigationBar: BottomNavigationBar with 2 items:
      • Battle (Icons.sports_kabaddi or Icons.flash_on).
      • Inventory (Icons.backpack or Icons.inventory).
    • Theme: Ensure the bottom bar matches the Dark Theme.

3. lib/main.dart (Update)

Description:

  • Change home from BattleScreen to MainWrapper.

Output Format

Please provide the complete code for the 3 files above.