Skip to content

Commit

Permalink
Adding cards
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo committed Aug 31, 2020
1 parent 0e4c11c commit 1277a0e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
Binary file added art/ui.aseprite
Binary file not shown.
Binary file added art/ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/atlases/ui.fa
Binary file not shown.
2 changes: 2 additions & 0 deletions lib/assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import 'package:flame_fire_atlas/flame_fire_atlas.dart';
class Assets {
static FireAtlas fishes;
static FireAtlas background;
static FireAtlas ui;

static Future<void> load() async {
fishes = await FireAtlas.fromAsset('atlases/fishes.fa');
background = await FireAtlas.fromAsset('atlases/background.fa');
ui = await FireAtlas.fromAsset('atlases/ui.fa');
}
}
12 changes: 10 additions & 2 deletions lib/components/card_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import 'package:dextraquario/fish_info.dart';
import 'package:dextraquario/widgets/custom_link.dart';
import 'package:flutter/material.dart';

import 'package:flame/widgets/sprite_widget.dart';

import '../assets.dart';

class CardItem extends StatelessWidget {
final FishItem fishItem;

Expand All @@ -12,11 +16,15 @@ class CardItem extends StatelessWidget {
return Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 30),
color: Colors.blue,
width: 250,
height: 250,
child: SpriteWidget(
sprite: Assets.ui.getSprite(
fishItem.name.toString().replaceAll('ItemType.', ''),
),
),
),
SizedBox(height: 20),
Text(
fishItem.getItemDescription(),
style: TextStyle(
Expand Down
11 changes: 10 additions & 1 deletion lib/overlays/fish_overlay.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'package:dextraquario/components/carousel_items.dart';
import 'package:dextraquario/fish_info.dart';
import 'package:flutter/material.dart';
import 'package:flame/widgets/sprite_widget.dart';

import '../assets.dart';

class FishOverlay extends StatelessWidget {
final FishInfo fishInfo;
Expand All @@ -25,7 +28,13 @@ class FishOverlay extends StatelessWidget {
children: [
Text(fishInfo.name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24)),
GestureDetector(
child: Image.asset('images/close.png'),
child: Container(
width: 40,
height: 40,
child: SpriteWidget(
sprite: Assets.ui.getSprite('close'),
),
),
onTap: onCloseInfo,
),
],
Expand Down

0 comments on commit 1277a0e

Please sign in to comment.