From 84aaf9c527a93240aed217953f51e1bdbd5e0b74 Mon Sep 17 00:00:00 2001 From: Raktbastr Date: Fri, 23 Jan 2026 17:27:24 -0600 Subject: [PATCH] Added bottom options and reset. --- ios/Runner/Info.plist | 4 ++++ lib/core/theme.dart | 2 +- lib/login.dart | 53 ++++++++++++++++++++++++++++++++++++------- lib/settings.dart | 41 +++++++++++++++++++++++++++++++++ pubspec.lock | 32 ++++++++++++++++++++++++++ pubspec.yaml | 3 ++- 6 files changed, 125 insertions(+), 10 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 5b0e213..36952d1 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -35,6 +35,10 @@ UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad + LSApplicationQueriesSchemes + + https + UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown diff --git a/lib/core/theme.dart b/lib/core/theme.dart index e1b80f9..b84607f 100644 --- a/lib/core/theme.dart +++ b/lib/core/theme.dart @@ -117,7 +117,7 @@ final ThemeData laserTheme = ThemeData( textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( foregroundColor: Colors.white, - backgroundColor: Colors.white, + backgroundColor: Color(0x00FFFFFF), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), ), ), diff --git a/lib/login.dart b/lib/login.dart index c11cba4..a31463d 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -4,6 +4,7 @@ import 'core/theme.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'eventpicker.dart'; import 'settings.dart'; +import 'package:url_launcher/url_launcher.dart'; void main() { runApp(const MyApp()); @@ -49,6 +50,12 @@ class _LoginPageState extends State { await prefs.setString('teamNumber', _teamNumberController.text); } + Future _launchUrl(Uri url) async { + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + } + @override void dispose() { _teamNumberController.dispose(); @@ -65,7 +72,7 @@ class _LoginPageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.asset('assets/main.png', height: 100), + Image.asset('assets/main.png', height: 75, alignment: Alignment.center), const SizedBox(height: 16.0), TextField( controller: _teamNumberController, @@ -120,9 +127,38 @@ class _LoginPageState extends State { ), ) : const Text('Login'), + ) + ], + ), + ), + bottomNavigationBar: Padding ( + padding: const EdgeInsets.all(50.0), + child: Row ( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + TextButton( + child: const Text('Info'), + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Info'), + content: const Text( + "This app makes use of The Blue Alliance APIv3 through Laser Proxy. No API keys are stored on device. Laser Scouter was created by FRC 2077 Laser Robotics. \n\nVersion: Rebuilt 26.1.23" + ), + ); + } + ); + }, ), - const SizedBox(height: 8), - ElevatedButton( + TextButton( + child: const Text('Github'), + onPressed: () { + _launchUrl(Uri.parse('https://github.com/raktbastr/laserscouter')); + } + ), + TextButton( onPressed: _isLoading ? null : () { @@ -130,13 +166,14 @@ class _LoginPageState extends State { context, MaterialPageRoute( builder: (context) => const SettingsPage(), - )); + ) + ); }, child: const Text('Settings'), - ), - ], - ), - ), + ) + ] + ) + ) ); } } \ No newline at end of file diff --git a/lib/settings.dart b/lib/settings.dart index a35592f..a45f2c6 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'core/api.dart'; +import 'login.dart'; class SettingsPage extends StatefulWidget { const SettingsPage({super.key}); @@ -72,6 +73,46 @@ class _SettingsPageState extends State { } ), const Divider(height: 32), + ElevatedButton( + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Reset All Data'), + content: const Text('Are you sure you want to reset all data?'), + actions: [ + ElevatedButton( + onPressed: () async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + await prefs.clear(); + Navigator.pop(context); + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => const LoginPage(), + ), + ); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + textStyle: const TextStyle(color: Colors.white), + ), + child: const Text('Yes'), + ), + ElevatedButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text('No'), + ), + ] + ); + } + ); + }, + child: const Text('Reset All Data'), + ), ], ), ); diff --git a/pubspec.lock b/pubspec.lock index 7efa8ce..c834068 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -637,6 +637,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "767344bf3063897b5cf0db830e94f904528e6dd50a6dfaf839f0abf509009611" + url: "https://pub.dev" + source: hosted + version: "6.3.28" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: cfde38aa257dae62ffe79c87fab20165dfdf6988c1d31b58ebf59b9106062aad + url: "https://pub.dev" + source: hosted + version: "6.3.6" url_launcher_linux: dependency: transitive description: @@ -645,6 +669,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.2" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18" + url: "https://pub.dev" + source: hosted + version: "3.2.5" url_launcher_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 00fd429..740e216 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 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: 1.0.0+1 +version: 26.1.23 environment: sdk: ^3.10.7 @@ -40,6 +40,7 @@ dependencies: flutter_launcher_icons: ^0.14.4 rename_app: ^1.6.5 http: ^1.6.0 + url_launcher: ^6.3.2 dev_dependencies: flutter_test: