mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-04 20:30:35 +00:00
Added use theme color for status
This commit is contained in:
parent
3875f161ca
commit
6b593dc195
7 changed files with 80 additions and 14 deletions
|
@ -1,4 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
|
||||
class StatusBox extends StatelessWidget {
|
||||
final IconData icon;
|
||||
|
@ -14,6 +17,8 @@ class StatusBox extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
return AnimatedContainer(
|
||||
padding: const EdgeInsets.all(12),
|
||||
width: double.maxFinite,
|
||||
|
@ -22,21 +27,29 @@ class StatusBox extends StatelessWidget {
|
|||
curve: Curves.easeInOut,
|
||||
decoration: BoxDecoration(
|
||||
color: isEnabled == true
|
||||
? Colors.green
|
||||
: Colors.red,
|
||||
? appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).primaryColor
|
||||
: Colors.green
|
||||
: appConfigProvider.useThemeColorForStatus == true
|
||||
? Colors.grey
|
||||
: Colors.red,
|
||||
borderRadius: BorderRadius.circular(16)
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
color: appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).primaryColor.computeLuminance() > 0.5 ? Colors.black : Colors.white
|
||||
: Colors.grey.computeLuminance() > 0.5 ? Colors.black : Colors.white,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).primaryColor.computeLuminance() > 0.5 ? Colors.black : Colors.white
|
||||
: Colors.grey.computeLuminance() > 0.5 ? Colors.black : Colors.white,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue