Skip to content

Commit

Permalink
Pair YaruFlavor with its flavor color (#155)
Browse files Browse the repository at this point in the history
Implement YaruFlavor as a custom enum similarly to e.g. TextInputType
in Flutter.
  • Loading branch information
jpnurmi authored Apr 21, 2022
1 parent a130058 commit 484f2fb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 21 deletions.
48 changes: 48 additions & 0 deletions lib/src/themes/yaru_flavors.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:yaru/src/colors/yaru_colors.dart';
import 'package:yaru/src/colors/flavor_colors.dart';

/// Describes a Yaru flavor and its primary color.
class YaruFlavor {
const YaruFlavor._(this.name, this.color);

/// The name of the flavor.
final String name;

/// The primary color of the flavor.
final MaterialColor color;

/// Ubuntu Budgie
static const budgie = YaruFlavor._('budgie', FlavorColors.ubuntuBudgieBlue);

/// Kubuntu
static const kubuntu = YaruFlavor._('kubuntu', FlavorColors.kubuntuBlue);

/// Lubuntu
static const lubuntu = YaruFlavor._('lubuntu', FlavorColors.lubuntuBlue);

/// Ubuntu MATE
static const mate = YaruFlavor._('mate', FlavorColors.ubuntuMateGreen);

/// Ubuntu Studio
static const studio = YaruFlavor._('studio', FlavorColors.ubuntuStudioBlue);

/// Ubuntu
///
/// **Note**: Ubuntu supports multiple accent colors. See [YaruAccent].
static const ubuntu = YaruFlavor._('ubuntu', YaruColors.ubuntuOrange);

/// Xubuntu
static const xubuntu = YaruFlavor._('xubuntu', FlavorColors.xubuntuBlue);

/// Available Yaru flavors.
static const List<YaruFlavor> values = [
budgie,
kubuntu,
lubuntu,
mate,
studio,
ubuntu,
xubuntu,
];
}
21 changes: 0 additions & 21 deletions lib/src/widgets/inherited_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,6 @@ import 'package:platform/platform.dart';

import 'package:yaru/yaru.dart';

/// Available Yaru flavors.
enum YaruFlavor {
/// Ubuntu Budgie
budgie,

/// Kubuntu
kubuntu,

/// Lubuntu
lubuntu,

/// Ubuntu MATE
mate,

/// Ubuntu
ubuntu,

/// Xubuntu
xubuntu,
}

YaruFlavor? _detectYaruFlavor(Platform platform) {
final desktop = !kIsWeb
? platform.environment['XDG_CURRENT_DESKTOP']?.toUpperCase()
Expand Down
1 change: 1 addition & 0 deletions lib/yaru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export 'package:yaru/src/themes/common_themes.dart';
export 'package:yaru/src/themes/high_contrast.dart';
export 'package:yaru/src/themes/yaru_accents.dart';
export 'package:yaru/src/themes/yaru_dark.dart';
export 'package:yaru/src/themes/yaru_flavors.dart';
export 'package:yaru/src/themes/yaru_kubuntu_dark.dart';
export 'package:yaru/src/themes/yaru_kubuntu_light.dart';
export 'package:yaru/src/themes/yaru_light.dart';
Expand Down

0 comments on commit 484f2fb

Please sign in to comment.