diff --git a/README.md b/README.md index ddeb1ca3..5a35ba8b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,5 @@ -![App Brewery Banner](https://github.com/londonappbrewery/Images/blob/master/AppBreweryBanner.png) - - # Dicee 🎲 -## Our Goal - -The objective of this tutorial is to introduce you to the core programming concepts that will form the foundation of most of the apps you’ll build in the future. This app will teach you how to make apps with functionality using setState() inside Stateful Flutter widgets. - ## What you will create diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 00000000..848c5fb7 --- /dev/null +++ b/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\src\flutter" +export "FLUTTER_APPLICATION_PATH=D:\FLUTTER PROJECTS\dicee-flutter" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/lib/main.dart b/lib/main.dart index 6e68f204..c74c61e4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,6 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'dart:math'; void main() { return runApp( @@ -6,18 +8,55 @@ void main() { home: Scaffold( backgroundColor: Colors.red, appBar: AppBar( - title: Text('Dicee'), + title: Center( + child: Text('Dicee'), + ), backgroundColor: Colors.red, ), body: DicePage(), ), + debugShowCheckedModeBanner: false, ), ); } -class DicePage extends StatelessWidget { +class DicePage extends StatefulWidget { + @override + _DicePageState createState() => _DicePageState(); +} + +class _DicePageState extends State { + int leftDiceNumber = 1, rightDiceNumber = 1; + void changeDiceface() { + setState(() { + leftDiceNumber = Random().nextInt(6) + 1; + rightDiceNumber = Random().nextInt(6) + 1; + }); + } + @override Widget build(BuildContext context) { - return Container(); + return Center( + child: Row( + children: [ + Expanded( + child: FlatButton( + onPressed: () { + changeDiceface(); + }, + child: Image.asset('images/dice$leftDiceNumber.png'), + ), + ), + Expanded( + child: FlatButton( + onPressed: () { + changeDiceface(); + }, + child: Image.asset('images/dice$rightDiceNumber.png'), + ), + ), + ], + ), + ); } }