Files
wolf_dart/lib/features/difficulty/difficulty_screen.dart

79 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:wolf_dart/features/difficulty/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,
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.red[900],
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => const WolfRenderer(
difficulty: Difficulty.bringEmOn,
isDemo: false,
showSpriteGallery: true,
),
),
);
},
child: const Icon(Icons.bug_report, color: Colors.white),
),
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),
),
);
},
),
],
),
),
);
}
}