CUSTOM ACCENT COLOR!!!!!!
Oh my fucking god IT'S FINNALY WORKS AT LEAST SOMEHOW!!!!
This commit is contained in:
parent
7ec3d76c7f
commit
754073a6ad
|
@ -17,6 +17,11 @@ import 'package:tetra_stats/views/calc_view.dart';
|
||||||
|
|
||||||
late final PackageInfo packageInfo;
|
late final PackageInfo packageInfo;
|
||||||
late SharedPreferences prefs;
|
late SharedPreferences prefs;
|
||||||
|
ColorScheme sheme = ColorScheme.dark(primary: Colors.cyanAccent, secondary: Colors.white);
|
||||||
|
|
||||||
|
void setAccentColor(Color color){
|
||||||
|
sheme = ColorScheme.dark(primary: color, secondary: Colors.white);
|
||||||
|
}
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
|
@ -63,7 +68,7 @@ class MyApp extends StatelessWidget {
|
||||||
routes: {"/settings": (context) => const SettingsView(), "/states": (context) => const TrackedPlayersView(), "/calc": (context) => const CalcView(), "/customization": (context) => const CustomizationView()},
|
routes: {"/settings": (context) => const SettingsView(), "/states": (context) => const TrackedPlayersView(), "/calc": (context) => const CalcView(), "/customization": (context) => const CustomizationView()},
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
fontFamily: 'Eurostile Round',
|
fontFamily: 'Eurostile Round',
|
||||||
colorScheme: ColorScheme.dark(primary: Colors.cyanAccent, secondary: Colors.white),
|
colorScheme: sheme,
|
||||||
scaffoldBackgroundColor: Colors.black
|
scaffoldBackgroundColor: Colors.black
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
import 'package:tetra_stats/gen/strings.g.dart';
|
||||||
|
import 'package:tetra_stats/main.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
late String oldWindowTitle;
|
late String oldWindowTitle;
|
||||||
|
@ -45,7 +46,7 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeData getTheme(BuildContext context, Color color){
|
ThemeData getTheme(BuildContext context, Color color){
|
||||||
return Theme.of(context).copyWith();
|
return Theme.of(context).copyWith(colorScheme: ColorScheme.dark(primary: color, secondary: Colors.white));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -62,14 +63,12 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
title: Text(t.settings),
|
title: Text(t.settings),
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
body: Theme(
|
body: SafeArea(
|
||||||
data: getTheme(context, currentColor),
|
|
||||||
child: SafeArea(
|
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Accent Color"),
|
title: Text("Accent Color"),
|
||||||
trailing: ColorIndicator(HSVColor.fromColor(Theme.of(context).primaryColorDark)),
|
trailing: ColorIndicator(HSVColor.fromColor(Theme.of(context).colorScheme.primary)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -105,7 +104,7 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
child: const Text('Got it'),
|
child: const Text('Got it'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
currentColor = pickerColor;
|
setAccentColor(pickerColor);
|
||||||
});
|
});
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
|
@ -120,7 +119,6 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:tetra_stats/services/crud_exceptions.dart';
|
import 'package:tetra_stats/services/crud_exceptions.dart';
|
||||||
import 'package:tetra_stats/widgets/vs_graphs.dart';
|
import 'package:tetra_stats/widgets/vs_graphs.dart';
|
||||||
|
|
||||||
import 'main_view.dart' show teto;
|
import 'main_view.dart' show teto;
|
||||||
import 'package:fl_chart/fl_chart.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
Loading…
Reference in New Issue