diff --git a/android/app/build.gradle b/android/app/build.gradle index ec26697..cc022d3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f693b97..7b9af76 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - tetra_stats + Tetra Stats CFBundlePackageType APPL CFBundleShortVersionString diff --git a/lib/data_objects/tetrio.dart b/lib/data_objects/tetrio.dart index 4c60534..6f815ff 100644 --- a/lib/data_objects/tetrio.dart +++ b/lib/data_objects/tetrio.dart @@ -184,7 +184,7 @@ class Badge { Badge.fromJson(Map 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 toJson() { diff --git a/lib/main.dart b/lib/main.dart index d725c09..e028348 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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), )); } diff --git a/lib/views/compare_view.dart b/lib/views/compare_view.dart new file mode 100644 index 0000000..4517856 --- /dev/null +++ b/lib/views/compare_view.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; + +class CompareView extends StatefulWidget { + const CompareView({Key? key}) : super(key: key); + + @override + State createState() => CompareState(); +} + +class CompareState extends State { + @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"), + ) + ], + )), + ); + } +} diff --git a/lib/views/main_view.dart b/lib/views/main_view.dart index a9c1db4..20d6ad4 100644 --- a/lib/views/main_view.dart +++ b/lib/views/main_view.dart @@ -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 createState() => _MyHomePageState(); + State createState() => _MainState(); } Future fetchTetrioPlayer(String user) async { @@ -48,7 +46,7 @@ Future fetchTetrioPlayer(String user) async { } } -class _MyHomePageState extends State with SingleTickerProviderStateMixin { +class _MainState extends State with SingleTickerProviderStateMixin { final bodyGlobalKey = GlobalKey(); final List myTabs = [ const Tab(text: "Tetra League"), @@ -80,12 +78,8 @@ class _MyHomePageState extends State 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 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 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 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 with SingleTickerProviderStateMix tooltip: "Close search", ), PopupMenuButton( - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: ThreeDotsItems.compare, + itemBuilder: (BuildContext context) => [ + const PopupMenuItem( + value: "/compare", child: Text('Compare'), ), - const PopupMenuItem( - value: ThreeDotsItems.states, + const PopupMenuItem( + value: "/states", child: Text('States'), ), - const PopupMenuItem( - value: ThreeDotsItems.settings, + const PopupMenuItem( + value: "/settings", child: Text('Settings'), ), ], + onSelected: (value) { + Navigator.pushNamed(context, value); + }, ), ], ), @@ -1097,6 +1101,9 @@ class _MyHomePageState extends State 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(); }, ), ], diff --git a/lib/views/settings_view.dart b/lib/views/settings_view.dart new file mode 100644 index 0000000..a082f7a --- /dev/null +++ b/lib/views/settings_view.dart @@ -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 createState() => SettingsState(); +} + +class SettingsState extends State { + PackageInfo _packageInfo = PackageInfo(appName: "TetraStats", packageName: "idk man", version: "some numbers", buildNumber: "anotherNumber"); + + @override + void initState() { + super.initState(); + _initPackageInfo(); + } + + Future _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: [ + 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}"), + ), + ], + )), + ); + } +} diff --git a/lib/views/states_view.dart b/lib/views/states_view.dart new file mode 100644 index 0000000..9320d2d --- /dev/null +++ b/lib/views/states_view.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +class StatesView extends StatefulWidget { + const StatesView({Key? key}) : super(key: key); + + @override + State createState() => StatesState(); +} + +class StatesState extends State { + @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.")), + ); + } +} diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 588f8d4..e47fe42 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -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") diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 2bfe7e4..4d98e47 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -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")) } diff --git a/pubspec.lock b/pubspec.lock index 298debd..85167f9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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" diff --git a/pubspec.yaml b/pubspec.yaml index 51ec94d..357f6c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 diff --git a/res/tetrio_badges/taws_u50_3.png b/res/tetrio_badges/taws_u50_3.png new file mode 100644 index 0000000..0158753 Binary files /dev/null and b/res/tetrio_badges/taws_u50_3.png differ diff --git a/web/index.html b/web/index.html index f39d8a9..88d05b0 100644 --- a/web/index.html +++ b/web/index.html @@ -29,7 +29,7 @@ - tetra_stats + Tetra Stats