Refactored several theme settings into custom theme
This commit is contained in:
@@ -1,38 +1,59 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class CustomTheme {
|
class CustomTheme {
|
||||||
|
CustomTheme._(); // Private constructor to prevent instantiation
|
||||||
|
|
||||||
|
// ==================== Colors ====================
|
||||||
static Color primaryColor = const Color(0xFF7505E4);
|
static Color primaryColor = const Color(0xFF7505E4);
|
||||||
static Color secondaryColor = const Color(0xFFAFA2FF);
|
static Color secondaryColor = const Color(0xFFAFA2FF);
|
||||||
static Color backgroundColor = const Color(0xFF0B0B0B);
|
static Color backgroundColor = const Color(0xFF0B0B0B);
|
||||||
static Color boxColor = const Color(0xFF101010);
|
static Color boxColor = const Color(0xFF101010);
|
||||||
static Color onBoxColor = const Color(0xFF181818);
|
static Color onBoxColor = const Color(0xFF181818);
|
||||||
static Color boxBorder = const Color(0xFF272727);
|
static Color boxBorder = const Color(0xFF272727);
|
||||||
|
static const Color textColor = Colors.white;
|
||||||
|
|
||||||
|
// ==================== Border Radius ====================
|
||||||
|
static const double standardBorderRadius = 12.0;
|
||||||
|
static BorderRadius get standardBorderRadiusAll =>
|
||||||
|
BorderRadius.circular(standardBorderRadius);
|
||||||
|
|
||||||
|
// ==================== Padding & Margins ====================
|
||||||
|
static const EdgeInsets standardMargin = EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 10,
|
||||||
|
);
|
||||||
|
static const EdgeInsets tileMargin = EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 5,
|
||||||
|
);
|
||||||
|
|
||||||
|
// ==================== Decorations ====================
|
||||||
static BoxDecoration standardBoxDecoration = BoxDecoration(
|
static BoxDecoration standardBoxDecoration = BoxDecoration(
|
||||||
color: boxColor,
|
color: boxColor,
|
||||||
border: Border.all(color: boxBorder),
|
border: Border.all(color: boxBorder),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: standardBorderRadiusAll,
|
||||||
);
|
);
|
||||||
|
|
||||||
static BoxDecoration highlightedBoxDecoration = BoxDecoration(
|
static BoxDecoration highlightedBoxDecoration = BoxDecoration(
|
||||||
color: boxColor,
|
color: boxColor,
|
||||||
border: Border.all(color: primaryColor),
|
border: Border.all(color: primaryColor),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: standardBorderRadiusAll,
|
||||||
boxShadow: [BoxShadow(color: primaryColor.withAlpha(120), blurRadius: 12)],
|
boxShadow: [BoxShadow(color: primaryColor.withAlpha(120), blurRadius: 12)],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ==================== App Bar Theme ====================
|
||||||
static AppBarTheme appBarTheme = AppBarTheme(
|
static AppBarTheme appBarTheme = AppBarTheme(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: textColor,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
titleTextStyle: const TextStyle(
|
titleTextStyle: const TextStyle(
|
||||||
color: Colors.white,
|
color: textColor,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
iconTheme: const IconThemeData(color: Colors.white),
|
iconTheme: const IconThemeData(color: textColor),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
margin: CustomTheme.standardMargin,
|
||||||
child: TextInputField(
|
child: TextInputField(
|
||||||
controller: _groupNameController,
|
controller: _groupNameController,
|
||||||
hintText: loc.group_name,
|
hintText: loc.group_name,
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
margin: CustomTheme.tileMargin,
|
||||||
child: TextInputField(
|
child: TextInputField(
|
||||||
controller: _matchNameController,
|
controller: _matchNameController,
|
||||||
hintText: hintText ?? '',
|
hintText: hintText ?? '',
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
values: winCounts,
|
values: winCounts,
|
||||||
itemCount: 3,
|
itemCount: 3,
|
||||||
barColor: Colors.blue,
|
barColor: Colors.green,
|
||||||
),
|
),
|
||||||
SizedBox(height: constraints.maxHeight * 0.02),
|
SizedBox(height: constraints.maxHeight * 0.02),
|
||||||
StatisticsTile(
|
StatisticsTile(
|
||||||
@@ -75,7 +75,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
values: matchCounts,
|
values: matchCounts,
|
||||||
itemCount: 10,
|
itemCount: 10,
|
||||||
barColor: Colors.green,
|
barColor: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class CustomWidthButton extends StatelessWidget {
|
|||||||
60,
|
60,
|
||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -91,7 +91,7 @@ class CustomWidthButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
side: BorderSide(color: borderSideColor, width: 2),
|
side: BorderSide(color: borderSideColor, width: 2),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ class _QuickCreateButtonState extends State<QuickCreateButton> {
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
minimumSize: const Size(140, 45),
|
minimumSize: const Size(140, 45),
|
||||||
backgroundColor: CustomTheme.primaryColor,
|
backgroundColor: CustomTheme.primaryColor,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.text,
|
widget.text,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
margin: CustomTheme.standardMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
decoration: CustomTheme.standardBoxDecoration,
|
decoration: CustomTheme.standardBoxDecoration,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class _ChooseTileState extends State<ChooseTile> {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: widget.onPressed,
|
onTap: widget.onPressed,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
margin: CustomTheme.tileMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
decoration: CustomTheme.standardBoxDecoration,
|
decoration: CustomTheme.standardBoxDecoration,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CustomRadioListTile<T> extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: CustomTheme.boxColor,
|
color: CustomTheme.boxColor,
|
||||||
border: Border.all(color: CustomTheme.boxBorder),
|
border: Border.all(color: CustomTheme.boxBorder),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class GroupTile extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
margin: CustomTheme.standardMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||||
decoration: isHighlighted
|
decoration: isHighlighted
|
||||||
? CustomTheme.highlightedBoxDecoration
|
? CustomTheme.highlightedBoxDecoration
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: widget.onTap,
|
onTap: widget.onTap,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
margin: CustomTheme.tileMargin,
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: CustomTheme.boxColor,
|
color: CustomTheme.boxColor,
|
||||||
border: Border.all(color: CustomTheme.boxBorder),
|
border: Border.all(color: CustomTheme.boxBorder),
|
||||||
@@ -118,7 +118,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.white,
|
color: CustomTheme.textColor,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user