New version

This commit is contained in:
AnassSD 2022-02-11 17:31:04 +02:00
parent 421f982ae2
commit 9da11e48de
2 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,13 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=D:\flutter\flutter"
export "FLUTTER_APPLICATION_PATH=D:\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"

View File

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
@ -6,6 +8,7 @@ void main() {
home: Scaffold(
backgroundColor: Colors.red,
appBar: AppBar(
centerTitle: true,
title: Text('Dicee'),
backgroundColor: Colors.red,
),
@ -15,9 +18,48 @@ void main() {
);
}
class DicePage extends StatelessWidget {
class DicePage extends StatefulWidget {
@override
_DicePageState createState() => _DicePageState();
}
class _DicePageState extends State<DicePage> {
int leftDiceNumber = 1, rightDiceNumber = 1;
int randomNumb() {
int a = 1 + Random().nextInt(6);
return a;
}
void changeNumb() {
setState(() {
leftDiceNumber = randomNumb();
rightDiceNumber = randomNumb();
});
}
@override
Widget build(BuildContext context) {
return Container();
return Center(
child: Row(
children: <Widget>[
Expanded(
child: TextButton(
onPressed: () {
changeNumb();
},
child: Image.asset('images/dice$leftDiceNumber.png'),
),
),
Expanded(
child: TextButton(
onPressed: () {
changeNumb();
},
child: Image.asset('images/dice$rightDiceNumber.png'),
),
),
],
),
);
}
}