-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathadaptive_dialog.dart
48 lines (41 loc) · 1.38 KB
/
adaptive_dialog.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/material.dart';
/// Manage common adaptive_dialog settings, etc.
class AdaptiveDialog {
AdaptiveDialog._() {
Future(() async {
_cachedAccentColor = await DynamicColorPlugin.getAccentColor();
});
}
static AdaptiveDialog? _instance;
// ignore: prefer_constructors_over_static_methods
static AdaptiveDialog get instance => _instance ??= AdaptiveDialog._();
var _defaultStyle = AdaptiveStyle.adaptive;
var _macOS = AdaptiveDialogMacOSConfiguration();
Color? _cachedAccentColor;
AdaptiveStyle get defaultStyle => _defaultStyle;
AdaptiveDialogMacOSConfiguration get macOS => _macOS;
Color? get cachedAccentColor => _cachedAccentColor;
/// Update default configuration
// ignore: use_setters_to_change_properties
void updateConfiguration({
AdaptiveStyle? defaultStyle,
AdaptiveDialogMacOSConfiguration? macOS,
}) {
_defaultStyle = defaultStyle ?? _defaultStyle;
_macOS = macOS ?? _macOS;
}
// ignore: use_setters_to_change_properties
void cacheAccentColor(Color color) {
_cachedAccentColor = color;
}
}
/// Manage common macOS settings
class AdaptiveDialogMacOSConfiguration {
AdaptiveDialogMacOSConfiguration({
this.applicationIcon,
});
/// Used for macOS style dialog
final Widget? applicationIcon;
}