Flutter function using dice app
This commit is contained in:
parent
421f982ae2
commit
6b914932d0
11
ios/Flutter/flutter_export_environment.sh
Normal file
11
ios/Flutter/flutter_export_environment.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# This is a generated file; do not edit or check into version control.
|
||||
export "FLUTTER_ROOT=C:\studio\flutter"
|
||||
export "FLUTTER_APPLICATION_PATH=C:\studio\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:\studio\flutter\bin\cache\artifacts\engine\ios"
|
||||
export "FLUTTER_BUILD_NAME=1.0.0"
|
||||
export "FLUTTER_BUILD_NUMBER=1"
|
@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
@ -15,9 +17,45 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
class DicePage extends StatelessWidget {
|
||||
class DicePage extends StatefulWidget {
|
||||
@override
|
||||
_DicePageState createState() => _DicePageState();
|
||||
}
|
||||
|
||||
class _DicePageState extends State<DicePage> {
|
||||
int leftDiceNumber = 1;
|
||||
int rightDiceNumber = 1;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
return Center(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: FlatButton(
|
||||
child: Image.asset('images/dice$leftDiceNumber.png'),
|
||||
onPressed: () {
|
||||
updateRandomValues();
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FlatButton(
|
||||
child: Image.asset('images/dice$rightDiceNumber.png'),
|
||||
onPressed: () {
|
||||
updateRandomValues();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void updateRandomValues() {
|
||||
setState(() {
|
||||
leftDiceNumber = Random().nextInt(6) + 1;
|
||||
rightDiceNumber = Random().nextInt(6) + 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user