Mini Project
on
“Distributed Application for Interactive Multiplayer Games”
Submitted to the
Savitribai Phule Pune University
In partial fulfillment for the award of the Degree of
Bachelor of Engineering
in
Information Technology
By
Dhruv Gangal (BEITB73)
Shashi Ranjan(BEITB85)
Utkarsh Singh(BEITB102)
Dhanandri Mane (BEIT103)
Parth Jhanwar (BEITB112)
Under the guidance of
Mrs. R.J. Kodulkar
Department Of Information Technology
D. Y. Patil College Of Engineering
Akurdi, Pune-44, Maharashtra, India
2023-2024
1. Screens:
2. Screens:
Code:
Home Screen:
import 'package:flutter/[Link]'; import
'package:google_fonts/google_fonts.dart'; import
'package:skribbl_clone/screens/join_room_screen.dart';
import '../widgets/custom_button.dart';
import 'create_room_screen.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold( body: Column(
mainAxisAlignment: [Link],
crossAxisAlignment: [Link],
children: [ Text( 'Skribble', style:
TextStyle(
fontFamily: GoogleFonts.pressStart2p(fontWeight: FontWeight.w700)
.fontFamily,
fontSize: 46,
),
),
const SizedBox(height: 22),
const Text(
'Create / join a room to play!',
style: TextStyle(
color: [Link],
fontSize: 24,
),
),
SizedBox(
height: [Link](context).[Link] * 0.1,
),
Row(
mainAxisAlignment: [Link],
children: [
CustomNeoPopButton(
labelText: 'Create Room',
onPress: () {
[Link](context).push(
MaterialPageRoute(
builder: (context) => const CreateRoomScreen()),
);
},
),
CustomNeoPopButton(
labelText: 'Join Room',
onPress: () {
[Link](context).push(
MaterialPageRoute(
builder: (context) => const JoinRoomScreen()),
);
},
),
],
)
],
));
}
}
Create Room screen:
import 'package:flutter/[Link]'; import
'package:google_fonts/google_fonts.dart';
import 'package:skribbl_clone/widgets/custom_button.dart';
import '../[Link]';
import '../widgets/custom_text_field.dart'; import
'paint_screen.dart';
class CreateRoomScreen extends StatefulWidget {
const CreateRoomScreen({Key? key}) : super(key: key);
@override
State<CreateRoomScreen> createState() => _CreateRoomScreenState();
}
class _CreateRoomScreenState extends State<CreateRoomScreen> { final
TextEditingController _nameController = TextEditingController(); final
TextEditingController _roomNameController = TextEditingController();
String? _maxRoundsValue;
String? _roomSizeValue;
@override void dispose() {
[Link]();
_nameController.dispose();
_roomNameController.dispose();
}
void createRoom() { if
(_nameController.[Link] &&
_roomNameController.[Link] &&
_roomSizeValue != null &&
_maxRoundsValue != null) {
Map<String, String> data = {
"nickname": _nameController.text,
"name": _roomNameController.text,
"occupancy": _roomSizeValue!, "maxRounds":
_maxRoundsValue!
};
[Link](context).push(
MaterialPageRoute(
builder: (context) =>
PaintScreen(data: data, screenFrom: "createRoom"),
),
);
} else {
[Link]("Invalid Round or Size");
}
}
@override
Widget build(BuildContext context) {
return Scaffold( appBar: AppBar(), body:
Column( mainAxisAlignment:
[Link],
crossAxisAlignment: [Link],
children: [
Text(
'Create a room',
style: TextStyle(
fontFamily: GoogleFonts.pressStart2p(fontWeight: FontWeight.w700)
.fontFamily,
fontSize: 30,
),
),
SizedBox(
height: [Link](context).[Link] * 0.1,
),
Container(
margin: const [Link](horizontal: 20),
child: CustomTextField(
controller: _nameController,
hintText: "Enter your name",
),
),
const SizedBox(height: 20),
Container(
margin: const [Link](horizontal: 20),
child: CustomTextField(
controller: _roomNameController,
hintText: "Enter your room name",
),
),
const SizedBox(height: 20),
DropdownButton<String>(
focusColor: const Color(0xffF5F6FA),
items: <String>["2", "5", "10", "15"]
.map<DropdownMenuItem<String>>(
(String value) => DropdownMenuItem(
value: value,
child: Text(
value,
style: const TextStyle(color: [Link]),
)))
.toList(),
hint: Text(
_maxRoundsValue != null
? '$_maxRoundsValue Rounds'
: 'Select No. of Rounds', style:
const TextStyle( color:
[Link],
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
onChanged: (String? value) {
setState(() {
_maxRoundsValue = value!;
});
},
),
const SizedBox(
height: 20,
),
DropdownButton<String>( focusColor:
const Color(0xffF5F6FA), items: <String>["2",
"3", "4", "5", "6", "7", "8"]
.map<DropdownMenuItem<String>>(
(String value) => DropdownMenuItem(
value: value,
child: Text(
value,
style: const TextStyle(color: [Link]),
)))
.toList(),
hint: Text(
_roomSizeValue == null
? 'Select Room Size'
: '$_roomSizeValue People',
style: const TextStyle( color:
[Link],
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
onChanged: (String? value) {
setState(() {
_roomSizeValue = value!;
});
},
),
const SizedBox(height: 40),
SizedBox(
width: [Link](context).[Link] / 2.5,
child: CustomNeoPopButton( labelText:
"Create",
onPress: createRoom,
),
),
],
),
);
}
}
Custom_paints.dart:
import 'package:flutter/[Link]'; import
'dart:ui' as ui;
import 'touch_points.dart';
class MyCustomPainter extends CustomPainter {
MyCustomPainter({required [Link]});
List<TouchPoints> pointsList;
List<Offset> offsetPoints = [];
@override
void paint(Canvas canvas, Size size) { Paint background
= Paint()..color = [Link]; Rect rect =
[Link](0, 0, [Link], [Link]);
[Link](rect, background);
[Link](rect);
//Logic for points, if there's a point,we need to display points
//If there's a line,we need to connect the points
for (int i = 0; i < [Link] - 1; i++) {
if (pointsList[i + 1] != null) { // This is
Line
[Link](pointsList[i].points, pointsList[i + 1].points,
pointsList[i].paint); } else if
(pointsList[i + 1] == null) {
// This is Point
[Link]();
[Link](pointsList[i].points);
[Link](Offset(
pointsList[i].[Link] + 0.1, pointsList[i].[Link] + 0.1));
[Link](
[Link], offsetPoints, pointsList[i].paint);
}
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}