Building a Mine Sweeper Game using Dart's Flutter Framework (Part 1)

in #utopian-io6 years ago (edited)

What Will I Learn?

  • You will learn how to programmatically generate a two dimensional list of items with Dart
  • You will learn how to use a abstract two dimensional list to generate a game board
  • You will learn how to make use of Dart Enums in Flutter

Requirements

Difficulty

  • Intermediate

Description

In this first tutorial, we build out the basic user interface for a minesweeper game using Flutter. First, we define the basic perimeters and rules of the game, minesweeper. We then use an Enum type to model the state of each of the tiles on our board. We use this state to build out a two dimensional list of this Enum. This two dimensional list allows us to programmatically generate the widgets required to create the board for our application.

Our Board is made up of nine rows, each filled with nine gesture detector widgets. Each of these tiles also contains a listener widget and a container. The container has the visual properties of the tile. These tiles are then pushed into each row which is then pushed into a single column widget. The column widget is then constrained by a container widget which allows us to pass back our board of eighty-one widgets as a single widget. This board is then embedded into our stateful widget which lets us see the visual outcome of the application.

The source code for this project can be found here

The freeware minesweeper game that we keep referring too can be found here

Video Tutorial

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for your excellent contribution, @tensor. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thanks again for moderating my content.

Hey @buckydurddle, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Hey @tensor I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 64118.79
ETH 3390.14
USDT 1.00
SBD 2.51