Compare commits

..

No commits in common. "main" and "0.0.55" have entirely different histories.
main ... 0.0.55

21 changed files with 31 additions and 78 deletions

View file

@ -3,7 +3,6 @@ analyzer:
errors: errors:
library_private_types_in_public_api: ignore library_private_types_in_public_api: ignore
prefer_const_constructors: ignore prefer_const_constructors: ignore
prefer_const_literals_to_create_immutables: ignore
prefer_final_fields: ignore prefer_final_fields: ignore
use_build_context_synchronously: ignore use_build_context_synchronously: ignore
use_key_in_widget_constructors: ignore use_key_in_widget_constructors: ignore

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,3 +1,3 @@
// lib/globals.dart // lib/globals.dart
const String apiurl = "https://api.dthpp.mercurio.moe"; //const String apiurl = "https://api.dthpp.mercurio.moe";
//const String apiurl = "http://192.168.1.120:9134"; const String apiurl = "http://192.168.1.120:9134";

View file

@ -214,7 +214,7 @@ class _JoinMatchPageState extends State<JoinMatchPage> {
color: Colors.white), color: Colors.white),
onPressed: () => _updateScore(1, -1)), onPressed: () => _updateScore(1, -1)),
Container( Container(
width: 70, width: 100,
height: 50, height: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
@ -237,7 +237,7 @@ class _JoinMatchPageState extends State<JoinMatchPage> {
), ),
], ],
), ),
SizedBox(width: 20), SizedBox(width: 32),
Column( Column(
children: [ children: [
Text(_players[1], Text(_players[1],
@ -249,7 +249,7 @@ class _JoinMatchPageState extends State<JoinMatchPage> {
color: Colors.white), color: Colors.white),
onPressed: () => _updateScore(2, -1)), onPressed: () => _updateScore(2, -1)),
Container( Container(
width: 70, width: 100,
height: 50, height: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
@ -290,7 +290,7 @@ class _JoinMatchPageState extends State<JoinMatchPage> {
color: Colors.white), color: Colors.white),
onPressed: () => _updateScore(3, -1)), onPressed: () => _updateScore(3, -1)),
Container( Container(
width: 70, width: 100,
height: 50, height: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
@ -313,7 +313,7 @@ class _JoinMatchPageState extends State<JoinMatchPage> {
), ),
], ],
), ),
SizedBox(width: 20), SizedBox(width: 32),
Column( Column(
children: [ children: [
Text(_players[3], Text(_players[3],
@ -325,7 +325,7 @@ class _JoinMatchPageState extends State<JoinMatchPage> {
color: Colors.white), color: Colors.white),
onPressed: () => _updateScore(4, -1)), onPressed: () => _updateScore(4, -1)),
Container( Container(
width: 75, width: 100,
height: 50, height: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(

View file

@ -11,7 +11,6 @@ class LeaderboardPage extends StatefulWidget {
class _LeaderboardPageState extends State<LeaderboardPage> { class _LeaderboardPageState extends State<LeaderboardPage> {
List<dynamic> _leaderboard = []; List<dynamic> _leaderboard = [];
bool _isLoading = true; bool _isLoading = true;
bool _sortByOskMu = false;
final String _leaderboardApi = '$apiurl/leaderboards'; final String _leaderboardApi = '$apiurl/leaderboards';
@ -27,7 +26,6 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
List<dynamic> data = json.decode(response.body); List<dynamic> data = json.decode(response.body);
setState(() { setState(() {
_leaderboard = data; _leaderboard = data;
_sortLeaderboard();
_isLoading = false; _isLoading = false;
}); });
} else { } else {
@ -44,23 +42,6 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
} }
} }
void _sortLeaderboard() {
setState(() {
if (_sortByOskMu) {
_leaderboard.sort((a, b) => b['osk_mu'].compareTo(a['osk_mu']));
} else {
_leaderboard.sort((a, b) => b['elo_rating'].compareTo(a['elo_rating']));
}
});
}
void _toggleSort() {
setState(() {
_sortByOskMu = !_sortByOskMu;
_sortLeaderboard();
});
}
void _showError(String message) { void _showError(String message) {
showDialog( showDialog(
context: context, context: context,
@ -88,16 +69,6 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(
title: Text('Leaderboard'),
actions: [
IconButton(
icon: Icon(Icons.sort),
onPressed: _toggleSort,
tooltip: _sortByOskMu ? 'Sort by Elo' : 'Sort by Osk_Mu',
),
],
),
body: _isLoading body: _isLoading
? Center(child: CircularProgressIndicator()) ? Center(child: CircularProgressIndicator())
: RefreshIndicator( : RefreshIndicator(
@ -106,28 +77,16 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
itemCount: _leaderboard.length, itemCount: _leaderboard.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
var player = _leaderboard[index]; var player = _leaderboard[index];
String truncatedOskMu = player['osk_mu'].toStringAsFixed(3);
String assetName = _sortByOskMu
? 'assets/player_${index}_dp.png'
: 'assets/player_${index}.png';
return Card( return Card(
margin: EdgeInsets.all(8), margin: EdgeInsets.all(8),
child: ListTile( child: ListTile(
contentPadding: EdgeInsets.all(10), contentPadding: EdgeInsets.all(10),
leading: CircleAvatar( leading: CircleAvatar(
child: Text(player['player_name'][0].toUpperCase())), child: Text(player['player_name'][0].toUpperCase()),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(player['player_name']),
if (index < 3)
Image.asset(assetName, width: 45, height: 45),
],
), ),
title: Text(player['player_name']),
subtitle: Text( subtitle: Text(
'Elo: ${player['elo_rating']} | TSC: $truncatedOskMu'), 'Elo: ${player['elo_rating']} | TSC: ${player['osk_mu']}'),
trailing: Text('UID: ${player['friend_code']}'), trailing: Text('UID: ${player['friend_code']}'),
), ),
); );

View file

@ -79,15 +79,14 @@ class _ProfilePageState extends State<ProfilePage> {
} }
String getRankImage(int? elo) { String getRankImage(int? elo) {
if (elo == null || elo < -100) return 'assets/none.png'; if (elo == null) return '$apiurl/assets/none.png';
if (elo >= 120) return 'assets/infdan.png'; if (elo > 1000) return '$apiurl/assets/U.png';
if (elo >= 90) return 'assets/SS.png'; if (elo > 750) return '$apiurl/assets/S.png';
if (elo >= 60) return 'assets/S.png'; if (elo > 400) return '$apiurl/assets/A.png';
if (elo >= 30) return 'assets/A.png'; if (elo > 200) return '$apiurl/assets/B.png';
if (elo >= 0) return 'assets/B.png'; if (elo > 100) return '$apiurl/assets/C.png';
if (elo >= -30) return 'assets/C.png'; if (elo > 30) return '$apiurl/assets/D.png';
if (elo >= -60) return 'assets/D.png'; return '$apiurl/assets/none.png';
return 'assets/E.png';
} }
void _showExplanationDialog() { void _showExplanationDialog() {
@ -183,7 +182,9 @@ class _ProfilePageState extends State<ProfilePage> {
), ),
radius: 40, radius: 40,
), ),
SizedBox(width: 16), SizedBox(width: 16),
// Profile Info
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -195,19 +196,7 @@ class _ProfilePageState extends State<ProfilePage> {
), ),
), ),
SizedBox(height: 6), SizedBox(height: 6),
Row( Text('UID: ${_uid ?? 'N/A'}'),
children: [
Text('UID: ${_uid ?? 'N/A'}'),
SizedBox(
width: 30,
),
Image.asset(
getRankImage(_elo),
width: 100,
height: 30,
),
],
),
Row( Row(
children: [ children: [
Text( Text(
@ -221,6 +210,12 @@ class _ProfilePageState extends State<ProfilePage> {
), ),
], ],
), ),
SizedBox(width: 25),
Image.network(
getRankImage(_elo),
width: 137,
height: 137,
),
], ],
), ),
), ),

View file

@ -2,7 +2,7 @@ name: pingpongapp
description: "DTH Ping Pong Score tracking app" description: "DTH Ping Pong Score tracking app"
publish_to: 'none' publish_to: 'none'
version: 0.0.57+1 version: 0.0.55+1
environment: environment:
sdk: '>=3.4.3 <4.0.0' sdk: '>=3.4.3 <4.0.0'
@ -27,8 +27,8 @@ flutter:
uses-material-design: true uses-material-design: true
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: # assets:
- assets/ # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware # https://flutter.dev/assets-and-images/#resolution-aware