Description
import 'package:flutter/material.dart';
void main() {
runApp(GameON());
}
class GameON extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'GameON',
theme: ThemeData(
primaryColor: Colors.blue,
scaffoldBackgroundColor: Colors.black,
colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.green),
textTheme: TextTheme(bodyLarge: TextStyle(color: Colors.white)),
),
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
final List sports = ['Cricket Turf', 'Pickleball Court'];
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('GameON')),
body: ListView.builder(
itemCount: sports.length,
itemBuilder: (context, index) {
return Card(
color: Colors.green[700],
margin: EdgeInsets.all(10),
child: ListTile(
title: Text(
sports[index],
style: TextStyle(color: Colors.white),
),
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => DetailScreen(sport: sports[index])));
},
),
);
},
),
);
}
}
class DetailScreen extends StatelessWidget {
final String sport;
DetailScreen({required this.sport});
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('$sport Booking')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Slots available for $sport',
style: TextStyle(fontSize: 18, color: Colors.white)),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Booked Successfully!")));
},
child: Text('Book Now'),
)
],
),
),
);
}
}