Rewrote pretty much all of it. New logo/icons. Overall did alot tbh.
This commit is contained in:
parent
5858a4a231
commit
d128768478
142 changed files with 968 additions and 3875 deletions
69
lib/core/api.dart
Normal file
69
lib/core/api.dart
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
String proxyURL = "https://laserscouter.halfheart.net/";
|
||||
|
||||
class TeamSearchResult {
|
||||
final List<String> eventNames;
|
||||
final List<String> eventCodes;
|
||||
|
||||
TeamSearchResult({required this.eventNames, required this.eventCodes});
|
||||
}
|
||||
|
||||
class EventSearchResult {
|
||||
final List<String> teamNames;
|
||||
final List<String> teamCodes;
|
||||
|
||||
EventSearchResult({required this.teamNames, required this.teamCodes});
|
||||
}
|
||||
|
||||
Future<TeamSearchResult> teamSearch(String teamNumber) async {
|
||||
try {
|
||||
final response = await http.get(
|
||||
Uri.parse('${proxyURL}teamsearch/$teamNumber'),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
List<String> eventNames = [];
|
||||
List<String> eventCodes = [];
|
||||
|
||||
for (var event in data) {
|
||||
eventNames.add(event['name']);
|
||||
eventCodes.add(event['key']);
|
||||
}
|
||||
return TeamSearchResult(eventNames: eventNames, eventCodes: eventCodes);
|
||||
} else {
|
||||
throw Exception('Failed to load events. Status code: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Error in teamSearch: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<EventSearchResult> eventSearch(String eventCode) async {
|
||||
try {
|
||||
final response = await http.get(
|
||||
Uri.parse('${proxyURL}eventsearch/$eventCode'),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
List<String> teamNames = [];
|
||||
List<String> teamCodes = [];
|
||||
|
||||
for (var event in data) {
|
||||
teamNames.add(event['nickname']);
|
||||
teamCodes.add(event['team_number'].toString());
|
||||
}
|
||||
return EventSearchResult(teamNames: teamNames, teamCodes: teamCodes);
|
||||
} else {
|
||||
throw Exception('Failed to load teams. Status code: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Error in eventSearch: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
128
lib/core/theme.dart
Normal file
128
lib/core/theme.dart
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
final ThemeData laserTheme = ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: const Color(0xFF00245D),
|
||||
primary: const Color(0xFF00245D),
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
|
||||
textTheme: TextTheme(
|
||||
displayLarge: GoogleFonts.aldrich(
|
||||
fontSize: 57,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
displayMedium: GoogleFonts.aldrich(
|
||||
fontSize: 45,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
displaySmall: GoogleFonts.aldrich(
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
|
||||
titleLarge: GoogleFonts.openSans(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
titleMedium: GoogleFonts.openSans(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
titleSmall: GoogleFonts.openSans(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
|
||||
bodyLarge: GoogleFonts.openSans(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
bodyMedium: GoogleFonts.openSans(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
bodySmall: GoogleFonts.openSans(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
|
||||
labelLarge: GoogleFonts.openSans(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
labelMedium: GoogleFonts.openSans(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
labelSmall: GoogleFonts.openSans(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
appBarTheme: AppBarTheme(
|
||||
titleTextStyle: GoogleFonts.aldrich(
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
),
|
||||
backgroundColor: const Color(0xFF00245D),
|
||||
elevation: 4,
|
||||
centerTitle: false,
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
),
|
||||
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFF00245D), width: 2.0),
|
||||
),
|
||||
floatingLabelStyle: TextStyle(color: Colors.white),
|
||||
hintStyle: TextStyle(color: Colors.white54),
|
||||
),
|
||||
|
||||
sliderTheme: SliderThemeData(
|
||||
activeTrackColor: const Color(0xFF00245D),
|
||||
thumbColor: const Color(0xFF00245D),
|
||||
inactiveTrackColor: Colors.grey.shade800,
|
||||
),
|
||||
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
fillColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return const Color(0xFF00245D);
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
checkColor: WidgetStateProperty.all(Colors.white),
|
||||
),
|
||||
|
||||
switchTheme: SwitchThemeData(
|
||||
thumbColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return const Color(0xFF00245D);
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
trackColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return const Color(0xFF00245D).withValues(alpha: 0.5);
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Colors.grey.shade800),
|
||||
)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue