first screens and show modal

StateManagement
Lucas Delanier 2 years ago
parent 115f445029
commit eac7b475c5

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -13,7 +13,7 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
return MaterialApp(

@ -0,0 +1,76 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../widgets/button_new_party.dart';
import '../widgets/scores_list_widget.dart';
class GameScreen extends StatefulWidget {
const GameScreen({Key? key}) : super(key: key);
@override
State<GameScreen> createState() => _GameScreenState();
}
class _GameScreenState extends State<GameScreen> {
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff19BDE0),
Color(0xff4A17DC),
],
)),
),
Align(
alignment: AlignmentDirectional.topCenter,
child: Container(
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/image_score.png"),
)),
child: Center(
child: Text(
"Scores",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 20),
)),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ButtonNewParty(),
SizedBox(width: 20),
ButtonJoinParty(),
],
),
Align(
alignment: Alignment.bottomCenter,
child: Positioned(
bottom: 0,
child: Container(
height: MediaQuery.of(context).size.height - 140,
width: MediaQuery.of(context).size.width,
child: ListCardGame(),
)),
),
],
)
],
);
}
}

@ -1,8 +1,11 @@
import 'package:bowl_in/presentation/font.dart';
import 'package:bowl_in/views/rank_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../widgets/button_new_party.dart';
import '../widgets/scores_list_widget.dart';
import 'game_screen.dart';
class MainScreen extends StatefulWidget {
const MainScreen({Key? key}) : super(key: key);
@ -14,58 +17,23 @@ class MainScreen extends StatefulWidget {
class _MainScreenState extends State<MainScreen> {
int _index = 0;
int get index => _index;
final screens = [
const GameScreen(),
const RankScreen(),
const RankScreen(),
const RankScreen(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff19BDE0),
Color(0xff4A17DC),
],
)),
),
Align(
alignment: AlignmentDirectional.topCenter,
child: Container(
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/image_score.png"),
)),
child: Center(
child: Text(
"Scores",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 20),
)),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Positioned(
bottom: 0,
child: Container(
height: MediaQuery.of(context).size.height - 200,
width: MediaQuery.of(context).size.width,
child: ListCardGame(),
)),
)
],
),
extendBody: true,
resizeToAvoidBottomInset: false,
body: screens[_index],
bottomNavigationBar: SizedBox(
height: 75,
child: NavigationBarTheme(
data: NavigationBarThemeData(
data: const NavigationBarThemeData(
indicatorColor: Colors.transparent,
),
child: ConstrainedBox(
@ -108,12 +76,12 @@ class _MainScreenState extends State<MainScreen> {
icon: Icon(
Icons.show_chart,
color: Colors.grey,
size: 21,
size: 25,
),
label: '',
selectedIcon: Icon(
Icons.show_chart,
size: 21,
size: 25,
),
),
NavigationDestination(

@ -0,0 +1,91 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../widgets/profil_listpodium_widget.dart';
class RankScreen extends StatefulWidget {
const RankScreen({Key? key}) : super(key: key);
@override
State<RankScreen> createState() => _RankScreenState();
}
class _RankScreenState extends State<RankScreen> {
@override
Widget build(BuildContext context) {
return Stack(alignment: Alignment.center, children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff19BDE0),
Color(0xff4A17DC),
],
)),
),
Align(
alignment: AlignmentDirectional.topCenter,
child: Container(
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/image_ranking.png"),
)),
child: Center(
child: Text(
"Ranking",
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.white, fontSize: 20),
)),
),
),
Positioned(
top: 70,
child: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width - 60,
height: 500,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/image_podium(1).png"),
)),
)
],
)),
Positioned(
left: 65,
top: MediaQuery.of(context).size.height * 0.195,
child: ProfilPodiumWidget(isfirst: 0, pseudo: "Louison", score: 122)),
Positioned(
top: MediaQuery.of(context).size.height * 0.114,
child: Align(
child: ProfilPodiumWidget(isfirst: 1, pseudo: "Lucas", score: 167),
)),
Positioned(
right: 65,
top: MediaQuery.of(context).size.height * 0.219,
child: ProfilPodiumWidget(isfirst: 0, pseudo: "David", score: 102),
),
Positioned(
bottom: -40,
child: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width - 40,
height: 500,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/image_podium.png"),
)),
child: ListPodium(),
)
],
)),
]);
}
}

