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

110 lines
3.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 StatefulWidget {
const DifficultyScreen({super.key});
@override
State<DifficultyScreen> createState() => _DifficultyScreenState();
}
class _DifficultyScreenState extends State<DifficultyScreen> {
bool isShareware = true; // Default to Shareware (WL1)
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.red[900],
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => WolfRenderer(
difficulty: Difficulty.bringEmOn,
isShareware: isShareware,
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: 20),
// --- Version Toggle ---
Theme(
data: ThemeData(unselectedWidgetColor: Colors.grey),
child: CheckboxListTile(
title: const Text(
"Play Shareware Version (WL1)",
style: TextStyle(color: Colors.white),
),
value: isShareware,
onChanged: (bool? value) {
setState(() {
isShareware = value ?? true;
});
},
controlAffinity: ListTileControlAffinity.leading,
contentPadding: const EdgeInsets.symmetric(horizontal: 100),
),
),
const SizedBox(height: 20),
// --- Difficulty Buttons ---
ListView.builder(
shrinkWrap: true,
itemCount: Difficulty.values.length,
itemBuilder: (context, index) {
final Difficulty difficulty = Difficulty.values[index];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blueGrey[900],
foregroundColor: Colors.white,
minimumSize: const Size(300, 50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
),
onPressed: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (_) => WolfRenderer(
difficulty: difficulty,
isShareware: isShareware,
),
),
);
},
child: Text(
difficulty.title,
style: const TextStyle(fontSize: 18),
),
),
);
},
),
],
),
),
);
}
}