New views filed with promises

ready for first alpha build
This commit is contained in:
dan63047 2023-06-06 01:21:29 +03:00
parent ca1722e340
commit d69713664f
15 changed files with 205 additions and 35 deletions

View File

@ -44,10 +44,10 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.dan63.tetrastats.tetra_stats"
applicationId "com.dan63.tetra_stats"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

View File

@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dan63.tetrastats.tetra_stats">
<application
android:label="tetra_stats"
android:label="Tetra Stats"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity

View File

@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>tetra_stats</string>
<string>Tetra Stats</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

View File

@ -184,7 +184,7 @@ class Badge {
Badge.fromJson(Map<String, dynamic> json) {
badgeId = json['id'];
label = json['label'];
ts = (json['ts'] != null && json['ts'] is String) ? DateTime.parse(json['ts']) : null;
ts = (json['ts'] != null && json['ts'] is String) ? DateTime.parse(json['ts']) : null; // man i love osk
}
Map<String, dynamic> toJson() {

View File

@ -1,15 +1,17 @@
import 'package:flutter/material.dart';
import 'package:tetra_stats/views/main_view.dart';
import 'package:path/path.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:tetra_stats/views/main_view.dart';
import 'package:tetra_stats/views/compare_view.dart';
import 'package:tetra_stats/views/settings_view.dart';
import 'package:tetra_stats/views/states_view.dart';
void main() {
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
runApp(MaterialApp(
home: MainView(),
theme: ThemeData(
fontFamily: 'Eurostile Round',
colorScheme: ColorScheme.dark(),
scaffoldBackgroundColor: Colors.black),
home: const MainView(),
routes: {"/settings": (context) => const SettingsView(), "/compare": (context) => const CompareView(), "/states": (context) => const StatesView()},
theme: ThemeData(fontFamily: 'Eurostile Round', colorScheme: const ColorScheme.dark(), scaffoldBackgroundColor: Colors.black),
));
}

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
class CompareView extends StatefulWidget {
const CompareView({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => CompareState();
}
class CompareState extends State<CompareView> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("you vs someone"),
),
backgroundColor: Colors.black,
body: SafeArea(
child: ListView(
children: [
ListTile(
title: Center(child: Text("So thats gonna be the main purpose of the app")),
subtitle: Center(child: Text("We gonna look who is the best")),
trailing: Text("Opponent value"),
leading: Text("Your value"),
)
],
)),
);
}
}

View File