@ -0,0 +1,168 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
class ButtonNewParty extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {},
child: Text("+ New game"),
style: ElevatedButton.styleFrom(
side: BorderSide(
width: 4,
color: Color(0xffFF419B),
),
onPrimary: Colors.white,
primary: Color(0xffF40375),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(35),
),
minimumSize: Size(130, 37),
),
);
}
}
class NewGameModal extends StatelessWidget {
const NewGameModal({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Dialog(
child: Stack(
alignment: Alignment.topCenter,
children: [
Transform.scale(
scale: 1.14,
child: Image.asset("assets/images/image_newgame_modal.png")),
SizedBox(
height: 245,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Text("Join game",
style: GoogleFonts.roboto(
fontWeight: FontWeight.w900, fontSize: 18)),
),
SizedBox(
height: 40,
),
Image.asset(
"assets/images/sentence_joingame.png",
width: 240,
),
Spacer(),
Padding(
padding: EdgeInsets.fromLTRB(8, 8, 0, 8),
child: Stack(
alignment: Alignment.centerLeft,
children: [
Container(
width: 290,
height: 50,
decoration: BoxDecoration(
color: Color(0xffF8F8F8),
borderRadius: BorderRadius.circular(10),
boxShadow: [
const BoxShadow(
color: Colors.grey,
),
const BoxShadow(
color: Colors.black,
spreadRadius: -20.0,
blurRadius: 12.0,
),
],
),
),
Padding(
padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
child: TextField(
maxLength: 6,
decoration: new InputDecoration(
hintText: 'Party code...',
counterStyle: TextStyle(
height: double.minPositive,
),
counterText: "",
border: InputBorder.none,
),
style: GoogleFonts.roboto(
fontWeight: FontWeight.bold,
color: Color(0xff989898)),
),
)
],
)),
Stack(
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, 3, 0, 0),
child: Container(
height: 50,
width: 290,
decoration: BoxDecoration(
color: Color(0xffB70056),
borderRadius: BorderRadius.circular(10),
),
),
),
ElevatedButton(
onPressed: () => Navigator.pop(context),
child: Text(
"CONFIRM",
style: GoogleFonts.roboto(
fontWeight: FontWeight.bold, fontSize: 18),
),
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: Color(0xffF40375),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
minimumSize: Size(290, 45),
),
),
],
)
],
),
)
],
),
);
}
}
class ButtonJoinParty extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return NewGameModal();
});
},
child: Text("Join game"),
style: ElevatedButton.styleFrom(
side: BorderSide(
width: 4,
color: Color(0xff6B6588),
),
onPrimary: Colors.white,
primary: Color(0xff45405D),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(35),
),
minimumSize: Size(130, 37),
),
);
}
}

@ -0,0 +1,204 @@
import 'package:bowl_in/widgets/scores_list_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class ProfilPodiumWidget extends StatelessWidget {
final int isfirst;
final String pseudo;
final int score;
const ProfilPodiumWidget(
{Key? key,
required this.isfirst,
required this.pseudo,
required this.score})
: super(key: key);
@override
Widget build(BuildContext context) {
return Column(
children: [
Stack(
clipBehavior: Clip.none,
children: [
Container(
width: this.isfirst == 1 ? 65 : 50,
height: this.isfirst == 1 ? 65 : 50,
decoration: BoxDecoration(
color: Colors.red,
border: Border.all(width: 2.0, color: const Color(0xFFFFFFFF)),
borderRadius: BorderRadius.all(Radius.circular(70)),
),
),
if (isfirst == 1)
Positioned(
bottom: -5,
right: -15,
child: Image.asset(
'assets/images/image_trophee.png',
height: 40,
width: 40,
),
),
],
),
Padding(
padding: EdgeInsets.fromLTRB(0, 3, 0, 3),
child: Text(
this.pseudo,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
),
Container(
width: 70,
height: 25,
decoration: BoxDecoration(
color: Color(0xff3618A0),
borderRadius: BorderRadius.all(Radius.circular(70)),
),
child: Center(
child: Text(
this.score.toString(),
style: GoogleFonts.roboto(
color: Colors.white,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
fontSize: 16),
),
)),
],
);
}
}
class ProfilListWidget extends StatelessWidget {
final int position;
final String pseudo;
final int score;
const ProfilListWidget(
{Key? key,
required this.position,
required this.pseudo,
required this.score})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.fromLTRB(0, 0, 0, 9),
child: Container(
width: 300,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(17)),
color: Colors.white,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.fromLTRB(18, 0, 18, 0),
child: Text(
this.position.toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xffBABABA),
),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(70)),
color: Colors.grey,
),
),
Padding(
padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
this.pseudo,
style: TextStyle(
fontWeight: FontWeight.bold, color: Color(0xff585858)),
),
Text(
this.score.toString() + " points",
style: TextStyle(
fontWeight: FontWeight.bold, color: Color(0xffBABABA)),
),
],
),
),
],
),
),
);
}
}
class ListPodium extends StatelessWidget {
const ListPodium({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.fromLTRB(20, 80, 20, 0),
child: SizedBox(
height: 500,
child: ScrollConfiguration(
behavior: CustomScroll(),
child: ListView(
children: [
ProfilListWidget(
position: 4,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 5,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 6,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 7,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 8,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 9,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 10,
pseudo: 'Emre',
score: 35,
),
ProfilListWidget(
position: 11,
pseudo: 'Emre',
score: 35,
),
SizedBox(
height: 50,
),
],
),
)));
}
}

