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
- IDEA intellij or Visual Studio Code with the Dart/Flutter Plugins
- The Dart SDK and the Flutter SDK
- A fair understanding of Mobile development and Imperative or Object Oriented Programming
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
- Dart Flutter Cross Platform Chat Application Tutorial
- Building a Multi-Page Application with Dart's Flutter Mobile Framework
- Making Http requests and Using Json in Dart's Flutter Framework
- Building Dynamic Lists with Streams in Dart's Flutter Framework
- Using GridView, Tabs, and Steppers in Dart's Flutter Framework
- Using Global Keys to get State and Validate Input in Dart's Flutter Framework
- The Basics of Animation with Dart's Flutter Framework
- Advanced Physics Based Animations in Dart's Flutter Framework
- Building a Drag and Drop Application with Dart's Flutter Framework
- Building a Hero Animation and an Application Drawer in Dart's Flutter Framework
- Building a Temperature Conversion Application using Dart's Flutter Framework
- Using Inherited Widgets and Gesture Detectors in Dart's Flutter Framework
- Using Gradients, Fractional Offsets, Page Views and Other Widgets in Dart's Flutter Framework
- Building a Calculator Layout using Dart's Flutter Framework
- Finishing our Calculator Application with Dart's Flutter Framework
- Making use of Shared Preferences, Flex Widgets and Dismissibles with Dart's Flutter framework
- Using the Different Style Widgets and Properties in Dart's Flutter Framework
- Composing Animations and Chaining Animations in Dart's Flutter Framework
- Building a Countdown Timer with a Custom Painter and Animations in Dart's Flutter Framework
- Reading and Writing Data and Files with Path Provider using Dart's Flutter Framework
- Exploring Webviews and the Url Launcher Plugin in Dart's Flutter Framework
- Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 1)
- Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 2)
- Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 3, Final)
- Adding a Real-time Database to a Flutter application with Firebase
- Building a List in Redux with Dart's Flutter Framework
- Managing State with the Scoped Model Pattern in Dart's Flutter Framework
Posted on Utopian.io - Rewarding Open Source Contributors