Skip to content

Commit

Permalink
Merge pull request #9 from udayaKavinda/main
Browse files Browse the repository at this point in the history
routes updated
  • Loading branch information
udayaKavinda authored Jan 7, 2024
2 parents 811c05f + 4bc47cc commit e5f1853
Show file tree
Hide file tree
Showing 7 changed files with 230 additions and 248 deletions.
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "smartchessboard",
"cwd": "code\\smartchessboard",
"request": "launch",
"type": "dart"
},
{
"name": "smartchessboard (profile mode)",
"cwd": "code\\smartchessboard",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "smartchessboard (release mode)",
"cwd": "code\\smartchessboard",
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
]
}
124 changes: 8 additions & 116 deletions code/smartchessboard/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import 'package:smartchessboard/screens/create_room_screen.dart';
import 'package:smartchessboard/screens/game_screen.dart';
import 'package:smartchessboard/screens/join_room_screen.dart';
import 'package:smartchessboard/screens/main_menu_screen.dart';
import 'package:smartchessboard/screens/login.dart';
import 'package:smartchessboard/screens/signup.dart';
import 'package:smartchessboard/screens/login_screen.dart';
import 'package:smartchessboard/screens/signup_screen.dart';
import 'package:provider/provider.dart';
import 'package:smartchessboard/screens/welcome_screen.dart';

void main() {
//runApp(const MyApp());
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: HomePage(),
home: MyApp(),
));
}

Expand All @@ -32,126 +33,17 @@ class MyApp extends StatelessWidget {
child: MaterialApp(
title: "chess",
debugShowCheckedModeBanner: false,
initialRoute: MainMenuScreen.routeName,
initialRoute: WelcomeScreen.routeName,
routes: {
MainMenuScreen.routeName: (context) => const MainMenuScreen(),
JoinRoomScreen.routeName: (context) => const JoinRoomScreen(),
CreateRoomScreen.routeName: (context) => const CreateRoomScreen(),
GameScreen.routeName: (context) => const GameScreen(),
SignupPage.routeName: (context) => const SignupPage(),
LoginPage.routeName: (context) => const LoginPage(),
WelcomeScreen.routeName: (context) => const WelcomeScreen(),
},
),
);
}
}

class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
// we will give media query height
// double.infinity make it big as my parent allows
// while MediaQuery make it big as per the screen

width: double.infinity,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
child: Column(
// even space distribution
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Column(
children: <Widget>[
Text(
"Welcome",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30,

),

),
SizedBox(
height: 20,
),
Text("Experience live chess moves on a real board\nConnect, play, and enjoy the game",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[700],
fontSize: 15,

),)
],
),
Container(
height: MediaQuery.of(context).size.height / 2,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/welcome.png")
)
),
),

Column(
children: <Widget>[
// the login button
MaterialButton(
minWidth:250,
height: 60,
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => LoginPage()));

},
// defining the shape
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black
),
borderRadius: BorderRadius.circular(50)
),
child: Text(
"Login",
style: TextStyle(
fontWeight: FontWeight.w300,
fontSize: 15
),
),
),
// creating the signup button
SizedBox(height:20),
MaterialButton(
minWidth: 250,
height: 60,
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=> SignupPage()));

},
color: Color(0xff0095FF),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),

),
child: Text(
"Sign up",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w300,
fontSize: 15
),
),
)

],
)



],
),
),
),
);
}
}
2 changes: 1 addition & 1 deletion code/smartchessboard/lib/resources/socket_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SocketClient {
static SocketClient? _instance;

SocketClient._internal() {
socket = IO.io('http://192.168.1.100:3000', <String, dynamic>{
socket = IO.io('http://192.168.1.101:3000', <String, dynamic>{
'transports': ['websocket'],
'autoconnect': false,
});
Expand Down
1 change: 0 additions & 1 deletion code/smartchessboard/lib/screens/game_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:chess/chess.dart' as chesslib;
import 'package:provider/provider.dart';
import 'package:smartchessboard/provider/move_data_provider.dart';
import 'package:smartchessboard/provider/room_data_provider.dart';
Expand Down
Loading

0 comments on commit e5f1853

Please sign in to comment.