@ -1,19 +1,135 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:simple_gradient_text/simple_gradient_text.dart';
class CardGame extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.fromLTRB(0, 0, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.fromLTRB(41, 0, 41, 10),
child: Stack(
alignment: AlignmentDirectional.centerEnd,
children: [
Container(
height: 100,
width: 300,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomRight: Radius.circular(15),
bottomLeft: Radius.circular(15)),
image: DecorationImage(
image: AssetImage("assets/images/card_game.png"),
),
),
child: Padding(
padding: EdgeInsets.fromLTRB(130, 3, 0, 0),
child: ClipRect(
clipBehavior: Clip.hardEdge,
child: Opacity(
opacity: 0.1,
child: Stack(
children: [
GradientText(
"125",
style: GoogleFonts.karla(
fontSize: 105.0,
fontWeight: FontWeight.w900,
fontStyle: FontStyle.italic,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = 1
..color = Color(0xff6100FF),
),
gradientType: GradientType.linear,
gradientDirection: GradientDirection.rtl,
radius: 2.5,
colors: [
Color(0xff5500E0),
Color(0xff2C2C2C).withOpacity(0),
],
),
GradientText(
"125",
style: GoogleFonts.karla(
fontSize: 105.0,
fontWeight: FontWeight.w900,
fontStyle: FontStyle.italic,
),
gradientType: GradientType.linear,
gradientDirection: GradientDirection.rtl,
radius: 2.5,
colors: [
Color(0xff5500E0),
Color(0xff2C2C2C).withOpacity(0),
],
),
],
))),
)),
);
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Toast(),
Toast(),
],
),
Stack(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.fromLTRB(25, 15, 0, 0),
child: SizedBox(
width: 130,
child: Wrap(
spacing: 5,
runSpacing: 5,
children: [
ProfilPicture(),
ProfilPicture(),
ProfilPicture(),
ProfilPicture(),
ProfilPicture(),
ProfilPicture(),
],
),
)),
Spacer(),
Padding(
padding: EdgeInsets.fromLTRB(0, 30, 15, 0),
child: GradientText(
"125",
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.w900,
fontStyle: FontStyle.italic,
),
gradientType: GradientType.linear,
gradientDirection: GradientDirection.ttb,
radius: 2.5,
colors: [
Color(0xff181818),
Color(0xff626262),
],
)),
],
),
],
),
],
),
],
));
}
}
@ -30,9 +146,8 @@ class ListCardGame extends StatelessWidget {
Widget build(BuildContext context) {
return ScrollConfiguration(
behavior: CustomScroll(),
child: Expanded(
child: ListView(
shrinkWrap: true,
shrinkWrap: false,
children: <Widget>[
CardGame(),
CardGame(),
@ -47,6 +162,43 @@ class ListCardGame extends StatelessWidget {
CardGame(),
CardGame(),
],
));
}
}
class ProfilPicture extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 25,
width: 25,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(20)),
),
);
}
}
class Toast extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.fromLTRB(0, 3, 10, 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Color(0xff735CDD),
),
child: Padding(
padding: EdgeInsets.fromLTRB(11.0, 3, 11.0, 3),
child: Text(
"12 janv.",
style: TextStyle(
fontSize: 10,
color: Colors.white,
),
),
)));
}
}

@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
cupertino_icons:
dependency: "direct main"
description:
@ -50,6 +57,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
@ -67,6 +88,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.5"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.2"
lints:
dependency: transitive
description:
@ -102,6 +144,76 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.12"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.22"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
simple_gradient_text:
dependency: "direct main"
description:
name: simple_gradient_text
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.4"
sky_engine:
dependency: transitive
description: flutter
@ -149,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
vector_math:
dependency: transitive
description:
@ -156,5 +275,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
sdks:
dart: ">=2.18.2 <3.0.0"
flutter: ">=3.0.0"

@ -36,6 +36,8 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
simple_gradient_text: ^1.2.4
google_fonts: ^3.0.1
dev_dependencies:
flutter_test:

Loading…
Cancel
Save