Added difficulty screen
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
63
lib/features/difficulty/difficulty_screen.dart
Normal file
63
lib/features/difficulty/difficulty_screen.dart
Normal file
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wolf_dart/classes/difficulty.dart';
|
||||
import 'package:wolf_dart/features/renderer/renderer.dart';
|
||||
|
||||
class DifficultyScreen extends StatelessWidget {
|
||||
const DifficultyScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'HOW TOUGH ARE YOU?',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Courier',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: Difficulty.values.length,
|
||||
itemBuilder: (context, index) {
|
||||
final Difficulty difficulty = Difficulty.values[index];
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blueGrey[900],
|
||||
foregroundColor: Colors.white,
|
||||
minimumSize: const Size(300, 50),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
// Push the renderer and pass the selected difficulty
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => WolfRenderer(
|
||||
difficulty: difficulty,
|
||||
isDemo: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
difficulty.title,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user