Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding flatbutton #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\Users\Semite\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Projects\dicee-flutter"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=C:\Users\Semite\flutter\bin\cache\artifacts\engine\ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
50 changes: 45 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:math';
import 'package:flutter/material.dart';

void main() {
Expand All @@ -6,7 +7,7 @@ void main() {
home: Scaffold(
backgroundColor: Colors.red,
appBar: AppBar(
title: Text('Dicee'),
title: Text('Play Dicee with Semite'),
backgroundColor: Colors.red,
),
body: DicePage(),
Expand All @@ -15,9 +16,48 @@ void main() {
);
}

class DicePage extends StatelessWidget {

class DicePage extends StatefulWidget {
@override
Widget build(BuildContext context) {
return Container();
}
_DicePageState createState() => _DicePageState();
}

class _DicePageState extends State<DicePage> {
int leftDiceNumber = 1;
int rightDiceNumber = 1;

void changeDice() {
setState(() {
leftDiceNumber = Random().nextInt(6)+ 1;
rightDiceNumber = Random().nextInt(6) + 1;
});
}



@override
Widget build(BuildContext context) {
return Center(
child: Row(
children: <Widget> [
Expanded(
child: FlatButton(
onPressed: () {
changeDice();
},
child: Image.asset('images/dice$leftDiceNumber.png'),
),
),

Expanded(
child: FlatButton(
onPressed: () {
changeDice();
},
child: Image.asset('images/dice$rightDiceNumber.png')),
),
],
),
);
}
}