Feat: add pages and navigation between them; random mass

This commit is contained in:
Grail Finder
2025-04-27 08:41:23 +03:00
parent e79b3e691a
commit 374728da45
5 changed files with 165 additions and 24 deletions

43
lib/pages/gain_room.dart Normal file
View File

@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'dart:math';
int randomInRange(int min, int max) {
final random = Random();
return min + random.nextInt(max - min + 1);
}
class GainRoom extends StatefulWidget {
const GainRoom({super.key});
@override
State<GainRoom> createState() => _GainRoomState();
}
class _GainRoomState extends State<GainRoom>{
//vars
int _mass = randomInRange(40, 80);
//methods
void _gainMass(){
setState(() {
_mass += randomInRange(1, 3);
});
}
//ui
@override
Widget build(BuildContext context){
return Scaffold(
appBar: AppBar(title: Text("Gain Room")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Current mass:"),
Text(_mass.toString()),
],
),
),
);
}
}