Implemented ColoredIconContainer

This commit is contained in:
2026-01-17 00:52:09 +01:00
parent a8129eb134
commit 6a0896d818
6 changed files with 89 additions and 56 deletions

View File

@@ -0,0 +1,57 @@
import 'package:flutter/cupertino.dart';
import 'package:game_tracker/core/custom_theme.dart';
class ColoredIconContainer extends StatelessWidget {
/// A customizable container widget that displays an icon with a colored background.
/// - [icon]: The icon to be displayed inside the container.
/// - [containerSize]: The size of the container (width and height).
/// - [iconSize]: The size of the icon inside the container.
/// - [margin]: Optional margin around the container.
/// - [padding]: Optional padding inside the container.
const ColoredIconContainer({
super.key,
required this.icon,
this.containerSize = 44,
this.iconSize = 28,
this.margin,
this.padding,
});
/// The icon to be displayed inside the container.
final IconData icon;
/// The size of the container (width and height).
final double containerSize;
/// The size of the icon inside the container.
final double iconSize;
/// Optional margin around the container.
final EdgeInsetsGeometry? margin;
/// Optional padding inside the container.
final EdgeInsetsGeometry? padding;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
width: containerSize,
height: containerSize,
margin: margin,
padding: padding,
decoration: BoxDecoration(
color: CustomTheme.primaryColor.withAlpha(40),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
icon,
size: iconSize,
color: CustomTheme.primaryColor.withGreen(40),
),
),
],
);
}
}

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/license_detail_view.dart';
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart';
import 'package:game_tracker/presentation/widgets/colored_icon.dart';
class LicenseTile extends StatelessWidget {
/// A tile widget that displays information about a software package license.
@@ -29,18 +30,10 @@ class LicenseTile extends StatelessWidget {
),
child: Row(
children: [
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: CustomTheme.primaryColor.withAlpha(40),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
Icons.description,
color: CustomTheme.primaryColor,
size: 32,
),
const ColoredIconContainer(
icon: Icons.description,
containerSize: 50,
iconSize: 32,
),
const SizedBox(width: 16),
Expanded(

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
import 'package:game_tracker/presentation/widgets/colored_icon.dart';
class SettingsListTile extends StatelessWidget {
/// A customizable settings list tile widget that displays an icon, title, and an optional suffix widget.
@@ -46,18 +47,10 @@ class SettingsListTile extends StatelessWidget {
Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
color: CustomTheme.primaryColor.withAlpha(40),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
icon,
size: 28,
color: CustomTheme.primaryColor.withGreen(40),
),
ColoredIconContainer(
icon: icon,
containerSize: 44,
iconSize: 28,
),
const SizedBox(width: 16),
Text(title, style: const TextStyle(fontSize: 18)),