diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 00000000..63d0e556 --- /dev/null +++ b/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\src\flutter\flutter" +export "FLUTTER_APPLICATION_PATH=E:\AndroidStudioProjects\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:\src\flutter\flutter\bin\cache\artifacts\engine\ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" diff --git a/lib/main.dart b/lib/main.dart index 6e68f204..7b93b032 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'dart:math'; void main() { return runApp( @@ -15,9 +16,47 @@ void main() { ); } -class DicePage extends StatelessWidget { +class DicePage extends StatefulWidget { + @override + _DicePageState createState() => _DicePageState(); +} + +class _DicePageState extends State { + var leftDiceNumber = 5; + var rightDiceNumber = 2; + + void numberGenerator() { + 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: () { + setState(() { + numberGenerator(); + }); + }, + child: Image.asset('images/dice$leftDiceNumber.png'), + ), + ), + Expanded( + child: FlatButton( + onPressed: () { + setState(() { + numberGenerator(); + }); + }, + child: Image.asset('images/dice$rightDiceNumber.png'), + ), + ), + ], + ), + ); } }