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,65 +63,62 @@ 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: ListView(
|
||||||
child: SafeArea(
|
children: [
|
||||||
child: ListView(
|
ListTile(
|
||||||
children: [
|
title: Text("Accent Color"),
|
||||||
ListTile(
|
trailing: ColorIndicator(HSVColor.fromColor(Theme.of(context).colorScheme.primary)),
|
||||||
title: Text("Accent Color"),
|
onTap: () {
|
||||||
trailing: ColorIndicator(HSVColor.fromColor(Theme.of(context).primaryColorDark)),
|
showDialog(
|
||||||
onTap: () {
|
context: context,
|
||||||
showDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
context: context,
|
title: const Text('Pick a color!'),
|
||||||
builder: (BuildContext context) => AlertDialog(
|
content: SingleChildScrollView(
|
||||||
title: const Text('Pick a color!'),
|
child: ColorPicker(
|
||||||
content: SingleChildScrollView(
|
pickerColor: pickerColor,
|
||||||
child: ColorPicker(
|
onColorChanged: changeColor,
|
||||||
pickerColor: pickerColor,
|
|
||||||
onColorChanged: changeColor,
|
|
||||||
),
|
|
||||||
// Use Material color picker:
|
|
||||||
//
|
|
||||||
// child: MaterialPicker(
|
|
||||||
// pickerColor: pickerColor,
|
|
||||||
// onColorChanged: changeColor,
|
|
||||||
// showLabel: true, // only on portrait mode
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// Use Block color picker:
|
|
||||||
//
|
|
||||||
// child: BlockPicker(
|
|
||||||
// pickerColor: currentColor,
|
|
||||||
// onColorChanged: changeColor,
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// child: MultipleChoiceBlockPicker(
|
|
||||||
// pickerColors: currentColors,
|
|
||||||
// onColorsChanged: changeColors,
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
// Use Material color picker:
|
||||||
ElevatedButton(
|
//
|
||||||
child: const Text('Got it'),
|
// child: MaterialPicker(
|
||||||
onPressed: () {
|
// pickerColor: pickerColor,
|
||||||
setState(() {
|
// onColorChanged: changeColor,
|
||||||
currentColor = pickerColor;
|
// showLabel: true, // only on portrait mode
|
||||||
});
|
// ),
|
||||||
Navigator.of(context).pop();
|
//
|
||||||
},
|
// Use Block color picker:
|
||||||
),
|
//
|
||||||
]));
|
// child: BlockPicker(
|
||||||
}),
|
// pickerColor: currentColor,
|
||||||
ListTile(
|
// onColorChanged: changeColor,
|
||||||
title: Text("Font"),
|
// ),
|
||||||
),
|
//
|
||||||
ListTile(
|
// child: MultipleChoiceBlockPicker(
|
||||||
title: Text("Stats Table in TL mathes list"),
|
// pickerColors: currentColors,
|
||||||
),
|
// onColorsChanged: changeColors,
|
||||||
],
|
// ),
|
||||||
)),
|
),
|
||||||
),
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('Got it'),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
setAccentColor(pickerColor);
|
||||||
|
});
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]));
|
||||||
|
}),
|
||||||
|
ListTile(
|
||||||
|
title: Text("Font"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text("Stats Table in TL mathes list"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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