binding profile page and home page
continuous-integration/drone/push Build is failing Details

pull/20/head
Lucas Delanier 2 years ago
parent aa18451fce
commit 9f30fce136

@ -8,11 +8,15 @@ import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:bowl_in/config/app_router.dart'; import 'package:bowl_in/config/app_router.dart';
import 'model/IManager.dart';
import 'model/StubManager/StubData.dart';
void main() { void main() {
runApp(const MyApp()); runApp(const MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
static IManager controller = StubData();
const MyApp({super.key}); const MyApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -2,13 +2,13 @@ import 'package:uuid/uuid.dart';
class Game { class Game {
Uuid _id; Uuid _id;
DateTime _time; DateTime _date;
int _pointsCurrentUser; int _pointsCurrentUser;
bool _isFinished; bool _isFinished;
List<Uuid> _playersId = []; List<Uuid> _playersId = [];
// Constructor // Constructor
Game(this._id, this._time, this._pointsCurrentUser, this._isFinished, Game(this._id, this._date, this._pointsCurrentUser, this._isFinished,
this._playersId); this._playersId);
// Getters and setters // Getters and setters
@ -18,10 +18,10 @@ class Game {
_id = value; _id = value;
} }
DateTime get time => _time; DateTime get date => _date;
set time(DateTime value) { set date(DateTime value) {
_time = value; _date = value;
} }
int get pointsCurrentUser => _pointsCurrentUser; int get pointsCurrentUser => _pointsCurrentUser;

@ -12,6 +12,11 @@ abstract class IManager {
// Getters and setters // Getters and setters
User get userCurrent => _userCurrent; User get userCurrent => _userCurrent;
set userCurrent(User user) {
_userCurrent = user;
}
Game get gameCurrent => _gameCurrent; Game get gameCurrent => _gameCurrent;
IUserManager get userMgr => _userMgr; IUserManager get userMgr => _userMgr;
IGameManager get gameMgr => _gameMgr; IGameManager get gameMgr => _gameMgr;

@ -25,6 +25,8 @@ class StubData extends IManager {
_initRounds(); _initRounds();
_initGameDetails(); _initGameDetails();
_initGame(); _initGame();
users[1].games = games;
userCurrent = users[1];
} }
List<Player> players = [ List<Player> players = [
@ -41,7 +43,7 @@ class StubData extends IManager {
User( User(
Uuid(), Uuid(),
"Emre", "Emre",
"https://fastly.picsum.photos/id/1060/2000/2000.jpg?hmac=_RrU8GpkCDUlVKfgyWE-GcX-GS5TKNyUzdFbJAGXHV4", "./assets/images/image_user_cyan.png",
"emre.kartal@etu.uca.fr", "emre.kartal@etu.uca.fr",
[ [
Achievement("5 games"), Achievement("5 games"),
@ -53,7 +55,7 @@ class StubData extends IManager {
User( User(
Uuid(), Uuid(),
"Dave", "Dave",
"https://fastly.picsum.photos/id/820/2000/2000.jpg?hmac=Ctxx2feJNZnG1S7UPx_YrWcEw89tKb7fR8i1W-VTOz4", "./assets/images/image_user_cyan.png",
"david.d_almeida@etu.uca.fr", "david.d_almeida@etu.uca.fr",
[ [
Achievement("5 games"), Achievement("5 games"),
@ -99,7 +101,8 @@ class StubData extends IManager {
List<Game> games = []; List<Game> games = [];
void _initGame() { void _initGame() {
games.add(Game(gameDetails[0].id, DateTime.now(), 123, true, [])); games.add(Game(gameDetails[0].id,
DateTime.now().subtract(Duration(days: 14)), 123, true, []));
games.add(Game(gameDetails[1].id, DateTime.now(), 101, true, [])); games.add(Game(gameDetails[1].id, DateTime.now(), 101, true, []));
} }
} }

@ -1,3 +1,4 @@
import 'package:bowl_in/main.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -42,15 +43,18 @@ class _AnalysisScreenState extends State<AnalysisScreen> {
children: [ children: [
Positioned( Positioned(
left: 34, left: 34,
child: SpareCard(score: 12), child: SpareCard(
score: MyApp.controller.userCurrent.stat.nbSpares),
), ),
Positioned( Positioned(
top: 0, top: 0,
child: StrikeCard(score: 12), child: StrikeCard(
score: MyApp.controller.userCurrent.stat.nbStrikes),
), ),
Positioned( Positioned(
right: 34, right: 34,
child: GameCard(score: 12), child: GameCard(
score: MyApp.controller.userCurrent.stat.nbGames),
) )
], ],
), ),

@ -1,3 +1,4 @@
import 'package:bowl_in/main.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
@ -152,7 +153,7 @@ class ProfileWidget extends StatelessWidget {
width: 80, width: 80,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/images/image_user_orange.png"), image: AssetImage(MyApp.controller.userCurrent.image),
fit: BoxFit.cover), fit: BoxFit.cover),
borderRadius: BorderRadius.all(Radius.circular(100)), borderRadius: BorderRadius.all(Radius.circular(100)),
), ),
@ -163,7 +164,7 @@ class ProfileWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Lucas", MyApp.controller.userCurrent.name,
style: GoogleFonts.roboto( style: GoogleFonts.roboto(
color: Colors.white, color: Colors.white,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
@ -186,7 +187,9 @@ class ProfileWidget extends StatelessWidget {
fontSize: 15), fontSize: 15),
), ),
TextSpan( TextSpan(
text: "122 pts", text: MyApp.controller.userCurrent.stat.highscore
.toString() +
" pts",
style: GoogleFonts.roboto( style: GoogleFonts.roboto(
color: Color(0xffF40375).withOpacity(0.75), color: Color(0xffF40375).withOpacity(0.75),
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
@ -197,38 +200,44 @@ class ProfileWidget extends StatelessWidget {
), ),
), ),
), ),
RichText( MyApp.controller.userCurrent.games.length > 0
text: TextSpan( ? RichText(
text: '', text: TextSpan(
style: DefaultTextStyle.of(context).style, text: '',
children: <TextSpan>[ style: DefaultTextStyle.of(context).style,
TextSpan( children: <TextSpan>[
text: "Last game ", TextSpan(
style: GoogleFonts.roboto( text: "Last game ",
color: Colors.white.withOpacity(0.65), style: GoogleFonts.roboto(
fontStyle: FontStyle.italic, color: Colors.white.withOpacity(0.65),
fontWeight: FontWeight.bold, fontStyle: FontStyle.italic,
fontSize: 15), fontWeight: FontWeight.bold,
), fontSize: 15),
TextSpan( ),
text: "23", TextSpan(
style: GoogleFonts.roboto( text: DateTime.now()
color: Colors.white, .difference(MyApp
fontStyle: FontStyle.italic, .controller.userCurrent.games.first.date)
fontWeight: FontWeight.bold, .inDays
fontSize: 15), .toString(),
), style: GoogleFonts.roboto(
TextSpan( color: Colors.white,
text: " days(s) ago", fontStyle: FontStyle.italic,
style: GoogleFonts.roboto( fontWeight: FontWeight.bold,
color: Colors.white.withOpacity(0.65), fontSize: 15),
fontStyle: FontStyle.italic, ),
fontWeight: FontWeight.bold, TextSpan(
fontSize: 15), text: " days(s) ago",
), style: GoogleFonts.roboto(
], color: Colors.white.withOpacity(0.65),
), fontStyle: FontStyle.italic,
), fontWeight: FontWeight.bold,
fontSize: 15),
),
],
),
)
: Container(),
], ],
), ),
) )

@ -1,13 +1,22 @@
import 'package:bowl_in/main.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'package:simple_gradient_text/simple_gradient_text.dart'; import 'package:simple_gradient_text/simple_gradient_text.dart';
import '../model/Game.dart';
class CardGame extends StatelessWidget { class CardGame extends StatelessWidget {
final Game game;
const CardGame({Key? key, required this.game}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
initializeDateFormatting();
return Padding( return Padding(
padding: EdgeInsets.fromLTRB(41, 0, 41, 10), padding: EdgeInsets.fromLTRB(41, 0, 41, 10),
child: GestureDetector( child: GestureDetector(
@ -29,7 +38,7 @@ class CardGame extends StatelessWidget {
), ),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(130, 3, 0, 0), padding: EdgeInsets.fromLTRB(120, 3, 0, 0),
child: ClipRect( child: ClipRect(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: Opacity( child: Opacity(
@ -37,7 +46,7 @@ class CardGame extends StatelessWidget {
child: Stack( child: Stack(
children: [ children: [
GradientText( GradientText(
"125", game.pointsCurrentUser.toString(),
style: GoogleFonts.karla( style: GoogleFonts.karla(
fontSize: 105.0, fontSize: 105.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
@ -56,7 +65,7 @@ class CardGame extends StatelessWidget {
], ],
), ),
GradientText( GradientText(
"125", game.pointsCurrentUser.toString(),
style: GoogleFonts.karla( style: GoogleFonts.karla(
fontSize: 105.0, fontSize: 105.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
@ -80,8 +89,10 @@ class CardGame extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Toast(), Toast(
Toast(), value:
DateFormat('dd MMMM', 'fr_FR').format(game.date)),
Toast(value: DateFormat('HH:mm').format(game.date)),
], ],
), ),
Stack( Stack(
@ -111,7 +122,7 @@ class CardGame extends StatelessWidget {
Padding( Padding(
padding: EdgeInsets.fromLTRB(0, 30, 15, 0), padding: EdgeInsets.fromLTRB(0, 30, 15, 0),
child: GradientText( child: GradientText(
"125", game.pointsCurrentUser.toString(),
style: TextStyle( style: TextStyle(
fontSize: 40.0, fontSize: 40.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
@ -151,22 +162,12 @@ class ListCardGame extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScrollConfiguration( return ScrollConfiguration(
behavior: CustomScroll(), behavior: CustomScroll(),
child: ListView( child: ListView.builder(
shrinkWrap: false, shrinkWrap: false,
children: <Widget>[ itemCount: MyApp.controller.userCurrent.games.length,
CardGame(), itemBuilder: (BuildContext context, int index) {
CardGame(), return CardGame(game: MyApp.controller.userCurrent.games[index]);
CardGame(), },
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
],
)); ));
} }
} }
@ -188,6 +189,9 @@ class ProfilPicture extends StatelessWidget {
} }
class Toast extends StatelessWidget { class Toast extends StatelessWidget {
final String value;
const Toast({Key? key, required this.value}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
@ -200,7 +204,7 @@ class Toast extends StatelessWidget {
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(11.0, 3, 11.0, 3), padding: EdgeInsets.fromLTRB(11.0, 3, 11.0, 3),
child: Text( child: Text(
"12 janv.", value,
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
color: Colors.white, color: Colors.white,

@ -170,6 +170,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.3.0" version: "3.3.0"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.18.0"
js: js:
dependency: transitive dependency: transitive
description: description:

@ -40,6 +40,8 @@ dependencies:
google_fonts: ^3.0.1 google_fonts: ^3.0.1
go_router: ^6.0.1 go_router: ^6.0.1
uuid: ^3.0.7 uuid: ^3.0.7
intl: ^0.18.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save