Dice page challenge completed
This commit is contained in:
parent
421f982ae2
commit
3723124f0e
@ -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
|
||||
|
||||
|
13
ios/Flutter/flutter_export_environment.sh
Normal file
13
ios/Flutter/flutter_export_environment.sh
Normal file
@ -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"
|
@ -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<DicePage> {
|
||||
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'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user