@ -21,15 +21,13 @@ const allowedHeightForPlayerIdInPixels = 40.0;
const allowedHeightForPlayerBioInPixels = 30.0;
const givenTextHeightByScreenPercentage = 0.3;
enum ThreeDotsItems { compare, states, settings }
class MainView extends StatefulWidget {
const MainView({Key? key}) : super(key: key);
String get title => "Tetra Stats: $_searchFor";
@override
State<MainView> createState() => _MyHomePageState();
State<MainView> createState() => _MainState();
}
Future<TetrioPlayer> fetchTetrioPlayer(String user) async {
@ -48,7 +46,7 @@ Future<TetrioPlayer> fetchTetrioPlayer(String user) async {
}
}
class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMixin {
class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
final bodyGlobalKey = GlobalKey();
final List<Widget> myTabs = [
const Tab(text: "Tetra League"),
@ -80,12 +78,8 @@ class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMix
],
),
onSubmitted: (String value) {
_searchFor = value;
me = null;
_tabController.animateTo(0, duration: Duration(milliseconds: 300));
setState(() {
me = fetchTetrioPlayer(value);
});
changePlayer(value);
},
);
}
@ -94,7 +88,7 @@ class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMix
void initState() {
_scrollController = ScrollController();
_tabController = TabController(length: 4, vsync: this);
me = fetchTetrioPlayer("dan63047");
changePlayer("dan63047");
super.initState();
}
@ -105,6 +99,13 @@ class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMix
super.dispose();
}
void changePlayer(String player) {
setState(() {
_searchFor = player;
me = fetchTetrioPlayer(player);
});
}
_scrollListener() {
if (fixedScroll) {
_scrollController.jumpTo(0);
@ -122,7 +123,7 @@ class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMix
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: NavDrawer(),
drawer: NavDrawer(changePlayer),
appBar: AppBar(
title: !_searchBoolean
? Text(
@ -167,20 +168,23 @@ class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMix
tooltip: "Close search",
),
PopupMenuButton(
itemBuilder: (BuildContext context) => <PopupMenuEntry<ThreeDotsItems>>[
const PopupMenuItem<ThreeDotsItems>(
value: ThreeDotsItems.compare,
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
const PopupMenuItem(
value: "/compare",
child: Text('Compare'),
),
const PopupMenuItem<ThreeDotsItems>(
value: ThreeDotsItems.states,
const PopupMenuItem(
value: "/states",
child: Text('States'),
),
const PopupMenuItem<ThreeDotsItems>(
value: ThreeDotsItems.settings,
const PopupMenuItem(
value: "/settings",
child: Text('Settings'),
),
],
onSelected: (value) {
Navigator.pushNamed(context, value);
},
),
],
),
@ -1097,6 +1101,9 @@ class _MyHomePageState extends State<MainView> with SingleTickerProviderStateMix
}
class NavDrawer extends StatelessWidget {
Function changePlayer;
NavDrawer(this.changePlayer, {super.key});
@override
Widget build(BuildContext context) {
return Drawer(
@ -1112,9 +1119,8 @@ class NavDrawer extends StatelessWidget {
leading: const Icon(Icons.verified_user),
title: const Text('dan63047'),
onTap: () {
me = fetchTetrioPlayer("dan63047");
changePlayer('dan63047');
Navigator.of(context).pop();
Navigator.of(context).initState();
},
),
],

View File

@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
class SettingsView extends StatefulWidget {
const SettingsView({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => SettingsState();
}
class SettingsState extends State<SettingsView> {
PackageInfo _packageInfo = PackageInfo(appName: "TetraStats", packageName: "idk man", version: "some numbers", buildNumber: "anotherNumber");
@override
void initState() {
super.initState();
_initPackageInfo();
}
Future<void> _initPackageInfo() async {
final info = await PackageInfo.fromPlatform();
setState(() {
_packageInfo = info;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Settings"),
),
backgroundColor: Colors.black,
body: SafeArea(
child: ListView(
children: [
ListTile(
title: const Text("So there you gonna be able to change some settings"),
subtitle: const Text(
"They are not implemented yet. But its gonna be possible to change player for main view init, save logs, as well as import and export app sqlite database."),
trailing: Switch(
value: true,
onChanged: (bool value) {},
),
),
ListTile(
title: const Text("Very egg"),
subtitle: const Text("very ass"),
trailing: const Text("dan63047"),
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: const Text("Your username in TETR.IO", style: TextStyle(fontFamily: "Eurostile Round Extended")),
content: SingleChildScrollView(
child: ListBody(children: [const TextField()]),
),
actions: <Widget>[
TextButton(
child: const Text('Cancel'),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: const Text('Submit'),
onPressed: () {
Navigator.of(context).pop();
},
)
],
)),
),
Divider(),
ListTile(
title: const Text("About app"),
subtitle: Text("${_packageInfo.appName} (${_packageInfo.packageName}) Version ${_packageInfo.version} Build ${_packageInfo.buildNumber}"),
),
],
)),
);
}
}

View File

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
class StatesView extends StatefulWidget {
const StatesView({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => StatesState();
}
class StatesState extends State<StatesView> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("States of NICKNAME account"),
),
backgroundColor: Colors.black,
body: const SafeArea(
child: Text(
"So it's gonna be possible to store history of the account. One single piece of account history is what i call \"State\". In this view you will be able to control states, delete really old ones if too many.\n\nRight now app doesn't even store it.")),
);
}
}

View File

@ -4,7 +4,7 @@ project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "tetra_stats")
set(BINARY_NAME "Tetra Stats")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.dan63.tetrastats.tetra_stats")

View File

@ -5,10 +5,12 @@
import FlutterMacOS
import Foundation
import package_info_plus
import path_provider_foundation
import sqflite
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
}

View File

@ -107,6 +107,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
@ -163,6 +168,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: ceb027f6bc6a60674a233b4a90a7658af1aebdea833da0b5b53c1e9821a78c7b
url: "https://pub.dev"
source: hosted
version: "4.0.2"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
path:
dependency: "direct main"
description:
@ -345,7 +366,7 @@ packages:
source: hosted
version: "1.3.1"
vector_math:
dependency: transitive
dependency: "direct main"
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"

View File

@ -14,7 +14,7 @@ publish_to: 'none'
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.0.1
version: 0.0.1+1
environment:
sdk: '>=2.19.6 <3.0.0'
@ -30,11 +30,13 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
vector_math: any
sqflite: ^2.2.8+2
sqflite_common_ffi: any
path_provider: ^2.0.15
path: ^1.8.2
fl_chart: ^0.62.0
package_info_plus: ^4.0.2
dev_dependencies:
flutter_test:
@ -110,6 +112,7 @@ flutter:
- res/tetrio_badges/superlobby.png
- res/tetrio_badges/superlobby2.png
- res/tetrio_badges/taws_u50_1.png
- res/tetrio_badges/taws_u50_3.png
- res/tetrio_badges/tawshdsl_uncapped.png
- res/tetrio_badges/tawsignite_expert.png
- res/tetrio_badges/tawslg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -29,7 +29,7 @@
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<title>tetra_stats</title>
<title>Tetra Stats</title>
<link rel="manifest" href="manifest.json">
<script>