Added bottom options and reset.
This commit is contained in:
parent
78618aed9a
commit
84aaf9c527
6 changed files with 125 additions and 10 deletions
|
|
@ -35,6 +35,10 @@
|
|||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>https</string>
|
||||
</array>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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<LoginPage> {
|
|||
await prefs.setString('teamNumber', _teamNumberController.text);
|
||||
}
|
||||
|
||||
Future<void> _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<LoginPage> {
|
|||
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<LoginPage> {
|
|||
),
|
||||
)
|
||||
: 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<LoginPage> {
|
|||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const SettingsPage(),
|
||||
));
|
||||
)
|
||||
);
|
||||
},
|
||||
child: const Text('Settings'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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<SettingsPage> {
|
|||
}
|
||||
),
|
||||
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: <Widget>[
|
||||
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'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
32
pubspec.lock
32
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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue